Skip to content

Commit 85e29f6

Browse files
committed
v2: add release runbook, drop inert import-rewrite script
Document the coordinated tag-cut procedure, including the gotchas this work surfaced: pinning sibling requires only at the tag cut (go.work does not shadow unpublished versions), transitive replaces during the tidy pass, and the modules/<name>/v2/<version> tag format. Remove the now-inert codemod script and repoint the SIV gate's hint.
1 parent 211ed30 commit 85e29f6

3 files changed

Lines changed: 76 additions & 88 deletions

File tree

docs/v2-release-runbook.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
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.

scripts/check-siv-placement.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ for dir in modules/*/; do
3232
done
3333

3434
if [ "$fail" -ne 0 ]; then
35-
echo "::error::Run scripts/v2-import-rewrite.sh to auto-fix."
35+
echo "::error::Move the /v2 SIV to the module root in the import path."
3636
exit 1
3737
fi
3838

scripts/v2-import-rewrite.sh

Lines changed: 0 additions & 87 deletions
This file was deleted.

0 commit comments

Comments
 (0)