Skip to content
This repository was archived by the owner on Oct 13, 2023. It is now read-only.

Commit ca10879

Browse files
StefanSchererthaJeztah
authored andcommitted
Use new windows labels
Signed-off-by: Stefan Scherer <stefan.scherer@docker.com> (cherry picked from commit ca3e230b7749d02dd6019392eeffcd0e0d5d2c16) Signed-off-by: Sebastiaan van Stijn <github@gone.nl> Upstream-commit: 339261224fcdcff3c58a157a79491c14fc68cdea Component: engine
1 parent a1c109f commit ca10879

3 files changed

Lines changed: 70 additions & 32 deletions

File tree

components/engine/Jenkinsfile

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ pipeline {
1212
booleanParam(name: 'janky', defaultValue: true, description: 'x86 Build/Test')
1313
booleanParam(name: 'z', defaultValue: true, description: 'IBM Z (s390x) Build/Test')
1414
booleanParam(name: 'powerpc', defaultValue: true, description: 'PowerPC (ppc64le) Build/Test')
15-
booleanParam(name: 'windowsRS1', defaultValue: false, description: 'Windows 2016 (RS1) Build/Test')
16-
booleanParam(name: 'windowsRS5', defaultValue: false, description: 'Windows 2019 (RS5) Build/Test')
15+
booleanParam(name: 'windowsRS1', defaultValue: true, description: 'Windows 2016 (RS1) Build/Test')
16+
booleanParam(name: 'windowsRS5', defaultValue: true, description: 'Windows 2019 (RS5) Build/Test')
1717
booleanParam(name: 'skip_dco', defaultValue: false, description: 'Skip the DCO check')
1818
}
1919
environment {
@@ -668,10 +668,20 @@ pipeline {
668668
beforeAgent true
669669
expression { params.windowsRS1 }
670670
}
671+
environment {
672+
DOCKER_BUILDKIT = '0'
673+
SKIP_VALIDATION_TESTS = '1'
674+
SOURCES_DRIVE = 'd'
675+
SOURCES_SUBDIR = 'gopath'
676+
TESTRUN_DRIVE = 'd'
677+
TESTRUN_SUBDIR = "CI-$BUILD_NUMBER"
678+
WINDOWS_BASE_IMAGE = 'mcr.microsoft.com/windows/servercore'
679+
WINDOWS_BASE_IMAGE_TAG = 'ltsc2016'
680+
}
671681
agent {
672682
node {
673-
label 'windows-rs1'
674-
customWorkspace 'c:\\gopath\\src\\github.com\\docker\\docker'
683+
customWorkspace 'd:\\gopath\\src\\github.com\\docker\\docker'
684+
label 'windows-2016'
675685
}
676686
}
677687
stages {
@@ -685,7 +695,9 @@ pipeline {
685695
steps {
686696
powershell '''
687697
$ErrorActionPreference = 'Stop'
688-
.\\hack\\ci\\windows.ps1
698+
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
699+
Invoke-WebRequest https://github.com/jhowardmsft/docker-ci-zap/blob/master/docker-ci-zap.exe?raw=true -OutFile C:/Windows/System32/docker-ci-zap.exe
700+
./hack/ci/windows.ps1
689701
exit $LastExitCode
690702
'''
691703
}
@@ -697,10 +709,20 @@ pipeline {
697709
beforeAgent true
698710
expression { params.windowsRS5 }
699711
}
712+
environment {
713+
DOCKER_BUILDKIT = '0'
714+
SKIP_VALIDATION_TESTS = '1'
715+
SOURCES_DRIVE = 'd'
716+
SOURCES_SUBDIR = 'gopath'
717+
TESTRUN_DRIVE = 'd'
718+
TESTRUN_SUBDIR = "CI-$BUILD_NUMBER"
719+
WINDOWS_BASE_IMAGE = 'mcr.microsoft.com/windows/servercore'
720+
WINDOWS_BASE_IMAGE_TAG = 'ltsc2019'
721+
}
700722
agent {
701723
node {
702-
label 'windows-rs5'
703-
customWorkspace 'c:\\gopath\\src\\github.com\\docker\\docker'
724+
customWorkspace 'd:\\gopath\\src\\github.com\\docker\\docker'
725+
label 'windows-2019'
704726
}
705727
}
706728
stages {
@@ -714,7 +736,8 @@ pipeline {
714736
steps {
715737
powershell '''
716738
$ErrorActionPreference = 'Stop'
717-
.\\hack\\ci\\windows.ps1
739+
Invoke-WebRequest https://github.com/jhowardmsft/docker-ci-zap/blob/master/docker-ci-zap.exe?raw=true -OutFile C:/Windows/System32/docker-ci-zap.exe
740+
./hack/ci/windows.ps1
718741
exit $LastExitCode
719742
'''
720743
}

components/engine/hack/ci/windows.ps1

Lines changed: 38 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ if ($env:BUILD_TAG -match "-WoW") { $env:LCOW_MODE="" }
7878
# docker integration tests are also coded to use the same
7979
# environment variable, and if no set, defaults to microsoft/windowsservercore
8080
#
81+
# WINDOWS_BASE_IMAGE_TAG if defined, uses that as the tag name for the base image.
82+
# if no set, defaults to latest
83+
#
8184
# LCOW_BASIC_MODE if defined, does very basic LCOW verification. Ultimately we
8285
# want to run the entire CI suite from docker, but that's a way off.
8386
#
@@ -139,7 +142,7 @@ Function Nuke-Everything {
139142
}
140143

141144
$allImages = $(docker images --format "{{.Repository}}#{{.ID}}")
142-
$toRemove = ($allImages | Select-String -NotMatch "windowsservercore","nanoserver","docker")
145+
$toRemove = ($allImages | Select-String -NotMatch "servercore","nanoserver","docker")
143146
$imageCount = ($toRemove | Measure-Object -line).Lines
144147

145148
if ($imageCount -gt 0) {
@@ -261,6 +264,18 @@ Try {
261264
# Make sure docker-ci-zap is installed
262265
if ($null -eq (Get-Command "docker-ci-zap" -ErrorAction SilentlyContinue)) { Throw "ERROR: docker-ci-zap is not installed or not found on path" }
263266

267+
# Make sure Windows Defender is disabled
268+
$defender = $false
269+
Try {
270+
$status = Get-MpComputerStatus
271+
if ($status) {
272+
if ($status.RealTimeProtectionEnabled) {
273+
$defender = $true
274+
}
275+
}
276+
} Catch {}
277+
if ($defender) { Throw "ERROR: Windows Defender real time protection must be disabled for integration tests" }
278+
264279
# Make sure SOURCES_DRIVE is set
265280
if ($null -eq $env:SOURCES_DRIVE) { Throw "ERROR: Environment variable SOURCES_DRIVE is not set" }
266281

@@ -345,14 +360,16 @@ Try {
345360
Write-Host -ForegroundColor Green "INFO: docker load of"$ControlDaemonBaseImage" completed successfully"
346361
} else {
347362
# We need to docker pull it instead. It will come in directly as microsoft/imagename:latest
348-
Write-Host -ForegroundColor Green $("INFO: Pulling microsoft/"+$ControlDaemonBaseImage+":latest from docker hub. This may take some time...")
363+
Write-Host -ForegroundColor Green $("INFO: Pulling $($env:WINDOWS_BASE_IMAGE):$env:WINDOWS_BASE_IMAGE_TAG from docker hub. This may take some time...")
349364
$ErrorActionPreference = "SilentlyContinue"
350-
docker pull $("microsoft/"+$ControlDaemonBaseImage)
365+
docker pull "$($env:WINDOWS_BASE_IMAGE):$env:WINDOWS_BASE_IMAGE_TAG"
351366
$ErrorActionPreference = "Stop"
352367
if (-not $LastExitCode -eq 0) {
353-
Throw $("ERROR: Failed to docker pull microsoft/"+$ControlDaemonBaseImage+":latest.")
368+
Throw $("ERROR: Failed to docker pull $($env:WINDOWS_BASE_IMAGE):$env:WINDOWS_BASE_IMAGE_TAG.")
354369
}
355-
Write-Host -ForegroundColor Green $("INFO: docker pull of microsoft/"+$ControlDaemonBaseImage+":latest completed successfully")
370+
Write-Host -ForegroundColor Green $("INFO: docker pull of $($env:WINDOWS_BASE_IMAGE):$env:WINDOWS_BASE_IMAGE_TAG completed successfully")
371+
Write-Host -ForegroundColor Green $("INFO: Tagging $($env:WINDOWS_BASE_IMAGE):$env:WINDOWS_BASE_IMAGE_TAG as microsoft/$ControlDaemonBaseImage")
372+
docker tag "$($env:WINDOWS_BASE_IMAGE):$env:WINDOWS_BASE_IMAGE_TAG" microsoft/$ControlDaemonBaseImage
356373
}
357374
} else {
358375
Write-Host -ForegroundColor Green "INFO: Image"$("microsoft/"+$ControlDaemonBaseImage+":latest")"is already loaded in the control daemon"
@@ -663,17 +680,20 @@ Try {
663680
if ($null -eq $env:WINDOWS_BASE_IMAGE) {
664681
$env:WINDOWS_BASE_IMAGE="microsoft/windowsservercore"
665682
}
683+
if ($null -eq $env:WINDOWS_BASE_IMAGE_TAG) {
684+
$env:WINDOWS_BASE_IMAGE_TAG="latest"
685+
}
666686

667687
# Lowercase and make sure it has a microsoft/ prefix
668688
$env:WINDOWS_BASE_IMAGE = $env:WINDOWS_BASE_IMAGE.ToLower()
669-
if ($($env:WINDOWS_BASE_IMAGE -Split "/")[0] -ne "microsoft") {
670-
Throw "ERROR: WINDOWS_BASE_IMAGE should start microsoft/"
689+
if (! $($env:WINDOWS_BASE_IMAGE -Split "/")[0] -match "microsoft") {
690+
Throw "ERROR: WINDOWS_BASE_IMAGE should start microsoft/ or mcr.microsoft.com/"
671691
}
672692

673693
Write-Host -ForegroundColor Green "INFO: Base image for tests is $env:WINDOWS_BASE_IMAGE"
674694

675695
$ErrorActionPreference = "SilentlyContinue"
676-
if ($((& "$env:TEMP\binary\docker-$COMMITHASH" "-H=$($DASHH_CUT)" images --format "{{.Repository}}:{{.Tag}}" | Select-String $($env:WINDOWS_BASE_IMAGE+":latest") | Measure-Object -Line).Lines) -eq 0) {
696+
if ($((& "$env:TEMP\binary\docker-$COMMITHASH" "-H=$($DASHH_CUT)" images --format "{{.Repository}}:{{.Tag}}" | Select-String "$($env:WINDOWS_BASE_IMAGE):$env:WINDOWS_BASE_IMAGE_TAG" | Measure-Object -Line).Lines) -eq 0) {
677697
# Try the internal azure CI image version or Microsoft internal corpnet where the base image is already pre-prepared on the disk,
678698
# either through Invoke-DockerCI or, in the case of Azure CI servers, baked into the VHD at the same location.
679699
if (Test-Path $("c:\baseimages\"+$($env:WINDOWS_BASE_IMAGE -Split "/")[1]+".tar")) {
@@ -686,26 +706,28 @@ Try {
686706
}
687707
Write-Host -ForegroundColor Green "INFO: docker load of"$($env:WINDOWS_BASE_IMAGE -Split "/")[1]" into daemon under test completed successfully"
688708
} else {
689-
# We need to docker pull it instead. It will come in directly as microsoft/imagename:latest
690-
Write-Host -ForegroundColor Green $("INFO: Pulling "+$env:WINDOWS_BASE_IMAGE+":latest from docker hub into daemon under test. This may take some time...")
709+
# We need to docker pull it instead. It will come in directly as microsoft/imagename:tagname
710+
Write-Host -ForegroundColor Green $("INFO: Pulling "+$env:WINDOWS_BASE_IMAGE+":"+$env:WINDOWS_BASE_IMAGE_TAG+" from docker hub into daemon under test. This may take some time...")
691711
$ErrorActionPreference = "SilentlyContinue"
692-
& "$env:TEMP\binary\docker-$COMMITHASH" "-H=$($DASHH_CUT)" pull $($env:WINDOWS_BASE_IMAGE)
712+
& "$env:TEMP\binary\docker-$COMMITHASH" "-H=$($DASHH_CUT)" pull "$($env:WINDOWS_BASE_IMAGE):$env:WINDOWS_BASE_IMAGE_TAG"
693713
$ErrorActionPreference = "Stop"
694714
if (-not $LastExitCode -eq 0) {
695-
Throw $("ERROR: Failed to docker pull "+$env:WINDOWS_BASE_IMAGE+":latest into daemon under test.")
715+
Throw $("ERROR: Failed to docker pull $($env:WINDOWS_BASE_IMAGE):$env:WINDOWS_BASE_IMAGE_TAG into daemon under test.")
696716
}
697-
Write-Host -ForegroundColor Green $("INFO: docker pull of "+$env:WINDOWS_BASE_IMAGE+":latest into daemon under test completed successfully")
717+
Write-Host -ForegroundColor Green $("INFO: docker pull of $($env:WINDOWS_BASE_IMAGE):$env:WINDOWS_BASE_IMAGE_TAG into daemon under test completed successfully")
718+
Write-Host -ForegroundColor Green $("INFO: Tagging $($env:WINDOWS_BASE_IMAGE):$env:WINDOWS_BASE_IMAGE_TAG as microsoft/$ControlDaemonBaseImage in daemon under test")
719+
& "$env:TEMP\binary\docker-$COMMITHASH" "-H=$($DASHH_CUT)" tag "$($env:WINDOWS_BASE_IMAGE):$env:WINDOWS_BASE_IMAGE_TAG" microsoft/$ControlDaemonBaseImage
698720
}
699721
} else {
700-
Write-Host -ForegroundColor Green "INFO: Image"$($env:WINDOWS_BASE_IMAGE+":latest")"is already loaded in the daemon under test"
722+
Write-Host -ForegroundColor Green "INFO: Image $($env:WINDOWS_BASE_IMAGE):$env:WINDOWS_BASE_IMAGE_TAG is already loaded in the daemon under test"
701723
}
702724

703725

704726
# Inspect the pulled or loaded image to get the version directly
705727
$ErrorActionPreference = "SilentlyContinue"
706728
$dutimgVersion = $(&"$env:TEMP\binary\docker-$COMMITHASH" "-H=$($DASHH_CUT)" inspect $($env:WINDOWS_BASE_IMAGE) --format "{{.OsVersion}}")
707729
$ErrorActionPreference = "Stop"
708-
Write-Host -ForegroundColor Green $("INFO: Version of "+$env:WINDOWS_BASE_IMAGE+":latest is '"+$dutimgVersion+"'")
730+
Write-Host -ForegroundColor Green $("INFO: Version of $($env:WINDOWS_BASE_IMAGE):$env:WINDOWS_BASE_IMAGE_TAG is '"+$dutimgVersion+"'")
709731
}
710732

711733
# Run the validation tests unless SKIP_VALIDATION_TESTS is defined.
@@ -752,14 +774,7 @@ Try {
752774
#if ($bbCount -eq 0) {
753775
Write-Host -ForegroundColor Green "INFO: Building busybox"
754776
$ErrorActionPreference = "SilentlyContinue"
755-
756-
# This is a temporary hack for nanoserver
757-
if ($env:WINDOWS_BASE_IMAGE -ne "microsoft/windowsservercore") {
758-
Write-Host -ForegroundColor Red "HACK HACK HACK - Building 64-bit nanoserver busybox image"
759-
$(& "$env:TEMP\binary\docker-$COMMITHASH" "-H=$($DASHH_CUT)" build -t busybox https://raw.githubusercontent.com/jhowardmsft/busybox64/v1.1/Dockerfile | Out-Host)
760-
} else {
761-
$(& "$env:TEMP\binary\docker-$COMMITHASH" "-H=$($DASHH_CUT)" build -t busybox https://raw.githubusercontent.com/jhowardmsft/busybox/v1.1/Dockerfile | Out-Host)
762-
}
777+
$(& "$env:TEMP\binary\docker-$COMMITHASH" "-H=$($DASHH_CUT)" build -t busybox https://raw.githubusercontent.com/jhowardmsft/busybox/v1.1/Dockerfile | Out-Host)
763778
$ErrorActionPreference = "Stop"
764779
if (-not($LastExitCode -eq 0)) {
765780
Throw "ERROR: Failed to build busybox image"

components/engine/integration-cli/docker_cli_run_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1706,7 +1706,7 @@ func (s *DockerSuite) TestRunCleanupCmdOnEntrypoint(c *check.C) {
17061706
out = strings.TrimSpace(out)
17071707
expected := "root"
17081708
if testEnv.OSType == "windows" {
1709-
if strings.Contains(testEnv.PlatformDefaults.BaseImage, "windowsservercore") {
1709+
if strings.Contains(testEnv.PlatformDefaults.BaseImage, "servercore") {
17101710
expected = `user manager\containeradministrator`
17111711
} else {
17121712
expected = `ContainerAdministrator` // nanoserver

0 commit comments

Comments
 (0)