diff --git a/conda_smithy/templates/azure-pipelines-win.yml.tmpl b/conda_smithy/templates/azure-pipelines-win.yml.tmpl index d33e3fe37..0b5bd5aab 100644 --- a/conda_smithy/templates/azure-pipelines-win.yml.tmpl +++ b/conda_smithy/templates/azure-pipelines-win.yml.tmpl @@ -10,21 +10,39 @@ 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 %%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 displayName: "Install Chocolatey Package: {{ choco_pkg }}" {% endfor %} - - task: PythonScript@0 - displayName: 'Download Miniforge' - inputs: - scriptSource: inline - script: | - import urllib.request - url = 'https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-Windows-x86_64.exe' - path = r"$(Build.ArtifactStagingDirectory)/Miniforge.exe" - urllib.request.urlretrieve(url, path) + - powershell: | + Invoke-WebRequest $env:MINIFORGE_URL -OutFile $env:MINIFORGE_PATH + displayName: "Download Miniforge" + env: + MINIFORGE_URL: https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-Windows-x86_64.exe + MINIFORGE_PATH: $(Build.ArtifactStagingDirectory)/Miniforge.exe - script: | start /wait "" %BUILD_ARTIFACTSTAGINGDIRECTORY%\Miniforge.exe /InstallationType=JustMe /RegisterPython=0 /S /D=C:\Miniforge 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:** + +* diff --git a/news/azure_win_download_miniforge_powershell.rst b/news/azure_win_download_miniforge_powershell.rst new file mode 100644 index 000000000..2c8118cf1 --- /dev/null +++ b/news/azure_win_download_miniforge_powershell.rst @@ -0,0 +1,23 @@ +**Added:** + +* + +**Changed:** + +* Switch to using PowerShell to download Miniforge + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* + +**Security:** + +*