Skip to content

Commit d518627

Browse files
pennypacker-hejoecorall
authored andcommitted
[minor] Add compiled GCP smoke cleanup runner
1 parent 1716a39 commit d518627

22 files changed

Lines changed: 3115 additions & 992 deletions

.github/workflows/cloud-smoke-cleanup.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,15 @@ jobs:
9494
test -n "$GSA" || { echo "GSA environment variable or secret is required for GCP cleanup"; exit 1; }
9595
test -n "$GCLOUD_PROJECT" || { echo "GCLOUD_PROJECT environment variable or secret is required for GCP cleanup"; exit 1; }
9696
97+
- name: Install Go
98+
uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6
99+
with:
100+
go-version: "1.26.x"
101+
cache: false
102+
103+
- name: Build trusted cloud CI runner
104+
run: make cloud-compose-ci
105+
97106
- name: Authenticate to Google Cloud
98107
uses: google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093 # v3
99108
with:

.github/workflows/cloud-smoke.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,8 @@ jobs:
4343
- name: Run repository lint
4444
run: make lint-check
4545

46-
- name: Validate fallback cleanup behavior
47-
run: |
48-
bash ci/cloud-smoke-cleanup-contract.sh
49-
make hosted-cleanup-retry-contract
46+
- name: Validate hosted cleanup retry behavior
47+
run: make hosted-cleanup-retry-contract
5048

5149
config-management-lint:
5250
name: Ansible and Salt lint
@@ -195,6 +193,15 @@ jobs:
195193
terraform_version: 1.14.6
196194
terraform_wrapper: false
197195

196+
- name: Install Go for cloud CI runner
197+
uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6
198+
with:
199+
go-version: "1.26.x"
200+
cache: false
201+
202+
- name: Build cloud CI runner
203+
run: make cloud-compose-ci
204+
198205
- name: Check GCP smoke configuration
199206
run: |
200207
test -n "$GCLOUD_OIDC_POOL" || { echo "GCLOUD_OIDC_POOL environment variable or secret is required for GCP smoke tests"; exit 1; }

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ site/
1212
docs/site/
1313
docs/.cache/
1414
.cloud-compose-smoke/
15+
.bin/

Makefile

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: lint lint-check actionlint shell-lint runtime-config-contract application-env-contract compose-runtime-contract backup-contract overlay-contract filesystem-prep-contract key-rotation-contract vault-runtime-contract managed-artifact-contract config-management-input-contract systemd-contract sitectl-version-contract template-version-contract rollout-parity-contract rootfs-package-contract host-runtime-security cos-jq-portability-contract source-trust-contract cloud-smoke-cleanup-contract hosted-cleanup-retry-contract gcp-upgrade-smoke-contract artifact-install-contract config-management-smoke
1+
.PHONY: lint lint-check actionlint shell-lint runtime-config-contract application-env-contract compose-runtime-contract backup-contract overlay-contract filesystem-prep-contract key-rotation-contract vault-runtime-contract managed-artifact-contract config-management-input-contract systemd-contract sitectl-version-contract go-fmt-check go-vet go-contracts template-version-contract rollout-parity-contract rootfs-package-contract host-runtime-security cos-jq-portability-contract source-trust-contract cloud-smoke-cleanup-contract hosted-cleanup-retry-contract gcp-upgrade-smoke-contract artifact-install-contract config-management-smoke cloud-compose-ci
22
.PHONY: terraform-fmt terraform-fmt-check terraform-validate terraform-validate-contract terraform-lint-check terraform-docs terraform-docs-check
33
.PHONY: config-management-cloud-smoke config-management-cloud-smoke-ansible-drupal config-management-cloud-smoke-salt-drupal
44
.PHONY: destroy-config-management-cloud-smoke destroy-config-management-cloud-smoke-ansible-drupal destroy-config-management-cloud-smoke-salt-drupal
@@ -11,6 +11,10 @@ DOCS_PORT ?= 8888
1111
DOCS_DOCKER_USER ?= $(shell id -u):$(shell id -g)
1212
ACTIONLINT_VERSION ?= v1.7.12
1313
TERRAFORM_DOCS_VERSION ?= v0.21.0
14+
CLOUD_COMPOSE_CI_BIN ?= $(CURDIR)/.bin/cloud-compose-ci
15+
export CLOUD_COMPOSE_CI_BIN
16+
GO_MODULE_FILES := $(wildcard go.mod go.sum)
17+
GO_SOURCES := $(shell find cmd internal -type f -name '*.go')
1418

