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

build: INFENG-933: add GitHub action to start a minor release #10112

Merged
merged 15 commits into from
Oct 25, 2024

Conversation

davidfluck-hpe
Copy link
Contributor

@davidfluck-hpe davidfluck-hpe commented Oct 23, 2024

Ticket

INFENG-933

Description

This changeset introduces a new GitHub action, start-minor-release.yml, which will, for the time being, be used to kick off minor releases. I'll explain why we need to do this, and then how.

I wasn't quite able to eliminate all of the additional stateful commits that happen as part of the old release process in time for the upcoming release. What remains is two scripts that rph used to run: lock-api-state.sh and lock-published-urls.sh. lock-api-state.sh generates a new buf image, proto/buf.image.bin, which is used ahead of subsequent releases to check for breaking API changes. I was unable to replace that in a way that sufficiently reproduced this functionality (e.g. with pre-commit). I believe lock-published-urls.sh would be fine to run as part of every pre-commit check, or at least on every PR, but I also don't have time to test that out before the upcoming release, either.

How this works is straightforward: the action validates the input version string, configures the git author information, sets up Go, installs buf/protobuf dependencies, creates a release branch with that version string, pushes it to origin, checks out main, runs the two scripts mentioned above, then pushes main back to origin. These lines in rph, basically, albeit without running bumpversion.

Test Plan

GitHub actions are always tricky to test, especially this one, because it makes changes on main and creates a release branch. I did, however, test this out on the determined-dryrun repository, with the same GitHub action. You can see that the automation created a new release branch, release-0.39.0, and then made the two requisite commits on main for lock-api-state.sh and lock-published-urls.sh, complete with similar changes that will get made for the upcoming production release.

Checklist

  • Changes have been manually QA'd
  • New features have been approved by the corresponding PM
  • User-facing API changes have the "User-facing API Change" label
  • Release notes have been added as a separate file under docs/release-notes/
    See Release Note for details.
  • Licenses have been included for new code which was copied and/or modified from any external code

Add GitHub action to start a minor release. This is necessary,
temporarily, to run both lock-api-state.sh and lock-published-urls.sh,
until we can figure out a way to make those same guarantees without
committing directly to main every time we do a minor release. This
basically just reproduces a small part of rph, but with GitHub actions
instead.
Add steps to install Go and the buf/protobuf dependencies.

Add some helpful newlines for readability.
Add ::error:: to error output on version string validation step.
@davidfluck-hpe davidfluck-hpe requested review from mackrorysd, dannysauer and a team October 23, 2024 21:58
@cla-bot cla-bot bot added the cla-signed label Oct 23, 2024
Copy link

netlify bot commented Oct 23, 2024

Deploy Preview for determined-ui canceled.

Name Link
🔨 Latest commit 14bde95
🔍 Latest deploy log https://app.netlify.com/sites/determined-ui/deploys/671a6c39be6144000837e4ca

Comment on lines 20 to 26
grep -E -o '[0-9]+\.[0-9]+\.0' <(printf "%s" '${{ github.event.inputs.version }}')

ret=$?
if [[ $ret != 0 ]]; then
echo '::error::Version string must match <[0-9]+\.[0-9]+\.0>. Got: <${{ github.event.inputs.version }}>'
exit $ret
fi
Copy link
Contributor

Choose a reason for hiding this comment

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

Since you're setting the shell to bash, you can technically just use bash pattern matching. Just think of the amazing speed improvement when you don't need a subshell and a fork!

Suggested change
grep -E -o '[0-9]+\.[0-9]+\.0' <(printf "%s" '${{ github.event.inputs.version }}')
ret=$?
if [[ $ret != 0 ]]; then
echo '::error::Version string must match <[0-9]+\.[0-9]+\.0>. Got: <${{ github.event.inputs.version }}>'
exit $ret
fi
shopt -s extglob
v='${{ github.event.inputs.version }}'
if [[ "$v" != @(+(0-0).+(0-9).0) ]]; then
echo '::error::Version string must match <[0-9]+\.[0-9]+\.0>. Got: <'"$v"'>'
exit 1
fi

Feel free to ignore this suggestion completely. People actually understand grep. :D

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Huh. Neat! I always learn something new about Bash from you.

Add GH_TOKEN env variable to use the DETERMINED_TOKEN secret, otherwise
expect permissions issues when non-admins run the action.

Add explicit contents: write permission.
@davidfluck-hpe davidfluck-hpe merged commit f97fb5a into main Oct 25, 2024
78 of 90 checks passed
@davidfluck-hpe davidfluck-hpe deleted the INFENG-933-start-release branch October 25, 2024 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants