From 755d3057ab8917c37e33bb5aa60c37cbe51285dd Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sat, 22 Dec 2018 21:29:26 +0100 Subject: [PATCH] PowerShell: Go-version check; only select the first match Signed-off-by: Sebastiaan van Stijn --- hack/ci/windows.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/hack/ci/windows.ps1 b/hack/ci/windows.ps1 index 4443019584..9dde9501e8 100644 --- a/hack/ci/windows.ps1 +++ b/hack/ci/windows.ps1 @@ -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$','' }