mirror of
https://github.com/actions/runner-images-sangeeth.git
synced 2025-12-20 06:29:50 +00:00
Switch provisioners to install Go from GitHub releases on Windows (#1026)
* add go to json toolset * add install and validate go * fiixing go tests * fix validation for go * check zero build version * add 1.9 version * setup variables for go * fix comments * remove script invokation * remove lines * fixing install go * remove comments * remove fake url Co-authored-by: Dmitry Shibanov <v-dmshib@microsoft.com>
This commit is contained in:
@@ -49,12 +49,34 @@ Function Set-DefaultPythonVersion {
|
||||
}
|
||||
}
|
||||
|
||||
Function Set-DefaultGoVersion {
|
||||
param(
|
||||
[Parameter(Mandatory=$true)]
|
||||
[object[]] $Toolset
|
||||
)
|
||||
|
||||
$goToolset = $Toolset | Where-Object { ($_.name -eq "go") -and ($_.default -ne "") } `
|
||||
| Select-Object default, arch -First 1
|
||||
|
||||
if ($goToolset.default -ne $null) {
|
||||
$goPath = Join-Path $Env:AGENT_TOOLSDIRECTORY "/go/$($goToolset.default)/$($goToolset.arch)" -Resolve
|
||||
|
||||
Write-Host "Use Go $($goToolset.default) as a system Go"
|
||||
Add-MachinePathItem -PathItem "$goPath\bin" | Out-Null
|
||||
# Set the GOROOT environment variable.
|
||||
setx GOROOT "$goPath" /M | Out-Null
|
||||
} else {
|
||||
Write-Host "Default Go version not found in toolset file!"
|
||||
}
|
||||
}
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
Import-Module -Name ImageHelpers -Force
|
||||
|
||||
# Get toolcache content from toolset
|
||||
$ToolsToInstall = @("Python", "Node", "Boost")
|
||||
$ToolsToInstall = @("Python", "Node", "Boost", "Go")
|
||||
|
||||
$tools = Get-ToolsetContent | Select-Object -ExpandProperty toolcache | Where {$ToolsToInstall -contains $_.Name}
|
||||
|
||||
foreach ($tool in $tools) {
|
||||
@@ -80,4 +102,5 @@ foreach ($tool in $tools) {
|
||||
}
|
||||
|
||||
# Install default python version
|
||||
Set-DefaultPythonVersion -Toolset $tools
|
||||
Set-DefaultPythonVersion -Toolset $tools
|
||||
Set-DefaultGoVersion -Toolset $tools
|
||||
Reference in New Issue
Block a user