mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-12 23:54:01 +09:00
ci(e2e): skip final cleanup on disposable PR runners (#5260)
## What this PR does Remove the final sandbox teardown from the two PR E2E workflows. The runners are documented as disposable VMs, so destroying their local containers and zpools after testing delays the result without protecting a later run. Cleanup between preparation attempts and the Makefile targets for reused hosts stay unchanged. The job limit stays at 215 minutes. Suite-length budgeting, including nightly and tag runs, remains separate in #5261. This change relies on the existing disposable-runner contract; it does not change runner provisioning. ### Screenshots Not applicable. ### Downstream repositories - [x] No downstream repository is affected by this change - [ ] [cozystack/website](https://github.com/cozystack/website) - follow-up: - [ ] [cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack) - follow-up: - [ ] [cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack) - follow-up: - [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up: - [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up: - [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) - follow-up: - [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) - follow-up: - [ ] [cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server) - follow-up: - [ ] [cozystack/external-apps-example](https://github.com/cozystack/external-apps-example) - follow-up: - [ ] [cozystack/examples](https://github.com/cozystack/examples) - follow-up: - [ ] [cozystack/community](https://github.com/cozystack/community) - follow-up: ### Release note ```release-note NONE ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **CI Workflows** * Removed automatic sandbox and cluster teardown after end-to-end report uploads. * Added checks that cluster cleanup runs before environment preparation is retried. These changes affect automated test workflows and do not alter user-facing product features. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
3 files changed
+31
-37
No files matched your search
@@ -771,21 +771,6 @@ jobs:
|
||||
name: cozyreport
|
||||
path: _out/cozyreport.tgz
|
||||
if-no-files-found: warn
|
||||
# Both halves, and in this order: the compose project owns the nodes and
|
||||
# the zpools outlive it.
|
||||
- name: Tear down sandbox
|
||||
if: always()
|
||||
run: |
|
||||
# Annotated, not fatal: same reasoning as the in-tree lane. The runner
|
||||
# is discarded after the job, so a dirty host has no next tenant, and
|
||||
# failing here would post the required "E2E Tests" status as a failure
|
||||
# indistinguishable from a real one.
|
||||
cleanup_rc=0
|
||||
make -C packages/core/testing SANDBOX_NAME=$SANDBOX_NAME delete-cluster-container || cleanup_rc=$?
|
||||
make -C packages/core/testing SANDBOX_NAME=$SANDBOX_NAME delete || true
|
||||
if [ "$cleanup_rc" -ne 0 ]; then
|
||||
echo "::error title=sandbox teardown::teardown exited $cleanup_rc; the host may hold a stale compose project or zpool"
|
||||
fi
|
||||
|
||||
# Flip the pending "E2E Tests" commit status posted by `resolve` to its
|
||||
# terminal state. Runs on failure too, so a failed publish or e2e turns the
|
||||
|
||||
@@ -1348,28 +1348,6 @@ jobs:
|
||||
Resume from inside: `breakpoint resume`. Otherwise the breakpoint
|
||||
exits 10 minutes after the last SSH session disconnects.
|
||||
|
||||
# ▸ Tear down environment (always runs)
|
||||
#
|
||||
# Both halves, and in this order: the compose project owns the nodes and
|
||||
# the zpools outlive it. A leftover pool makes the next run on a reused
|
||||
# host adopt storage that already carries a dead cluster's volumes.
|
||||
- name: Tear down sandbox
|
||||
if: always()
|
||||
run: |
|
||||
# Loud, but never the job's verdict. A failed teardown means a dirty
|
||||
# host, and this runner is discarded after the job, so there is no next
|
||||
# run to protect -- while failing the job here posts the required
|
||||
# "E2E Tests" status as a failure that no reader can tell apart from a
|
||||
# real one. The annotation is what a reused host (a developer machine)
|
||||
# needs; `delete-cluster-container` returning non-zero is not evidence
|
||||
# about the product.
|
||||
cleanup_rc=0
|
||||
make -C packages/core/testing SANDBOX_NAME=$SANDBOX_NAME delete-cluster-container || cleanup_rc=$?
|
||||
make -C packages/core/testing SANDBOX_NAME=$SANDBOX_NAME delete || true
|
||||
if [ "$cleanup_rc" -ne 0 ]; then
|
||||
echo "::error title=sandbox teardown::teardown exited $cleanup_rc; the host may hold a stale compose project or zpool"
|
||||
fi
|
||||
|
||||
# Report the required "E2E Tests" gate as a commit status rather than relying
|
||||
# on a job named "E2E Tests". A required *job* that is skipped counts
|
||||
# as PASSED by branch protection — desired for docs-only PRs, but the exact
|
||||
|
||||
@@ -966,6 +966,37 @@ STUB
|
||||
}
|
||||
}
|
||||
|
||||
@test "PR E2E jobs clean up between preparation attempts but not after testing" {
|
||||
tmp="$(mktemp -d)"
|
||||
mkdir -p "$tmp/bin"
|
||||
cat >"$tmp/bin/make" <<'STUB'
|
||||
#!/bin/sh
|
||||
printf '%s\n' "$*" >>"$CLEANUP_CALLS"
|
||||
case "$*" in
|
||||
*prepare-env-container*)
|
||||
if [ ! -f "$CLEANUP_ATTEMPT" ]; then
|
||||
touch "$CLEANUP_ATTEMPT"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
STUB
|
||||
chmod +x "$tmp/bin/make"
|
||||
for wf in pull-requests e2e-fork; do
|
||||
workflow="$HACK_DIR/../.github/workflows/$wf.yaml"
|
||||
yq --unwrapScalar '.jobs.e2e.steps[] | select(.name == "Prepare environment") | .run' "$workflow" >"$tmp/prepare.sh"
|
||||
CLEANUP_CALLS="$tmp/$wf.calls" CLEANUP_ATTEMPT="$tmp/$wf.attempt" SANDBOX_NAME=test PATH="$tmp/bin:$PATH" bash -eu "$tmp/prepare.sh"
|
||||
printf '%s\n' 'SANDBOX_NAME=test prepare-env-container' '-C packages/core/testing SANDBOX_NAME=test delete-cluster-container' 'SANDBOX_NAME=test prepare-env-container' >"$tmp/expected"
|
||||
diff "$tmp/expected" "$tmp/$wf.calls"
|
||||
scripts="$(yq --unwrapScalar '.jobs.e2e.steps[] | select(.name != "Prepare environment") | .run // ""' "$workflow")"
|
||||
if printf '%s\n' "$scripts" | grep -Eq 'delete-cluster-container|docker[[:space:]]+(compose.*down|rm)|zpool[[:space:]]+destroy|make.*[[:space:]]delete([[:space:]]|$)'; then
|
||||
echo "FAIL: $wf destroys runner-local state outside preparation"
|
||||
false
|
||||
fi
|
||||
done
|
||||
rm -rf "$tmp"
|
||||
}
|
||||
|
||||
@test "the step that runs this collector has a ceiling of its own everywhere" {
|
||||
# Every bound inside the script protects one read. None of them protects the
|
||||
# STEP: the tarball is written on the collector's last line, the upload is the
|
||||
|
||||
Reference in new issue
Block a user