Skip to content

Commit c7b5cf2

Browse files
committed
release-mode gate: derive module list from disk to support a partial split
Replaces the hardcoded 16-module ORDER with one derived from which modules have a go.mod, so the gate validates a single-tier split (e.g. core only) as well as the full split. Also exercises all core leaf packages in the consumer and drops the hardcoded '16 modules' wording. Inert until the first submodule lands (the pre-split guard still skips).
1 parent b53f2ea commit c7b5cf2

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

.github/workflows/v2-checks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,5 @@ jobs:
5454
env:
5555
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5656

57-
- name: Release-mode build (all 16 modules pin + external consumer, GOWORK=off)
57+
- name: Release-mode build (each module pins at root versions + external consumer, GOWORK=off)
5858
run: bash scripts/check-release-mode.sh

scripts/check-release-mode.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111
set -uo pipefail
1212

1313
MODULE_BASE="github.com/gruntwork-io/terratest/modules"
14-
ORDER="core ssh httphelper dnshelper docker packer database opa aws azure gcp k8s helm terraform terragrunt teststructure"
14+
# Every submodule that currently has its own go.mod. Derived from disk so the
15+
# gate works during an incremental split (core only) and after the full split.
16+
ORDER=$(for d in modules/*/; do [ -f "${d}go.mod" ] && basename "$d"; done | tr '\n' ' ')
1517

1618
# Scratch directory (a fresh `mktemp -d`) holding per-module tidy stderr and the
1719
# throwaway consumer module. Set by main(); removed wholesale by cleanup().
@@ -34,7 +36,7 @@ consumer_imports() {
3436
for s in $ORDER; do
3537
if [ "$s" = core ]; then
3638
# Keep in sync with core/v2's public leaf packages.
37-
for pkg in random files collections formatting; do
39+
for pkg in random files collections formatting logger shell retry testing; do
3840
echo " _ \"$MODULE_BASE/core/v2/$pkg\""
3941
done
4042
else
@@ -97,7 +99,7 @@ main() {
9799
( cd "$WORKDIR" && GOWORK=off go mod tidy && GOWORK=off go build ./... ) 2>"$WORKDIR/consumer.err" \
98100
|| { echo "::error::external consumer failed to build in release mode"; tail -10 "$WORKDIR/consumer.err"; echo "release-mode check: FAILED (consumer)"; return 1; }
99101

100-
echo "release-mode check: OK (all 16 modules pin at root versions + external consumer builds with GOWORK=off)"
102+
echo "release-mode check: OK ($(echo "$ORDER" | wc -w | tr -d ' ') module(s) pin at root versions + external consumer builds with GOWORK=off)"
101103
}
102104

103105
main "$@"

0 commit comments

Comments
 (0)