Skip to content

Commit 458700c

Browse files
jpayne3506Copilot
andauthored
ci: clean up agent disk space before binary build (release/v1.7) (#4433)
* ci: clean up agent disk space before binary build Adds a reusable steps template that frees disk space on the build agent (removing hostedtoolcache, dotnet, android, chromium, etc.) before the binary build runs. The binary build has been hitting disk-pressure failures on the default build pool. The cleanup script mirrors the one introduced for container builds in #4109 and is now factored into a shared template (.pipelines/templates/disk-cleanup.steps.yaml) for reuse. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * ci: use shared disk-cleanup template in container build Replace the inline disk-cleanup script in .pipelines/containers/container-template.yaml with a reference to the shared template at .pipelines/templates/disk-cleanup.steps.yaml (introduced in this PR). Behavior is unchanged. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * ci: preserve /opt/hostedtoolcache during disk cleanup Keep the hosted toolcache (which contains Go) so subsequent steps can use the agent's pre-installed Go toolchain. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 7478ace commit 458700c

3 files changed

Lines changed: 30 additions & 22 deletions

File tree

.pipelines/containers/container-template.yaml

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,7 @@ steps:
1313
inlineScript: |
1414
az acr login -n $(ACR)
1515
16-
- script: |
17-
set -e
18-
echo "Disk space before cleanup..."
19-
df -h /
20-
echo "Removing unnecessary files to free up disk space..."
21-
sudo rm -rf \
22-
/opt/hostedtoolcache \
23-
/opt/google/chrome \
24-
/opt/microsoft/msedge \
25-
/opt/microsoft/powershell \
26-
/opt/pipx \
27-
/usr/lib/mono \
28-
/usr/local/julia* \
29-
/usr/local/lib/android \
30-
/usr/local/lib/node_modules \
31-
/usr/local/share/chromium \
32-
/usr/local/share/powershell \
33-
/usr/share/dotnet \
34-
/usr/share/swift
35-
echo "Disk space after cleanup..."
36-
df -h /
37-
displayName: "Clean up disk space"
16+
- template: ../templates/disk-cleanup.steps.yaml
3817

3918
- script: |
4019
set -e

.pipelines/pipeline.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ stages:
7575
pool:
7676
name: "$(BUILD_POOL_NAME_DEFAULT)"
7777
steps:
78+
- template: templates/disk-cleanup.steps.yaml
7879
- script: |
7980
make bpf-lib
8081
make all-binaries-platforms
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
steps:
2+
- script: |
3+
set -e
4+
echo "=== Tool locations BEFORE cleanup ==="
5+
which go || true
6+
go version || true
7+
echo "=== Disk space BEFORE cleanup ==="
8+
df -h /
9+
echo "Removing unnecessary files to free up disk space..."
10+
sudo rm -rf \
11+
/opt/google/chrome \
12+
/opt/microsoft/msedge \
13+
/opt/microsoft/powershell \
14+
/opt/pipx \
15+
/usr/lib/mono \
16+
/usr/local/julia* \
17+
/usr/local/lib/android \
18+
/usr/local/lib/node_modules \
19+
/usr/local/share/chromium \
20+
/usr/local/share/powershell \
21+
/usr/share/dotnet \
22+
/usr/share/swift
23+
echo "=== Tool locations AFTER cleanup ==="
24+
which go || true
25+
go version || true
26+
echo "=== Disk space AFTER cleanup ==="
27+
df -h /
28+
displayName: "Clean up disk space"

0 commit comments

Comments
 (0)