Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions build/ci/.azure-devops-stages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ stages:
README/**
build/**

- template: templates/host-cleanup-linux.yml
- template: templates/gitversion-run.yml
- template: setup/.azure-devops-setup-commitsar.yml
- template: setup/.azure-devops-setup-doc-validations.yml
Expand All @@ -35,6 +36,7 @@ stages:
clean: false
fetchDepth: 0

- template: templates/host-cleanup-linux.yml
- task: PowerShell@2
name: SetScope
displayName: Evaluate native-impacting changes
Expand Down
63 changes: 40 additions & 23 deletions build/ci/templates/host-cleanup-linux.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,40 @@
steps:
- bash: |
# This list is based on what the base image contains and
# may need to be adjusted as new software gets installed.
# Use the `du` command below to determine what can be
# uninstalled.

rm -fR ~/.cargo
rm -fR ~/.rustup
rm -fR ~/.dotnet
sudo rm -fR /usr/share/swift
sudo rm -fR /opt/microsoft/msedge
sudo rm -fR /usr/local/.ghcup
sudo rm -fR /usr/lib/mono
sudo snap remove lxd
sudo snap remove core20
sudo apt remove snapd

df -h
# du -h -d 3 /

displayName: 'Cleanup unused image dependencies (Linux)'
condition: eq(variables['Agent.OS'], 'Linux')
# Reusable AzDO template: Cleanup unused dependencies on Linux CI agents.
#
# This list is based on what the base image contains and
# may need to be adjusted as new software gets installed.
# Use the `du` command to determine what can be uninstalled.
steps:
- bash: |
# Use sudo only when available and non-interactive (no password prompt)
if command -v sudo >/dev/null 2>&1 && sudo -n true >/dev/null 2>&1; then
SUDO="sudo -n"
else
SUDO=""
fi

echo "Disk space before cleanup:"
df -h /

rm -rf ~/.cargo ~/.rustup ~/.dotnet || true

$SUDO rm -rf /usr/share/swift || true
$SUDO rm -rf /opt/microsoft/msedge || true
$SUDO rm -rf /usr/local/.ghcup || true
$SUDO rm -rf /usr/lib/mono || true
$SUDO rm -rf /usr/local/lib/android || true
$SUDO rm -rf /opt/ghc || true
$SUDO rm -rf /opt/hostedtoolcache/CodeQL || true

if command -v snap >/dev/null 2>&1; then
timeout 60s $SUDO snap remove lxd || true
timeout 60s $SUDO snap remove core20 || true
fi

if command -v apt-get >/dev/null 2>&1; then
DEBIAN_FRONTEND=noninteractive timeout 120s $SUDO apt-get purge -y snapd || true
fi

echo "Disk space after cleanup:"
df -h /
displayName: Cleanup unused host dependencies
condition: eq(variables['Agent.OS'], 'Linux')
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
- checkout: self
clean: true

- template: ../templates/host-cleanup-linux.yml
- template: ../templates/gitversion.yml
- template: ../templates/dotnet-mobile-install-linux.yml
parameters:
Expand Down
2 changes: 2 additions & 0 deletions build/ci/tests/.azure-devops-tests-android-coreclr-skia.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ jobs:
- checkout: self
clean: true

- template: ../templates/host-cleanup-linux.yml

- bash: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
Expand Down
2 changes: 2 additions & 0 deletions build/ci/tests/.azure-devops-tests-android-native.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ jobs:
- checkout: self
clean: true

- template: ../templates/host-cleanup-linux.yml

- bash: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
- checkout: self
clean: true

- template: ../templates/host-cleanup-linux.yml
- template: ../templates/gitversion.yml
- template: ../templates/dotnet-mobile-install-linux.yml
parameters:
Expand Down
2 changes: 2 additions & 0 deletions build/ci/tests/.azure-devops-tests-android-nativeaot-skia.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ jobs:
- checkout: self
clean: true

- template: ../templates/host-cleanup-linux.yml

- bash: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
Expand Down
1 change: 1 addition & 0 deletions build/ci/tests/.azure-devops-tests-android-skia-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
- checkout: self
clean: true

- template: ../templates/host-cleanup-linux.yml
- template: ../templates/gitversion.yml
- template: ../templates/dotnet-mobile-install-linux.yml
parameters:
Expand Down
2 changes: 2 additions & 0 deletions build/ci/tests/.azure-devops-tests-android-skia.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ jobs:
- checkout: self
clean: true

- template: ../templates/host-cleanup-linux.yml

- bash: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
Expand Down
4 changes: 4 additions & 0 deletions build/ci/tests/.azure-devops-tests-linux-skia.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ jobs:
steps:
- checkout: none

- template: ../templates/host-cleanup-linux.yml

- task: DownloadPipelineArtifact@2
displayName: Downloading $(SamplesAppArtifactName)
inputs:
Expand Down Expand Up @@ -74,6 +76,8 @@ jobs:

steps:

- template: ../templates/host-cleanup-linux.yml

- task: DownloadPipelineArtifact@2
displayName: Downloading $(SamplesAppArtifactName)
inputs:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
clean: true
fetchDepth: 1

- template: ../templates/host-cleanup-linux.yml
- template: ../templates/gitversion.yml
- template: ../templates/dotnet-mobile-install-windows.yml
parameters:
Expand Down
2 changes: 2 additions & 0 deletions build/ci/tests/.azure-devops-tests-webassembly-skia.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ jobs:

steps:

- template: ../templates/host-cleanup-linux.yml

- task: DownloadPipelineArtifact@2
displayName: Downloading $(SamplesAppArtifactName)
inputs:
Expand Down
Loading