1519
lint: terraform-fmt actionlint shell-lint host-runtime-security cos-jq-portability-contract application-env-contract compose-runtime-contract backup-contract overlay-contract filesystem-prep-contract key-rotation-contract vault-runtime-contract managed-artifact-contract config-management-input-contract systemd-contract source-trust-contract cloud-smoke-cleanup-contract hosted-cleanup-retry-contract gcp-upgrade-smoke-contract sitectl-version-contract template-version-contract rollout-parity-contract rootfs-package-contract artifact-install-contract terraform-validate terraform-docs-check
1620

@@ -75,11 +79,16 @@ systemd-contract:
7579
sitectl-version-contract:
7680
bash ci/sitectl-version-contract.sh
7781

78-
template-version-contract:
79-
bash ci/template-version-contract.sh
82+
go-fmt-check:
83+
@files="$$(gofmt -l .)"; test -z "$$files" || { echo "Go files require formatting:"; printf '%s\n' "$$files"; exit 1; }
8084

81-
rollout-parity-contract:
82-
bash ci/rollout-parity-contract.sh
85+
go-vet:
86+
go vet ./...
87+
88+
go-contracts: go-fmt-check go-vet
89+
go test -count=1 ./...
90+
91+
template-version-contract rollout-parity-contract: go-contracts
8392

8493
rootfs-package-contract:
8594
bash ci/rootfs-package-contract.sh
@@ -93,8 +102,13 @@ cos-jq-portability-contract:
93102
source-trust-contract:
94103
bash ci/source-trust-contract.sh
95104

96-
cloud-smoke-cleanup-contract:
97-
bash ci/cloud-smoke-cleanup-contract.sh
105+
cloud-smoke-cleanup-contract: go-contracts
106+
107+
cloud-compose-ci: $(CLOUD_COMPOSE_CI_BIN)
108+
109+
$(CLOUD_COMPOSE_CI_BIN): $(GO_MODULE_FILES) $(GO_SOURCES)
110+
@mkdir -p "$(dir $(CLOUD_COMPOSE_CI_BIN))"
111+
go build -trimpath -o "$(CLOUD_COMPOSE_CI_BIN)" ./cmd/cloud-compose-ci
98112

99113
gcp-upgrade-smoke-contract:
100114
bash ci/gcp-upgrade-smoke-contract.sh
@@ -135,12 +149,13 @@ terraform-docs:
135149
terraform-docs-check:
136150
go run github.com/terraform-docs/terraform-docs@$(TERRAFORM_DOCS_VERSION) markdown table --sort-by required --output-file README.md --output-check .
137151

138-
smoke-test-clouds:
152+
smoke-test-clouds: cloud-compose-ci
139153
ci/cloud-smoke.sh all
140154

141155
smoke-test:
142156
@test -n "$(PROVIDER)" || { echo "PROVIDER is required"; exit 2; }
143157
@test -n "$(TEMPLATE)" || { echo "TEMPLATE is required"; exit 2; }
158+
@if [ "$(PROVIDER)" = "gcp" ]; then $(MAKE) --no-print-directory cloud-compose-ci; fi
144159
ci/cloud-smoke.sh $(PROVIDER)-$(TEMPLATE)
145160

146161
smoke-test-digitalocean-isle:
@@ -155,6 +170,7 @@ smoke-test-gcp-wp:
155170
destroy-smoke:
156171
@test -n "$(PROVIDER)" || { echo "PROVIDER is required"; exit 2; }
157172
@test -n "$(TEMPLATE)" || { echo "TEMPLATE is required"; exit 2; }
173+
@if [ "$(PROVIDER)" = "gcp" ]; then $(MAKE) --no-print-directory cloud-compose-ci; fi
158174
ci/cloud-smoke.sh destroy-$(PROVIDER)-$(TEMPLATE)
159175

160176
destroy-smoke-digitalocean-isle:

0 commit comments

Comments
 (0)