Skip to content

Add E2E runner workspace cleanup#208

Merged
bcho merged 1 commit into
mainfrom
wenx/disk-clean
Jun 25, 2026
Merged

Add E2E runner workspace cleanup#208
bcho merged 1 commit into
mainfrom
wenx/disk-clean

Conversation

@wenxuan0923

Copy link
Copy Markdown
Collaborator

Add automatic local workspace cleanup for the self-hosted E2E GitHub Actions runner.

Changes

  • Add hack/e2e/lib/runner.sh with runner-local disk cleanup helpers.
  • Add runner-cleanup command to hack/e2e/run.sh.
  • Run ./hack/e2e/run.sh runner-cleanup as a final always() workflow step after Azure resource cleanup.
  • Keep runner cleanup independent from skip_cleanup, which only controls Azure resource cleanup.
  • Add E2E_SKIP_RUNNER_CLEANUP=1 as 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.

Copilot AI review requested due to automatic review settings June 25, 2026 16:57
@bcho bcho merged commit 6972fe3 into main Jun 25, 2026
8 of 9 checks passed
@bcho bcho deleted the wenx/disk-clean branch June 25, 2026 16:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.sh with cleanup_runner_workspace to remove stale /tmp/aks-flex-node-e2e* directories and optionally clean system caches.
  • Extended hack/e2e/run.sh with a runner-cleanup command that runs independently of Azure prereqs/config.
  • Updated .github/workflows/e2e-tests.yml to 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 thread hack/e2e/lib/runner.sh
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants