mirror of
https://github.com/actions/runner-images.git
synced 2026-01-01 06:48:14 +08:00
[Windows] Implement new directories hierarchy (#8616)
This commit is contained in:
committed by
GitHub
parent
84a7deae24
commit
d1f2c9a3be
32
images/windows/scripts/build/Install-Miniconda.ps1
Normal file
32
images/windows/scripts/build/Install-Miniconda.ps1
Normal file
@@ -0,0 +1,32 @@
|
||||
################################################################################
|
||||
## File: Install-Miniconda.ps1
|
||||
## Desc: Install the latest version of Miniconda and set $env:CONDA
|
||||
## Supply chain security: checksum validation
|
||||
################################################################################
|
||||
|
||||
$CondaDestination = "C:\Miniconda"
|
||||
|
||||
# Install the latest Miniconda
|
||||
$InstallerName = "Miniconda3-latest-Windows-x86_64.exe"
|
||||
$InstallerUrl = "https://repo.anaconda.com/miniconda/${InstallerName}"
|
||||
$ArgumentList = ("/S", "/AddToPath=0", "/RegisterPython=0", "/D=$CondaDestination")
|
||||
|
||||
Install-Binary -Url $InstallerUrl -Name $InstallerName -ArgumentList $ArgumentList
|
||||
Set-SystemVariable -SystemVariable "CONDA" -Value $CondaDestination
|
||||
|
||||
#region Supply chain security
|
||||
$localFileHash = (Get-FileHash -Path (Join-Path ${env:TEMP} $installerName) -Algorithm SHA256).Hash
|
||||
$distributorFileHash = $null
|
||||
|
||||
$checksums = (Invoke-RestMethod -Uri 'https://repo.anaconda.com/miniconda/' | ConvertFrom-HTML).SelectNodes('//html/body/table/tr')
|
||||
|
||||
ForEach($node in $checksums) {
|
||||
if ($node.ChildNodes[1].InnerText -eq $InstallerName) {
|
||||
$distributorFileHash = $node.ChildNodes[7].InnerText
|
||||
}
|
||||
}
|
||||
|
||||
Use-ChecksumComparison -LocalFileHash $localFileHash -DistributorFileHash $distributorFileHash
|
||||
#endregion
|
||||
|
||||
Invoke-PesterTests -TestFile "Miniconda"
|
||||
Reference in New Issue
Block a user