Create tools/release.go to automate release tagging #6731
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Create tools/release.go, a small Go script which automates the creation of release tags.
In its primary mode, it creates a new release tag pointing at the current tip of
main
. The script assumes that you have "github.com/letsencrypt/boulder" (i.e. this repo) set as your "origin" remote. The new tag is always of the format "v0.YYYYMMDD.0", so that the major version does not make any backwards-compatibility guarantees, the minor version continues our tradition of date-stamping our version numbers, and the patch version can be incremented by hotfix releases. It only pushes the newly-created tag if passed the "-f" flag; otherwise it just creates the new tag locally and exits, allowing the user to inspect it and push it themselves.In its hotfix mode, it cherry-picks any number of given commits on top of a previously-tagged release, increments the patch portion of the release version number, creates a new tag with the incremented version number, and pushes the resulting tag to the "origin" remote. It also creates (or updates, if one already exists) a corresponding branch whose name is the major and minor portions of the version tag.
This tag naming system is superior to our current "release-YYYY-MM-DD[a]" system for a few reasons. First, by virtue of being a Semver, we get access to tools (like the semver library used in this script, and pkg.go.dev) which understand semver. It shortens our tags, making them easier to read in horizontally-constrained environments like github's tag dropdowns and releases sidebar. And it provides a dedicated place (the patch version) for us to indicate hotfix tags, rather than our ad-hoc letter-based suffix system.
At the current moment, this script has little safety and ergonomics built-in. For example, if one of the cherry-picks fails, it simply quits and dumps the user back into their shell, now likely in git's conflict-resolution mode. Also, because the
git cherry-pick
command requires that the target ref be checked out, this script changes the user's current branch and does not change it back. However, these can be added over time, as the straight-line logic and familiar Go code make it easy to hack on and improve.Fixes #5726