Skip to content

Commit e67c2f4

Browse files
committed
address second review pass on v2 CI scaffolding
- check-release-mode.sh: split the cleanup checkout so a missing go.work.sum can no longer abort the whole revert and leave modules/*/go.mod dirty (git checkout treats multi-pathspec atomically). - v2-release.yml: validate the version input looks like v2.x before pushing immutable tags; drop a stray whitespace line in the ORDER array. - runbook: point step 4 at check-no-replaces.sh instead of a single-line grep that misses block-form replaces.
1 parent 7670486 commit e67c2f4

3 files changed

Lines changed: 13 additions & 4 deletions

File tree

.github/workflows/v2-release.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,18 @@ jobs:
7474
run: |
7575
set -e
7676
77+
if [[ ! "$VERSION" =~ ^v2\.[0-9] ]]; then
78+
echo "::error::version '$VERSION' must look like v2.<minor>.<patch>[-suffix] (e.g. v2.0.0-beta.1)"
79+
exit 1
80+
fi
81+
7782
# Same order as docs/v2-release-runbook.md.
7883
ORDER=(
7984
modules/core
8085
modules/ssh modules/httphelper modules/dnshelper
8186
modules/docker modules/packer modules/database modules/opa
8287
modules/aws modules/azure modules/gcp modules/k8s modules/helm
8388
modules/terraform modules/terragrunt modules/teststructure
84-
8589
)
8690
8791
for path in "${ORDER[@]}"; do

docs/v2-release-runbook.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ build is validated continuously without committing the pin or needing tags.
4747
3. Set every internal `require` to the exact version being tagged, then DROP all
4848
internal `replace` directives. Do not run `go work sync` against the unpinned
4949
tree.
50-
4. CI guard: `grep -nH '^replace github.com/gruntwork-io/terratest' modules/*/go.mod`
51-
must return zero before tagging.
50+
4. CI guard: run `bash scripts/check-no-replaces.sh`; it must pass before tagging.
51+
It catches both single-line and block-form `replace ( ... )` directives, which
52+
a plain `grep '^replace'` would miss.
5253
5. Move `test/` to its own module here too if not already done, and pin it the
5354
same way (it is test-only, so committed `replace`s are acceptable for it).
5455

scripts/check-release-mode.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ if ! ls modules/*/go.mod >/dev/null 2>&1; then
2222
fi
2323

2424
cleanup() {
25-
git checkout -- modules/ go.work.sum >/dev/null 2>&1 || true
25+
# Revert each path independently. `git checkout -- a b` aborts entirely if any
26+
# pathspec matches no tracked file, so a missing go.work.sum would otherwise
27+
# leave the rewritten modules/*/go.mod files dirty.
28+
git checkout -- modules/ >/dev/null 2>&1 || true
29+
git checkout -- go.work.sum >/dev/null 2>&1 || true
2630
git status --porcelain 2>/dev/null | awk '/^\?\?.*modules\/.*\/go\.sum$/{print $2}' | xargs -r rm -f
2731
[ -n "${TMP:-}" ] && rm -rf "$TMP"
2832
}

0 commit comments

Comments
 (0)