mirror of
https://github.com/actions/runner-images.git
synced 2026-01-08 03:07:32 +08:00
Merge pull request #642 from al-cheb/al-cheb/install_root_ca
Install missing root certificates on windows-2019
This commit is contained in:
@@ -586,6 +586,12 @@
|
||||
"{{ template_dir }}/scripts/Installers/Install-Bazel.ps1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "powershell",
|
||||
"scripts":[
|
||||
"{{ template_dir }}/scripts/Installers/Install-RootCA.ps1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "windows-restart",
|
||||
"restart_timeout": "10m"
|
||||
|
||||
22
images/win/scripts/Installers/Install-RootCA.ps1
Normal file
22
images/win/scripts/Installers/Install-RootCA.ps1
Normal file
@@ -0,0 +1,22 @@
|
||||
# Serialized Certificate Store File
|
||||
$sstFile = "$env:TEMP\roots.sst"
|
||||
# Generate SST from Windows Update
|
||||
$result = certutil.exe -generateSSTFromWU $sstFile
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Host "[Error]: failed to generate $sstFile sst file`n$result"
|
||||
exit $LASTEXITCODE
|
||||
}
|
||||
|
||||
$result = certutil.exe -dump $sstFile
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
Write-Host "[Error]: failed to dump $sstFile sst file`n$result"
|
||||
exit $LASTEXITCODE
|
||||
}
|
||||
|
||||
try {
|
||||
Import-Certificate -FilePath $sstFile -CertStoreLocation Cert:\LocalMachine\Root
|
||||
} catch {
|
||||
Write-Host "[Error]: failed to import ROOT CA`n$_"
|
||||
exit 1
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user