Add E2E runner workspace cleanup#208
Merged
Merged
Conversation
bcho
approved these changes
Jun 25, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a dedicated “runner-local” cleanup path to prevent the self-hosted E2E GitHub Actions runner from accumulating stale temporary artifacts under /tmp and exhausting disk space, complementing the existing Azure resource cleanup.
Changes:
- Added
hack/e2e/lib/runner.shwithcleanup_runner_workspaceto remove stale/tmp/aks-flex-node-e2e*directories and optionally clean system caches. - Extended
hack/e2e/run.shwith arunner-cleanupcommand that runs independently of Azure prereqs/config. - Updated
.github/workflows/e2e-tests.ymlto always run the runner cleanup step at the end of the job.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| hack/e2e/run.sh | Adds a runner-cleanup command and dispatch path to invoke runner-local cleanup helpers. |
| hack/e2e/lib/runner.sh | Introduces runner workspace cleanup logic (tmp dirs, Go cache, optional system cache/journal trimming). |
| .github/workflows/e2e-tests.yml | Ensures runner cleanup runs in an always() final step after Azure cleanup. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+34
to
+48
| local removed=0 | ||
| local dir | ||
| while IFS= read -r dir; do | ||
| [[ -n "${dir}" && -d "${dir}" ]] || continue | ||
| log_info "Removing ${dir}" | ||
| if [[ "${can_sudo}" == "1" ]]; then | ||
| sudo rm -rf -- "${dir}" || { log_warn "Failed to remove ${dir}"; continue; } | ||
| else | ||
| rm -rf -- "${dir}" || { log_warn "Failed to remove ${dir}"; continue; } | ||
| fi | ||
| removed=$((removed + 1)) | ||
| done < <(find /tmp -maxdepth 1 -type d \( \ | ||
| -name 'aks-flex-node-e2e' -o \ | ||
| -name 'aks-flex-node-e2e-*' \ | ||
| \) 2>/dev/null || true) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add automatic local workspace cleanup for the self-hosted E2E GitHub Actions runner.
Changes
hack/e2e/lib/runner.shwith runner-local disk cleanup helpers.runner-cleanupcommand tohack/e2e/run.sh../hack/e2e/run.sh runner-cleanupas a finalalways()workflow step after Azure resource cleanup.skip_cleanup, which only controls Azure resource cleanup.E2E_SKIP_RUNNER_CLEANUP=1as a separate opt-out for preserving local runner artifacts.Why
The self-hosted E2E runner accumulated stale
/tmp/aks-flex-node-e2e-*directories across runs, eventually filling the runner OS disk and blocking E2E jobs. Azure resource cleanup did not clean these local runner artifacts.