PowerShell: Go-version check; only select the first match
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
6130c89cce
commit
755d3057ab
|
@ -429,14 +429,14 @@ Try {
|
|||
Write-Host -ForegroundColor Green "INFO: Location for testing is $env:TEMP"
|
||||
|
||||
# CI Integrity check - ensure Dockerfile.windows and Dockerfile go versions match
|
||||
$goVersionDockerfileWindows=$(Get-Content ".\Dockerfile.windows" | Select-String "^ENV GO_VERSION").ToString().Replace("ENV GO_VERSION=","").Replace("\","").Replace("``","").Trim()
|
||||
$goVersionDockerfile=$(Get-Content ".\Dockerfile" | Select-String "^ENV GO_VERSION")
|
||||
$goVersionDockerfileWindows=$(Get-Content ".\Dockerfile.windows" | Select-String "^ENV GO_VERSION" | Select-object -First 1).ToString().Replace("ENV GO_VERSION=","").Replace("\","").Replace("``","").Trim()
|
||||
$goVersionDockerfile=$(Get-Content ".\Dockerfile" | Select-String "^ENV GO_VERSION" | Select-object -First 1)
|
||||
|
||||
# As of go 1.11, Dockerfile changed to be in the format like "FROM golang:1.11.0 AS base".
|
||||
# If a version number ends with .0 (as in 1.11.0, a convention used in golang docker
|
||||
# image versions), it needs to be removed (i.e. "1.11.0" becomes "1.11").
|
||||
if ($null -eq $goVersionDockerfile) {
|
||||
$goVersionDockerfile=$(Get-Content ".\Dockerfile" | Select-String "^FROM golang:")
|
||||
$goVersionDockerfile=$(Get-Content ".\Dockerfile" | Select-String "^FROM golang:" | Select-object -First 1)
|
||||
if ($null -ne $goVersionDockerfile) {
|
||||
$goVersionDockerfile = $goVersionDockerfile.ToString().Split(" ")[1].Split(":")[1] -replace '\.0$',''
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue