Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend azure.free_disk_space to Windows as well #1966

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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
36 changes: 27 additions & 9 deletions conda_smithy/templates/azure-pipelines-win.yml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 23 additions & 0 deletions news/azure_win_add_optional_cleanup.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
**Added:**

* Enable cleanup on Azure Windows as well

**Changed:**

* <news item>

**Deprecated:**

* <news item>

**Removed:**

* <news item>

**Fixed:**

* <news item>

**Security:**

* <news item>
23 changes: 23 additions & 0 deletions news/azure_win_download_miniforge_powershell.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
**Added:**

* <news item>

**Changed:**

* Switch to using PowerShell to download Miniforge

**Deprecated:**

* <news item>

**Removed:**

* <news item>

**Fixed:**

* <news item>

**Security:**

* <news item>
Loading