-
Notifications
You must be signed in to change notification settings - Fork 45
Release Process
hermetic_cc_toolchain being post-v1 means that it is used at large-scale in production, but not a specific backwards-compatibility promise.
The release criteria is as follows:
- Major releases are for any backwards-incompatible changes.
- Minor releases are for new features (workarounds for upstream count as features, not bug fixes).
- Patch releases are for bug fixes in hermetic_cc_toolchain and upgrades of Zig SDK.
We do not promise to keep backwards compatibility, but we will warn about it by cutting a new major version. We do not intend to maintain past major versions unless there are exceptional circumstances.
Note that it is a good tone to cut a new release when Zig SDK is upgraded in hermetic_cc_toolchain, but by no means promised or required.
If Zig SDK has not been updated in a while (we try to update it at least every 2 months or so), here is how to do it:
- Run this and save the output:
wget https://ziglang.org/download/index.json
jq -r '.master | [.["aarch64-linux", "x86_64-linux", "aarch64-macos", "x86_64-macos", "aarch64-windows", "x86_64-windows"]] | .[].tarball' index.json
jq --indent 4 '.master | {
"linux-aarch64": .["aarch64-linux"].shasum,
"linux-x86_64": .["x86_64-linux"].shasum,
"macos-aarch64": .["aarch64-macos"].shasum,
"macos-x86_64": .["x86_64-macos"].shasum,
"windows-aarch64": .["aarch64-windows"].shasum,
"windows-x86_64": .["x86_64-windows"].shasum
}' index.json
- Create a mirror request to bazelbuild to mirror Zig SDK. This is necessary, because nightlies from ziglang.org/download expire in about 3 months. Use output from the previous step to fill the request.
- Edit
VERSION
,HOST_PLATFORM_SHA256
intoolchain/private/zig_sdk.bzl
. Use output from the previous step. - Run all the tests (or push to a branch, so CI can do it for you).
- Test your project with the new SDK. If you work at Uber, test the world with the new SDK.
- Once mirroring is complete, submit the PR to change the version and the hashes in
hermetic_cc_toolchain
. Note the test you have done in the PR. - Proceed with cutting the release below.
bazel run //tools/releaser -- -tag v<version>
Releaser will:
- Create an archive
hermetic_cc_toolchain-v<version>.tar.gz
in the top level of the repository. - Update the version in MODULE.bazel, README.md and examples
- If there is no tag named
v<version>
, commit the change and tag the commit - Suggest a "release boilerplate". Save the output of the command somewhere.
git push upstream v<version>
This assumes that upstream
points to the main repo under github.com/uber. We need to push the tag there because we will create a release out of the main repo.
Before you start, make sure you have forked Bazel Central Registry to your personal Github account and installed Publish to BCR app to the forked repo. This is needed to automatically publish the new release to BCR.
- Open https://github.com/uber/hermetic_cc_toolchain/releases/new
- Select the tag you have just pushed.
- Populate the release title and notes, upload the release archive
hermetic_cc_toolchain-v<version>.tar.gz
that was created in step 2. Note that, especially for major releases, you must explain what the backwards-incompatible changes are. Mark a pre-release version.
After the release is published, a pull request will be created from your BCR fork. If there is any issues in the CI, follow the process of fixing existing release below. If CI finishes successfully, it will be merged by "BCR maintainers".
-
Create a branch out of the newly-created tag to a remote branch from which you can create a pull request:
git checkout -b release-v<version> v<version> git push origin release-v<version>
-
Create a pull request from that branch.
-
If there are issues in CI, follow the process of fixing existing release below.
-
When merging, you must include the merge commit. If you squash or rebase instead, the tag will be pointing to the wrong SHA in the branch (or conversely, the SHA in the branch will be a duplicate commit with the tag). This is too easy to screw up, but possible to do right.
- Create a mirror request to mirror the new release archive to Bazel mirror at https://github.com/bazelbuild/bazel/issues/new/choose.
- After the mirror request has been fulfilled, change the new release: unmark pre-release and mark "set as latest release".
If there are issues in the CI of either BCR or hermetic_cc_toolchain during the release process, you need to fix the issue, possibly open a pull request for the fix and restart the release process. But since you are fixing existing release instead of creating a new one, there are a few changes to the process above:
- because the releaser created a commit on top of local main branch, you need to delete that commit by running
git reset --hard upstream/main
- delete the tag created previously, so the releaser will tag the version on the latest HEAD:
git tag -d v<version>
- upload the release archive
hermetic_cc_toolchain-v<version>.tar.gz
to the existing release instead of creating a new one - manually create a pull request to BCR, because Publish to BCR will not create another one with the new archive.