[PR #2881] [MERGED] cmd/hi: improve test cleanup to reduce CI disk usage #2915

Closed
opened 2025-12-29 04:19:39 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/juanfont/headscale/pull/2881
Author: @kradalby
Created: 11/12/2025
Status: Merged
Merged: 11/28/2025
Merged by: @kradalby

Base: mainHead: kradalby/serial-integration-test


📝 Commits (4)

  • a805053 cmd/hi: improve test cleanup to reduce CI disk usage
  • d985723 integration: improve Docker build error diagnostics
  • 47c7b0a integration: always show diagnostic build output on failure
  • da21e4d cmd/hi: add README

📊 Changes

7 files changed (+228 additions, -15 deletions)

View changed files

cmd/hi/README.md (+6 -0)
📝 cmd/hi/cleanup.go (+110 -0)
📝 cmd/hi/docker.go (+13 -0)
📝 integration/dockertestutil/build.go (+14 -6)
📝 integration/dockertestutil/network.go (+21 -2)
📝 integration/hsic/hsic.go (+25 -3)
📝 integration/tsic/tsic.go (+39 -4)

📄 Description

Optimize integration test cleanup to address disk space issues in CI
environments by implementing smarter artifact and image management.

Changes:

  1. Add cleanupSuccessfulTestArtifacts function that removes large
    debugging artifacts after successful test runs:

    • Database dumps (.db files)
    • Profile data (pprof/ directories)
    • MapResponse data (mapresponses/ directories)
    • Prometheus metrics files (_metrics.txt)
    • Tailscale status files (_status.json)

    Preserves log files (.log) which are small and useful for verification.
    Reports freed disk space (e.g., "freed ~5.5 MB").

  2. Modify CleanImagesInCI to only remove dangling (untagged) images
    instead of all images. This prevents unnecessary rebuilds of base
    images (golang:, tailscale/tailscale:), making consecutive test
    runs significantly faster.

The cleanup runs automatically after successful tests and only removes
artifacts that are primarily useful for debugging failures. Failed test
artifacts are preserved for investigation.

Fixes disk space exhaustion issues in GitHub Actions CI where tests
would fail with "The command returned a non-zero code: 1" due to
insufficient storage during Docker builds.<!--
Headscale is "Open Source, acknowledged contribution", this means that any
contribution will have to be discussed with the Maintainers before being submitted.

This model has been chosen to reduce the risk of burnout by limiting the
maintenance overhead of reviewing and validating third-party code.

Headscale is open to code contributions for bug fixes without discussion.

If you find mistakes in the documentation, please submit a fix to the documentation.

claude fixes and does all changes to cmd/hi


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/juanfont/headscale/pull/2881 **Author:** [@kradalby](https://github.com/kradalby) **Created:** 11/12/2025 **Status:** ✅ Merged **Merged:** 11/28/2025 **Merged by:** [@kradalby](https://github.com/kradalby) **Base:** `main` ← **Head:** `kradalby/serial-integration-test` --- ### 📝 Commits (4) - [`a805053`](https://github.com/juanfont/headscale/commit/a80505392158d8db6cf56ed4ff91f75a62169446) cmd/hi: improve test cleanup to reduce CI disk usage - [`d985723`](https://github.com/juanfont/headscale/commit/d9857236bbbd5d097ab299e2dce120e571639e8a) integration: improve Docker build error diagnostics - [`47c7b0a`](https://github.com/juanfont/headscale/commit/47c7b0ace7b4cdb0bb2b5a42f95400d7db185d69) integration: always show diagnostic build output on failure - [`da21e4d`](https://github.com/juanfont/headscale/commit/da21e4dd1c4d025df965212de106abf0e36155f2) cmd/hi: add README ### 📊 Changes **7 files changed** (+228 additions, -15 deletions) <details> <summary>View changed files</summary> ➕ `cmd/hi/README.md` (+6 -0) 📝 `cmd/hi/cleanup.go` (+110 -0) 📝 `cmd/hi/docker.go` (+13 -0) 📝 `integration/dockertestutil/build.go` (+14 -6) 📝 `integration/dockertestutil/network.go` (+21 -2) 📝 `integration/hsic/hsic.go` (+25 -3) 📝 `integration/tsic/tsic.go` (+39 -4) </details> ### 📄 Description Optimize integration test cleanup to address disk space issues in CI environments by implementing smarter artifact and image management. Changes: 1. Add cleanupSuccessfulTestArtifacts function that removes large debugging artifacts after successful test runs: - Database dumps (.db files) - Profile data (pprof/ directories) - MapResponse data (mapresponses/ directories) - Prometheus metrics files (_metrics.txt) - Tailscale status files (_status.json) Preserves log files (.log) which are small and useful for verification. Reports freed disk space (e.g., "freed ~5.5 MB"). 2. Modify CleanImagesInCI to only remove dangling (untagged) images instead of all images. This prevents unnecessary rebuilds of base images (golang:*, tailscale/tailscale:*), making consecutive test runs significantly faster. The cleanup runs automatically after successful tests and only removes artifacts that are primarily useful for debugging failures. Failed test artifacts are preserved for investigation. Fixes disk space exhaustion issues in GitHub Actions CI where tests would fail with "The command returned a non-zero code: 1" due to insufficient storage during Docker builds.<!-- Headscale is "Open Source, acknowledged contribution", this means that any contribution will have to be discussed with the Maintainers before being submitted. This model has been chosen to reduce the risk of burnout by limiting the maintenance overhead of reviewing and validating third-party code. Headscale is open to code contributions for bug fixes without discussion. If you find mistakes in the documentation, please submit a fix to the documentation. claude fixes and does all changes to `cmd/hi` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-29 04:19:39 +01:00
adam closed this issue 2025-12-29 04:19:39 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/headscale#2915