Skip to content

Commit ac3376a

Browse files
committed
clean up pipelines to prevent oom
1 parent d221406 commit ac3376a

File tree

3 files changed

+72
-1
lines changed

3 files changed

+72
-1
lines changed

eng/ci/integration-tests.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ extends:
4141
name: 1es-pool-azfunc
4242
image: 1es-windows-2022
4343
os: windows
44+
settings:
45+
clean: all # Clean all build directories before starting
4446

4547
stages:
4648
- stage: RunE2ETests

eng/templates/official/jobs/ci-e2e-tests.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,24 @@ jobs:
4949
EVENTGRID_URI: $(LinuxEventGridTopicUriString312)
5050
EVENTGRID_CONNECTION: $(LinuxEventGridConnectionKeyString312)
5151
steps:
52+
- bash: |
53+
echo "Disk space before cleanup:"
54+
df -h
55+
56+
# Clean up Docker resources
57+
docker system prune -af --volumes || true
58+
59+
# Clean pip cache
60+
pip cache purge || true
61+
62+
# Clean apt cache
63+
sudo apt-get clean || true
64+
sudo rm -rf /var/lib/apt/lists/* || true
65+
66+
echo "Disk space after cleanup:"
67+
df -h
68+
displayName: 'Free disk space'
69+
5270
- task: UsePythonVersion@0
5371
inputs:
5472
versionSpec: $(PYTHON_VERSION)
@@ -137,3 +155,22 @@ jobs:
137155
PYAZURE_WEBHOST_DEBUG: true
138156
displayName: "Running $(PYTHON_VERSION) Python E2E Tests"
139157
workingDirectory: $(Build.SourcesDirectory)/${{ parameters.PROJECT_DIRECTORY }}
158+
159+
- bash: |
160+
echo "Cleaning up after tests..."
161+
# Remove build artifacts and caches
162+
rm -rf $(Build.SourcesDirectory)/${{ parameters.PROJECT_DIRECTORY }}/build || true
163+
rm -rf $(Build.SourcesDirectory)/${{ parameters.PROJECT_DIRECTORY }}/.pytest_cache || true
164+
rm -rf $(Pipeline.Workspace)/PythonSdkArtifact || true
165+
rm -rf $(Pipeline.Workspace)/PythonExtensionArtifact || true
166+
167+
# Clean Docker
168+
docker system prune -f || true
169+
170+
# Clean pip cache
171+
pip cache purge || true
172+
173+
echo "Disk space after cleanup:"
174+
df -h
175+
displayName: 'Cleanup after tests'
176+
condition: always()

eng/templates/official/jobs/ci-lc-tests.yml

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,24 @@ jobs:
2121
Python312:
2222
PYTHON_VERSION: '3.12'
2323
steps:
24+
- bash: |
25+
echo "Disk space before cleanup:"
26+
df -h
27+
28+
# Clean up Docker resources
29+
docker system prune -af --volumes || true
30+
31+
# Clean pip cache
32+
pip cache purge || true
33+
34+
# Clean apt cache
35+
sudo apt-get clean || true
36+
sudo rm -rf /var/lib/apt/lists/* || true
37+
38+
echo "Disk space after cleanup:"
39+
df -h
40+
displayName: 'Free disk space'
41+
2442
- task: UsePythonVersion@0
2543
inputs:
2644
versionSpec: $(PYTHON_VERSION)
@@ -113,8 +131,22 @@ jobs:
113131
condition: and(eq(variables.isSdkRelease, false), eq(variables.isExtensionsRelease, false), eq(variables['USETESTPYTHONSDK'], false), eq(variables['USETESTPYTHONEXTENSIONS'], false))
114132
115133
- bash: |
134+
echo "Cleaning up after tests..."
116135
# Cleanup: Stop and remove Azurite container
117136
docker stop azurite-storage || true
118137
docker rm azurite-storage || true
119-
displayName: 'Cleanup Azurite Storage Emulator'
138+
139+
# Remove build artifacts and caches
140+
rm -rf $(Build.SourcesDirectory)/${{ parameters.PROJECT_DIRECTORY }}/build || true
141+
rm -rf $(Build.SourcesDirectory)/${{ parameters.PROJECT_DIRECTORY }}/.pytest_cache || true
142+
143+
# Clean Docker resources
144+
docker system prune -f || true
145+
146+
# Clean pip cache
147+
pip cache purge || true
148+
149+
echo "Disk space after cleanup:"
150+
df -h
151+
displayName: 'Cleanup after tests'
120152
condition: always()

0 commit comments

Comments
 (0)