Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(release): add prep-release script #4473

Merged
merged 1 commit into from
Feb 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/fluxdoc.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ Each key-value pair must be on a single line.
and categorize packages. _See [Metadata tags](#metadata-tags)._
- **contributors**: Contributor GitHub usernames or other contact information.

When adding a new export to a Flux package the `introduced: NEXT` metadata can be added to the value's docs.
The release process will automatically replace the `NEXT` with the version of the Flux release.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sanderson FYI we are looking to add this to our release process.

```js
// Package examplePkg provides functions that do x and y.
//
Expand Down
30 changes: 30 additions & 0 deletions etc/checkprepared.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

# This script's purpose is to check that any needed changes to the source
# have been made prerelease.
#
# For example we check that all instances of 'introduced: NEXT' in the docs
# have been replaced with a version instead.

# Make sure we are at the repo root
DIR=$(cd $(dirname ${BASH_SOURCE[0]}) && pwd)/..
cd $DIR

EXIT=0
while read f
do
# Check for any introduced: NEXT comments that still exist
grep "^//[[:space:]]*introduced:[[:space:]]\+NEXT[[:space:]]*$" $f > /dev/null
ret=$?
if [ $ret -eq 0 ]
then
EXIT=1
echo "$f contains 'introduced: NEXT'"
fi
done < <(find ./stdlib -name '*.flux')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, this is quite the bash-ism. I had to read it a couple of times to realize what it did, and then spent a little more time trying to think of how I would implement it, and none of them are as efficient as this is.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to do it this way so that if we get spaces in file names it doesn't break.


if [ $EXIT -ne 0 ]
then
echo "Flux not prepared for release. Run ./prep_release.sh to start the release preparation process."
fi
exit $EXIT
14 changes: 14 additions & 0 deletions etc/fixup_docs_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

# Make sure we are at the repo root
DIR=$(cd $(dirname ${BASH_SOURCE[0]}) && pwd)
cd $DIR/..

# Version is the first and only arg, remove the 'v' prefix.
version=${1//v/}

while read f
do
# Replace any introduced: NEXT comment with the actual version
sed -i "s/^\/\/[[:space:]]*introduced:[[:space:]]\+NEXT[[:space:]]*$/\/\/ introduced: $version/g" $f
done < <(find ./stdlib -name '*.flux')
4 changes: 2 additions & 2 deletions libflux/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions libflux/flux-core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "flux-core"
version = "0.4.0"
authors = ["Nathaniel Cook <nathaniel@influxdata.com>"]
version = "0.154.0"
authors = ["Flux Team <flux-developers@influxdata.com>"]
edition = "2021"

[lib]
Expand Down
4 changes: 2 additions & 2 deletions libflux/flux/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "flux"
version = "0.5.1"
authors = ["jlapacik <[email protected]>"]
version = "0.154.0"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to add a step to automatically bump the version in the Cargo file too. But the cargo-bump utility we used doesn't yet support workspace based projects. See https://github.com/wraithan/cargo-bump/blob/master/src/config.rs#L102

We can add that behavior of the release later.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this is one of those things that has always bothered me.

There are a couple of cargo tools that don't with workspaces that I use regularly. It makes me sad.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Submitted PR to cargo-bump for workspace support wraithan/cargo-bump#34

authors = ["Flux Team <[email protected]>"]
edition = "2021"

[lib]
Expand Down
6 changes: 3 additions & 3 deletions libflux/go/libflux/buildinfo.gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ package libflux
// are not tracked by Go's build system.'
//lint:ignore U1000 generated code
var sourceHashes = map[string]string{
"libflux/Cargo.lock": "0bd3c2f9c3963c00bda2d1b4025f1ceff8398fc3206e8368103198b82c013f45",
"libflux/Cargo.lock": "2887717e02e04fc1da40d04ae2654201713c2ed2852ef4387b132c36a4b50a0f",
"libflux/Cargo.toml": "91ac4e8b467440c6e8a9438011de0e7b78c2732403bb067d4dd31539ac8a90c1",
"libflux/flux-core/Cargo.toml": "29aeb30767497696dc0524db2e127cbd59e633870903e30d965febae981868bc",
"libflux/flux-core/Cargo.toml": "590d5c9460527d2fa95d55c543ae528afce16dcb3fab1d02475f4e5b2be6b24c",
"libflux/flux-core/src/ast/check/mod.rs": "47e06631f249715a44c9c8fa897faf142ad0fa26f67f8cfd5cd201e82cb1afc8",
"libflux/flux-core/src/ast/flatbuffers/ast_generated.rs": "895e09284030a8ea05883fbb71d67282a6b567678126f2e2aadfc5bca72ed47d",
"libflux/flux-core/src/ast/flatbuffers/mod.rs": "4e2d11d442ba3985024d5102c22c007dd9686f54cf942e79e5911c367fac7586",
Expand Down Expand Up @@ -58,7 +58,7 @@ var sourceHashes = map[string]string{
"libflux/flux-core/src/semantic/walk/mod.rs": "2d44af6df22c6b93f5155c15cffd28be940f45668883c9b2d4a1184a72a68c68",
"libflux/flux-core/src/semantic/walk/test_utils.rs": "b980587707038c420d16b99f99587e69b71f02c32277db37c7e4a094d32f2b38",
"libflux/flux-core/src/semantic/walk/walk_mut.rs": "0d2482aeb8d270fdf09627577f921e841ee48803e4c5cc0c5ed3a88bc7709a67",
"libflux/flux/Cargo.toml": "41a252f1f8c3cd3993fcc0c4848b32a1086393758f806d7c802499d936caffc6",
"libflux/flux/Cargo.toml": "a2e64e0276b020bd66b9ae958343fed39ba838e723d101c81a415524e093945b",
"libflux/flux/FLUXDOC.md": "92e6dd8043bd87b4924e09aa28fb5346630aee1214de28ea2c8fc0687cad0785",
"libflux/flux/build.rs": "c3257f0014596c8f41396a115ffef11413aebd52006ec5fd5b7fc81cbe82ebd0",
"libflux/flux/src/lib.rs": "83c97e5c89d9cde912ff89b9bfb258866768509eac8006bd129455306d2835c2",
Expand Down
40 changes: 40 additions & 0 deletions prep-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash

# Run this script to prepare a Flux release
#
# This script is responsible for creating a commit that finalizes any changes
# to the source that need to be made before a release.
#
# The following optional dependencies are helpful if available.
#
# - `hub`, which will submit PRs for the update branches automatically if
# available.

DIR=$(cd $(dirname ${BASH_SOURCE[0]}) && pwd)
cd $DIR

set -e

version=$(./gotool.sh github.com/influxdata/changelog nextver)

git checkout -b prep-release/$version

./etc/fixup_docs_version.sh $version

message="build(flux): prepare Flux release for $version"

git commit -am "$message"

if ! command -v hub &> /dev/null
then
echo "hub is not installed. Cannot open github PRs automatically."
echo "Pull requests will have to be manually created."
HAS_HUB=0
else
HAS_HUB=1
fi

if [ $HAS_HUB -eq 1 ]
then
hub pull-request -m "$message" -r influxdata/flux-team
fi
2 changes: 2 additions & 0 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ cd $DIR

set -e

./etc/checkprepared.sh

remote=$(git rev-parse "@{u}") # "@{u}" gets the current upstream branch
local=$(git rev-parse @) # '@' gets the current local branch
# check if local commit syncs with remote
Expand Down