|
| 1 | +# Terratest v2 Release Runbook |
| 2 | + |
| 3 | +How to cut a coordinated release of the v2 submodules. Read this before tagging. |
| 4 | + |
| 5 | +## Layout |
| 6 | + |
| 7 | +v2 is split into per-domain modules under `modules/<name>/`, each declaring |
| 8 | +`module github.com/gruntwork-io/terratest/modules/<name>/v2`. Local development |
| 9 | +uses the root `go.work`, which resolves every submodule to its local tree, so the |
| 10 | +submodule `go.mod` files do not need internal `require` lines or `replace` |
| 11 | +directives during normal development. |
| 12 | + |
| 13 | +## Why pinning is a release-time step (do not commit it early) |
| 14 | + |
| 15 | +The submodules' `go.mod` files are deliberately left without cross-module |
| 16 | +`require` lines on `main`. Pinning a sibling `require` to the to-be-published |
| 17 | +version (e.g. `core/v2 v2.0.0-beta.1`) BREAKS the workspace build until that tag |
| 18 | +actually exists: `go.work` does not shadow an unpublished required version, so |
| 19 | +`go build` and `go work sync` try to fetch the missing revision and fail. The pin |
| 20 | +must therefore happen on a short-lived release-prep branch, immediately before the |
| 21 | +tags are pushed, never on the modularization PR. |
| 22 | + |
| 23 | +CI validates the release-mode build continuously without committing the pin: the |
| 24 | +`GOWORK=off` check generates the pinned state with throwaway `replace` directives, |
| 25 | +builds a consumer, and discards it (see `scripts/`). |
| 26 | + |
| 27 | +## Pre-flight (on a release-prep branch) |
| 28 | + |
| 29 | +1. Choose the version, e.g. `v2.0.0-beta.1`. |
| 30 | +2. Pin each module, in dependency order (core first, then helpers, tooling, |
| 31 | + platforms, k8s/helm, IaC). For each module: |
| 32 | + - Add a temporary `replace` for EVERY sibling it transitively needs, not just |
| 33 | + its direct imports. Tidy follows transitive edges, so a partial replace set |
| 34 | + fails with `unknown revision` on a deeper sibling. |
| 35 | + - `GOWORK=off go mod tidy` to populate external `require`s and `go.sum`. |
| 36 | +3. Set every internal `require` to the exact version being tagged, then DROP all |
| 37 | + internal `replace` directives. Do not run `go work sync` against the unpinned |
| 38 | + tree. |
| 39 | +4. CI guard: `grep -nH '^replace github.com/gruntwork-io/terratest' modules/*/go.mod` |
| 40 | + must return zero before tagging. |
| 41 | +5. Move `test/` to its own module here too if not already done, and pin it the |
| 42 | + same way (it is test-only, so committed `replace`s are acceptable for it). |
| 43 | + |
| 44 | +## Tag push order |
| 45 | + |
| 46 | +All tags point at the same release commit. Each tag name puts the `/v2` SIV in the |
| 47 | +tag itself: `modules/<name>/v2/<version>` (NOT `modules/<name>/<version>`, which |
| 48 | +the proxy cannot associate with the `/v2` module path). Push in dependency order: |
| 49 | + |
| 50 | +1. `modules/core/v2/v2.0.0-beta.1` |
| 51 | +2. helpers: `ssh`, `httphelper`, `dnshelper` |
| 52 | +3. tooling: `docker`, `packer`, `database`, `opa` |
| 53 | +4. platforms: `aws`, `azure`, `gcp`, then `k8s`, `helm` |
| 54 | +5. IaC: `terraform`, `terragrunt`, `teststructure` |
| 55 | + |
| 56 | +After each tier, probe the proxy before continuing: |
| 57 | +`curl -o /dev/null -w '%{http_code}' https://proxy.golang.org/github.com/gruntwork-io/terratest/modules/<name>/v2/@v/<version>.info` |
| 58 | +should return 200. |
| 59 | + |
| 60 | +## Verify |
| 61 | + |
| 62 | +Run the `test-external/` consumer against the published tags with `GOWORK=off`. A |
| 63 | +clean external consumer should resolve, build, and test green with zero local |
| 64 | +references. |
| 65 | + |
| 66 | +## If a tag is wrong |
| 67 | + |
| 68 | +Proxy tags are immutable. Recover by cutting the next patch (`v2.0.0-beta.2`), |
| 69 | +never by editing in place. The pre-flight checks exist to keep this rare. |
| 70 | + |
| 71 | +## Beta to GA |
| 72 | + |
| 73 | +After the beta soaks (suggested two weeks minimum), repeat the same procedure at |
| 74 | +`v2.0.0` with no suffix: same release commit shape, same tag sequence, same proxy |
| 75 | +verification, then announce. |
0 commit comments