mirror of
https://github.com/actions/runner-images-sangeeth.git
synced 2025-12-20 06:29:50 +00:00
* [Windows] Refactor base Installer helper functions * Fix helper name * Fix name gen logic and improve error handling * Fix hash checking logic * Fix Install-VsixExtension invocation * Fix variable name in Install-OpenSSL.ps1 * Fix type for git downloadUrl
33 lines
1.2 KiB
PowerShell
33 lines
1.2 KiB
PowerShell
################################################################################
|
|
## File: Install-Miniconda.ps1
|
|
## Desc: Install the latest version of Miniconda and set $env:CONDA
|
|
## Supply chain security: checksum validation
|
|
################################################################################
|
|
|
|
$CondaDestination = "C:\Miniconda"
|
|
$InstallerName = "Miniconda3-latest-Windows-x86_64.exe"
|
|
|
|
#region Supply chain security
|
|
$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
|
|
}
|
|
}
|
|
|
|
if ($null -eq $distributorFileHash) {
|
|
throw "Unable to find checksum for $InstallerName in https://repo.anaconda.com/miniconda/"
|
|
}
|
|
#endregion
|
|
|
|
Install-Binary `
|
|
-Url "https://repo.anaconda.com/miniconda/${InstallerName}" `
|
|
-InstallArgs @("/S", "/AddToPath=0", "/RegisterPython=0", "/D=$CondaDestination") `
|
|
-ExpectedSHA256Sum $distributorFileHash
|
|
|
|
[System.Environment]::SetEnvironmentVariable("CONDA", $CondaDestination, "Machine")
|
|
|
|
Invoke-PesterTests -TestFile "Miniconda"
|