From 32ed6d40049b5138b3e5f8f787c76c80d03af3da Mon Sep 17 00:00:00 2001 From: jakirkham Date: Fri, 28 Jun 2024 01:03:53 -0700 Subject: [PATCH] Optionally cleanup Azure Windows image --- .../templates/azure-pipelines-win.yml.tmpl | 21 +++++++++++++++++ news/azure_win_add_optional_cleanup.rst | 23 +++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 news/azure_win_add_optional_cleanup.rst diff --git a/conda_smithy/templates/azure-pipelines-win.yml.tmpl b/conda_smithy/templates/azure-pipelines-win.yml.tmpl index a7f7cafb5..208db6288 100644 --- a/conda_smithy/templates/azure-pipelines-win.yml.tmpl +++ b/conda_smithy/templates/azure-pipelines-win.yml.tmpl @@ -10,6 +10,27 @@ jobs: - checkout: self fetchDepth: {{ clone_depth }} {%- endif %} +{%- if azure.free_disk_space %} + - script: | +{%- if (azure.free_disk_space == true) or ('cache' in azure.free_disk_space) %} + set CLEANUP_DIRS=^ + C:\hostedtoolcache\windows;^ + ; + + mkdir C:\empty + for %%f in (%CLEANUP_DIRS:;= %) do ( + if not [%%f] == [] ( + echo Removing %%f + dir /s /a %%f + robocopy /mir /mt /zb /ns /nc /nfl /ndl /np /njh /njs C:\empty %%f > nul 2>&1 + rmdir /q %%f + ) + ) + rmdir /q C:\empty +{%- endif %} + wmic logicaldisk get size,freespace,caption + displayName: Manage disk space +{%- endif %} {%- for choco_pkg in choco %} - script: | choco install {{ choco_pkg }} -fdv -y --debug diff --git a/news/azure_win_add_optional_cleanup.rst b/news/azure_win_add_optional_cleanup.rst new file mode 100644 index 000000000..45e8b8590 --- /dev/null +++ b/news/azure_win_add_optional_cleanup.rst @@ -0,0 +1,23 @@ +**Added:** + +* Enable cleanup on Azure Windows as well + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* + +**Security:** + +*