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:** + +*