From 64ff6ee2e4c5aa501825eaa2e892af3254ed7d86 Mon Sep 17 00:00:00 2001 From: Nathaniel Cook Date: Thu, 10 Feb 2022 14:32:12 -0700 Subject: [PATCH] chore(release): add prep-release script The Flux release process will now require a preparation step. This still will make and commit any changes to the source code, i.e. updating docs to mark the correct version a function was introduced. The process will be: 1. Run ./prep-release.sh in Flux repo 2. Merge created PR 3. Run IDPE release script (which calls the Flux release script) The Flux release script checks that the prep step was completed so it can't be easily forgotten. --- docs/fluxdoc.md | 3 +++ etc/checkprepared.sh | 30 ++++++++++++++++++++++ etc/fixup_docs_version.sh | 14 ++++++++++ libflux/Cargo.lock | 4 +-- libflux/flux-core/Cargo.toml | 4 +-- libflux/flux/Cargo.toml | 4 +-- libflux/go/libflux/buildinfo.gen.go | 6 ++--- prep-release.sh | 40 +++++++++++++++++++++++++++++ release.sh | 2 ++ 9 files changed, 98 insertions(+), 9 deletions(-) create mode 100755 etc/checkprepared.sh create mode 100755 etc/fixup_docs_version.sh create mode 100755 prep-release.sh diff --git a/docs/fluxdoc.md b/docs/fluxdoc.md index 0215a871be..bae8b3f06f 100644 --- a/docs/fluxdoc.md +++ b/docs/fluxdoc.md @@ -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. + ```js // Package examplePkg provides functions that do x and y. // diff --git a/etc/checkprepared.sh b/etc/checkprepared.sh new file mode 100755 index 0000000000..18c3feeb10 --- /dev/null +++ b/etc/checkprepared.sh @@ -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') + +if [ $EXIT -ne 0 ] +then + echo "Flux not prepared for release. Run ./prep_release.sh to start the release preparation process." +fi +exit $EXIT diff --git a/etc/fixup_docs_version.sh b/etc/fixup_docs_version.sh new file mode 100755 index 0000000000..a8ac522c7f --- /dev/null +++ b/etc/fixup_docs_version.sh @@ -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') diff --git a/libflux/Cargo.lock b/libflux/Cargo.lock index bbb526171e..233ac54d0f 100644 --- a/libflux/Cargo.lock +++ b/libflux/Cargo.lock @@ -452,7 +452,7 @@ dependencies = [ [[package]] name = "flux" -version = "0.5.1" +version = "0.154.0" dependencies = [ "anyhow", "criterion", @@ -473,7 +473,7 @@ dependencies = [ [[package]] name = "flux-core" -version = "0.4.0" +version = "0.154.0" dependencies = [ "anyhow", "chrono", diff --git a/libflux/flux-core/Cargo.toml b/libflux/flux-core/Cargo.toml index 8d8fce6d33..5dee8a3fef 100644 --- a/libflux/flux-core/Cargo.toml +++ b/libflux/flux-core/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "flux-core" -version = "0.4.0" -authors = ["Nathaniel Cook "] +version = "0.154.0" +authors = ["Flux Team "] edition = "2021" [lib] diff --git a/libflux/flux/Cargo.toml b/libflux/flux/Cargo.toml index e26b30a5ea..f12f04b0a8 100644 --- a/libflux/flux/Cargo.toml +++ b/libflux/flux/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "flux" -version = "0.5.1" -authors = ["jlapacik "] +version = "0.154.0" +authors = ["Flux Team "] edition = "2021" [lib] diff --git a/libflux/go/libflux/buildinfo.gen.go b/libflux/go/libflux/buildinfo.gen.go index 9e2001f5c8..ec91c00840 100644 --- a/libflux/go/libflux/buildinfo.gen.go +++ b/libflux/go/libflux/buildinfo.gen.go @@ -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", @@ -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", diff --git a/prep-release.sh b/prep-release.sh new file mode 100755 index 0000000000..25105d803d --- /dev/null +++ b/prep-release.sh @@ -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 diff --git a/release.sh b/release.sh index e63d027cce..d271167d0b 100755 --- a/release.sh +++ b/release.sh @@ -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