Skip to content

chore: add disk space cleanup steps to CI pipeline (Phase 3)#8279

Open
vhvb1989 wants to merge 3 commits into
mainfrom
ci-warnings-reduction
Open

chore: add disk space cleanup steps to CI pipeline (Phase 3)#8279
vhvb1989 wants to merge 3 commits into
mainfrom
ci-warnings-reduction

Conversation

@vhvb1989
Copy link
Copy Markdown
Member

@vhvb1989 vhvb1989 commented May 20, 2026

Summary

Add disk space cleanup steps to the CI pipeline to eliminate 71 "Free disk space on / is lower than 5%" warnings on Linux agents (~62% of all pipeline warnings).

Changes

New file

  • eng/pipelines/templates/steps/cleanup-disk-space.yml — Reusable cleanup step template with parameterized targets (Docker, Go cache, NuGet, .NET temp). All steps are Linux-only, use continueOnError: true, and log df -h / before/after for observability.

Modified files

  • eng/pipelines/templates/jobs/build-cli.yml — 3 cleanup insertions:
    • After test run → clean NuGet cache and .NET temp artifacts (Go cache preserved for release build)
    • After release build → clean Go build cache
    • After Linux package build → clean Docker images/containers (conditioned on BuildLinuxPackages)
  • eng/pipelines/templates/jobs/cross-build-cli.yml — 1 cleanup insertion:
    • After Linux ARM64 package build → clean Docker images + Go cache (conditioned on BuildLinuxPackages)

Design Decisions

  • Zero risk: All cleanup steps use continueOnError: true — cleanup failures never break the build
  • Linux-only: Conditioned on eq(variables['Agent.OS'], 'Linux') since warnings only affect Linux agents
  • Compile-time conditional: ${{ if }} blocks ensure only requested cleanup operations are emitted in each invocation
  • Minimal overhead: Each cleanup step completes in seconds
  • Preserved Go cache for release build: Post-test cleanup intentionally skips Go cache to avoid rebuilding from scratch for the release binary

Related Issues

Closes #7783
Parent: #4668
Full analysis: Azure/azure-dev-pr#1780

Add a reusable cleanup-disk-space.yml step template and insert it at
strategic points in the Linux CI jobs to address 71 'Free disk space
on / is lower than 5%' warnings.

Cleanup points in build-cli.yml:
- After test run: clean Go cache, NuGet, and .NET temp artifacts
- After release build: clean Go build cache
- After Linux package build: clean Docker images/containers

Cleanup points in cross-build-cli.yml:
- After Linux ARM64 package build: clean Docker and Go cache

All cleanup steps are Linux-only, use continueOnError to avoid breaking
builds, and log disk usage before/after for observability.

Resolves #7783

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 reusable Azure Pipelines step template to reclaim disk space on Linux build agents and wires it into the CLI build job templates to reduce “Free disk space on / is lower than 5%” warnings.

Changes:

  • Added a reusable cleanup-disk-space.yml step template with parameterized cleanup targets (Docker, Go cache, NuGet, .NET temp) and before/after disk usage logging.
  • Inserted cleanup steps into build-cli.yml at multiple points in the job to reduce transient disk pressure.
  • Inserted cleanup steps into cross-build-cli.yml after Linux ARM64 package build.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
eng/pipelines/templates/steps/cleanup-disk-space.yml New reusable cleanup template (Linux-only) for reclaiming disk space via targeted cache/prune steps.
eng/pipelines/templates/jobs/build-cli.yml Adds multiple invocations of the cleanup template during the BuildCLI job.
eng/pipelines/templates/jobs/cross-build-cli.yml Adds a cleanup invocation after the Linux ARM64 package build.

Comment thread eng/pipelines/templates/jobs/build-cli.yml Outdated
Comment thread eng/pipelines/templates/jobs/build-cli.yml
Comment thread eng/pipelines/templates/jobs/cross-build-cli.yml
- Remove CleanGoCache from post-test cleanup to preserve cache for release build
- Add BuildLinuxPackages condition to Docker cleanup in build-cli.yml
- Add BuildLinuxPackages condition to Docker+Go cleanup in cross-build-cli.yml

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

Comment thread eng/pipelines/templates/steps/cleanup-disk-space.yml Outdated
Comment thread eng/pipelines/templates/jobs/build-cli.yml
- Remove redundant 2>/dev/null || true from cleanup commands; rely on continueOnError
- Update PR description to reflect post-test cleanup no longer includes Go cache

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.

@vhvb1989 vhvb1989 marked this pull request as ready for review May 21, 2026 03:09
@vhvb1989
Copy link
Copy Markdown
Member Author

/azp run azure-dev - cli

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines could not run because the pipeline triggers exclude this branch/path.

@github-actions
Copy link
Copy Markdown

📋 Prioritization Note

Thanks for the contribution! The linked issue isn't in the current milestone yet.
Review may take a bit longer — reach out to @rajeshkamal5050 or @kristenwomack if you'd like to discuss prioritization.

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.

chore: add disk space cleanup steps to CI pipeline (Phase 3)

2 participants