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:
Dmitry Shibanov
2020-06-19 13:47:55 +03:00
committed by GitHub
parent 7c96951971
commit b41fda16c1
8 changed files with 113 additions and 182 deletions

View File

@@ -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