Help us shape the future of Go! Take the 2026 Go Developer Survey

tagging

command
v0.8.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 12, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package main includes tooling for CI to manage release tags.

About

This script is meant to be run at the end of a release CI workflow to perform the final release tagging after the rest of the release workflow has succeeded, and enables maintainers to use tags to trigger a release multiple times without having to manage or clean up tags.

The specific problem this script was originally created to solve was to allow maintainers to avoid having to delete a tag if for some reason the release CI workflow was broken (e.g. the CI environment had a failure, or an unexpected test failure occurred, an image failed to push, e.t.c.).

Usage

The caller uses the GIT_REF environment variable with a specifically named tag (e.g. "do-release-v0.8.1", optionally "do-release-attempt-1-v0.8.1"):

$ GIT_REF=refs/tags/do-release-v0.8.1 go run internal/ci/release/tagging/main.go

There is a "verify" option which only checks that the provided GIT_REF matches the expected pattern:

$ GIT_REF=refs/tags/do-release-v0.8.1 go run internal/ci/release/tagging/main.go verify
SUCCESS: v0.8.1 is a valid release tag

This is meant to be used at the beginning of a release workflow to fail early before tests, builds, and image pushes run using a bad tag.

Note that the tag should be in one of two formats:

  • do-release-v<MAJOR>.<MINOR>.<PATCH>
  • do-release-attempt-<ATTEMPT>-v<MAJOR>.<MINOR>.<PATCH>

The "attempt-" option is just for convenience so a new release can be triggered without deleting the previous tag (this script will delete all the trigger tags automatically as part of its cleanup upon success).

Another option is "retag":

$ GIT_REF=refs/tags/do-release-v0.8.1 go run internal/ci/release/tagging/main.go retag
SUCCESS: pushed tag v0.8.1 to remote

This performs all the checks of verify above but also parses the semver version information from the provided GIT_REF to produce a tag. In the above example for instance this script will tag HEAD as `v0.8.1` and push that to the remote.

Lastly the option "cleanup" can be provided, this will build a list of any remaining trigger tags and delete them.

See Also:

  • RELEASE.md
  • .github/workflows/release-testing.yaml
  • .github/workflow/release.yaml

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL