Browse code

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>

Stefan Scherer authored on 2019/08/15 06:26:34
Showing 3 changed files
... ...
@@ -12,8 +12,8 @@ pipeline {
12 12
         booleanParam(name: 'janky', defaultValue: true, description: 'x86 Build/Test')
13 13
         booleanParam(name: 'z', defaultValue: true, description: 'IBM Z (s390x) Build/Test')
14 14
         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')
17 17
         booleanParam(name: 'skip_dco', defaultValue: false, description: 'Skip the DCO check')
18 18
     }
19 19
     environment {
... ...
@@ -668,10 +668,20 @@ pipeline {
668 668
                         beforeAgent true
669 669
                         expression { params.windowsRS1 }
670 670
                     }
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
+                    }
671 681
                     agent {
672 682
                         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'
675 685
                         }
676 686
                     }
677 687
                     stages {
... ...
@@ -685,7 +695,9 @@ pipeline {
685 685
                             steps {
686 686
                                 powershell '''
687 687
                                 $ErrorActionPreference = 'Stop'
688
-                                .\\hack\\ci\\windows.ps1
688
+                                [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
689
+                                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
690
+                                ./hack/ci/windows.ps1
689 691
                                 exit $LastExitCode
690 692
                                 '''
691 693
                             }
... ...
@@ -697,10 +709,20 @@ pipeline {
697 697
                         beforeAgent true
698 698
                         expression { params.windowsRS5 }
699 699
                     }
700
+                    environment {
701
+                        DOCKER_BUILDKIT        = '0'
702
+                        SKIP_VALIDATION_TESTS  = '1'
703
+                        SOURCES_DRIVE          = 'd'
704
+                        SOURCES_SUBDIR         = 'gopath'
705
+                        TESTRUN_DRIVE          = 'd'
706
+                        TESTRUN_SUBDIR         = "CI-$BUILD_NUMBER"
707
+                        WINDOWS_BASE_IMAGE     = 'mcr.microsoft.com/windows/servercore'
708
+                        WINDOWS_BASE_IMAGE_TAG = 'ltsc2019'
709
+                    }
700 710
                     agent {
701 711
                         node {
702
-                            label 'windows-rs5'
703
-                            customWorkspace 'c:\\gopath\\src\\github.com\\docker\\docker'
712
+                            customWorkspace 'd:\\gopath\\src\\github.com\\docker\\docker'
713
+                            label 'windows-2019'
704 714
                         }
705 715
                     }
706 716
                     stages {
... ...
@@ -714,7 +736,8 @@ pipeline {
714 714
                             steps {
715 715
                                 powershell '''
716 716
                                 $ErrorActionPreference = 'Stop'
717
-                                .\\hack\\ci\\windows.ps1
717
+                                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
718
+                                ./hack/ci/windows.ps1
718 719
                                 exit $LastExitCode
719 720
                                 '''
720 721
                             }
... ...
@@ -78,6 +78,9 @@ if ($env:BUILD_TAG -match "-WoW") { $env:LCOW_MODE="" }
78 78
 #                             docker integration tests are also coded to use the same
79 79
 #                             environment variable, and if no set, defaults to microsoft/windowsservercore
80 80
 #
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
+#
81 84
 #    LCOW_BASIC_MODE          if defined, does very basic LCOW verification. Ultimately we 
82 85
 #                             want to run the entire CI suite from docker, but that's a way off.
83 86
 #                            
... ...
@@ -139,7 +142,7 @@ Function Nuke-Everything {
139 139
             }
140 140
 
141 141
             $allImages  = $(docker images --format "{{.Repository}}#{{.ID}}")
142
-            $toRemove   = ($allImages | Select-String -NotMatch "windowsservercore","nanoserver","docker")
142
+            $toRemove   = ($allImages | Select-String -NotMatch "servercore","nanoserver","docker")
143 143
             $imageCount = ($toRemove | Measure-Object -line).Lines
144 144
 
145 145
             if ($imageCount -gt 0) {
... ...
@@ -261,6 +264,18 @@ Try {
261 261
     # Make sure docker-ci-zap is installed
262 262
     if ($null -eq (Get-Command "docker-ci-zap" -ErrorAction SilentlyContinue)) { Throw "ERROR: docker-ci-zap is not installed or not found on path" }
263 263
 
264
+    # Make sure Windows Defender is disabled
265
+    $defender = $false
266
+    Try {
267
+      $status = Get-MpComputerStatus
268
+      if ($status) {
269
+        if ($status.RealTimeProtectionEnabled) {
270
+          $defender = $true
271
+        }
272
+      }
273
+    } Catch {}
274
+    if ($defender) { Throw "ERROR: Windows Defender real time protection must be disabled for integration tests" }
275
+
264 276
     # Make sure SOURCES_DRIVE is set
265 277
     if ($null -eq $env:SOURCES_DRIVE) { Throw "ERROR: Environment variable SOURCES_DRIVE is not set" }
266 278
 
... ...
@@ -345,14 +360,16 @@ Try {
345 345
             Write-Host -ForegroundColor Green "INFO: docker load of"$ControlDaemonBaseImage" completed successfully"
346 346
         } else {
347 347
             # 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...")
348
+            Write-Host -ForegroundColor Green $("INFO: Pulling $($env:WINDOWS_BASE_IMAGE):$env:WINDOWS_BASE_IMAGE_TAG from docker hub. This may take some time...")
349 349
             $ErrorActionPreference = "SilentlyContinue"
350
-            docker pull $("microsoft/"+$ControlDaemonBaseImage)
350
+            docker pull "$($env:WINDOWS_BASE_IMAGE):$env:WINDOWS_BASE_IMAGE_TAG"
351 351
             $ErrorActionPreference = "Stop"
352 352
             if (-not $LastExitCode -eq 0) {
353
-                Throw $("ERROR: Failed to docker pull microsoft/"+$ControlDaemonBaseImage+":latest.")
353
+                Throw $("ERROR: Failed to docker pull $($env:WINDOWS_BASE_IMAGE):$env:WINDOWS_BASE_IMAGE_TAG.")
354 354
             }
355
-            Write-Host -ForegroundColor Green $("INFO: docker pull of microsoft/"+$ControlDaemonBaseImage+":latest completed successfully")
355
+            Write-Host -ForegroundColor Green $("INFO: docker pull of $($env:WINDOWS_BASE_IMAGE):$env:WINDOWS_BASE_IMAGE_TAG completed successfully")
356
+            Write-Host -ForegroundColor Green $("INFO: Tagging $($env:WINDOWS_BASE_IMAGE):$env:WINDOWS_BASE_IMAGE_TAG as microsoft/$ControlDaemonBaseImage")
357
+            docker tag "$($env:WINDOWS_BASE_IMAGE):$env:WINDOWS_BASE_IMAGE_TAG" microsoft/$ControlDaemonBaseImage
356 358
         }
357 359
     } else {
358 360
         Write-Host -ForegroundColor Green "INFO: Image"$("microsoft/"+$ControlDaemonBaseImage+":latest")"is already loaded in the control daemon"
... ...
@@ -663,17 +680,20 @@ Try {
663 663
         if ($null -eq $env:WINDOWS_BASE_IMAGE) {
664 664
             $env:WINDOWS_BASE_IMAGE="microsoft/windowsservercore"
665 665
         }
666
+        if ($null -eq $env:WINDOWS_BASE_IMAGE_TAG) {
667
+            $env:WINDOWS_BASE_IMAGE_TAG="latest"
668
+        }
666 669
 
667 670
         # Lowercase and make sure it has a microsoft/ prefix
668 671
         $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/"
672
+        if (! $($env:WINDOWS_BASE_IMAGE -Split "/")[0] -match "microsoft") {
673
+            Throw "ERROR: WINDOWS_BASE_IMAGE should start microsoft/ or mcr.microsoft.com/"
671 674
         }
672 675
 
673 676
         Write-Host -ForegroundColor Green "INFO: Base image for tests is $env:WINDOWS_BASE_IMAGE"
674 677
 
675 678
         $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) {
679
+        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) {
677 680
             # Try the internal azure CI image version or Microsoft internal corpnet where the base image is already pre-prepared on the disk,
678 681
             # either through Invoke-DockerCI or, in the case of Azure CI servers, baked into the VHD at the same location.
679 682
             if (Test-Path $("c:\baseimages\"+$($env:WINDOWS_BASE_IMAGE -Split "/")[1]+".tar")) {
... ...
@@ -686,18 +706,20 @@ Try {
686 686
                 }
687 687
                 Write-Host -ForegroundColor Green "INFO: docker load of"$($env:WINDOWS_BASE_IMAGE -Split "/")[1]" into daemon under test completed successfully"
688 688
             } 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...")
689
+                # We need to docker pull it instead. It will come in directly as microsoft/imagename:tagname
690
+                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...")
691 691
                 $ErrorActionPreference = "SilentlyContinue"
692
-                & "$env:TEMP\binary\docker-$COMMITHASH" "-H=$($DASHH_CUT)" pull $($env:WINDOWS_BASE_IMAGE)
692
+                & "$env:TEMP\binary\docker-$COMMITHASH" "-H=$($DASHH_CUT)" pull "$($env:WINDOWS_BASE_IMAGE):$env:WINDOWS_BASE_IMAGE_TAG"
693 693
                 $ErrorActionPreference = "Stop"
694 694
                 if (-not $LastExitCode -eq 0) {
695
-                    Throw $("ERROR: Failed to docker pull "+$env:WINDOWS_BASE_IMAGE+":latest into daemon under test.")
695
+                    Throw $("ERROR: Failed to docker pull $($env:WINDOWS_BASE_IMAGE):$env:WINDOWS_BASE_IMAGE_TAG into daemon under test.")
696 696
                 }
697
-                Write-Host -ForegroundColor Green $("INFO: docker pull of "+$env:WINDOWS_BASE_IMAGE+":latest into daemon under test completed successfully")
697
+                Write-Host -ForegroundColor Green $("INFO: docker pull of $($env:WINDOWS_BASE_IMAGE):$env:WINDOWS_BASE_IMAGE_TAG into daemon under test completed successfully")
698
+                Write-Host -ForegroundColor Green $("INFO: Tagging $($env:WINDOWS_BASE_IMAGE):$env:WINDOWS_BASE_IMAGE_TAG as microsoft/$ControlDaemonBaseImage in daemon under test")
699
+                & "$env:TEMP\binary\docker-$COMMITHASH" "-H=$($DASHH_CUT)" tag "$($env:WINDOWS_BASE_IMAGE):$env:WINDOWS_BASE_IMAGE_TAG" microsoft/$ControlDaemonBaseImage
698 700
             }
699 701
         } else {
700
-            Write-Host -ForegroundColor Green "INFO: Image"$($env:WINDOWS_BASE_IMAGE+":latest")"is already loaded in the daemon under test"
702
+            Write-Host -ForegroundColor Green "INFO: Image $($env:WINDOWS_BASE_IMAGE):$env:WINDOWS_BASE_IMAGE_TAG is already loaded in the daemon under test"
701 703
         }
702 704
     
703 705
     
... ...
@@ -705,7 +727,7 @@ Try {
705 705
         $ErrorActionPreference = "SilentlyContinue"
706 706
         $dutimgVersion = $(&"$env:TEMP\binary\docker-$COMMITHASH" "-H=$($DASHH_CUT)" inspect  $($env:WINDOWS_BASE_IMAGE) --format "{{.OsVersion}}")
707 707
         $ErrorActionPreference = "Stop"
708
-        Write-Host -ForegroundColor Green $("INFO: Version of "+$env:WINDOWS_BASE_IMAGE+":latest is '"+$dutimgVersion+"'")
708
+        Write-Host -ForegroundColor Green $("INFO: Version of $($env:WINDOWS_BASE_IMAGE):$env:WINDOWS_BASE_IMAGE_TAG is '"+$dutimgVersion+"'")
709 709
     }
710 710
 
711 711
     # Run the validation tests unless SKIP_VALIDATION_TESTS is defined.
... ...
@@ -752,14 +774,7 @@ Try {
752 752
             #if ($bbCount -eq 0) {
753 753
                 Write-Host -ForegroundColor Green "INFO: Building busybox"
754 754
                 $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
-                }
755
+                $(& "$env:TEMP\binary\docker-$COMMITHASH" "-H=$($DASHH_CUT)" build -t busybox https://raw.githubusercontent.com/jhowardmsft/busybox/v1.1/Dockerfile | Out-Host)
763 756
                 $ErrorActionPreference = "Stop"
764 757
                 if (-not($LastExitCode -eq 0)) {
765 758
                     Throw "ERROR: Failed to build busybox image"
... ...
@@ -1706,7 +1706,7 @@ func (s *DockerSuite) TestRunCleanupCmdOnEntrypoint(c *check.C) {
1706 1706
 	out = strings.TrimSpace(out)
1707 1707
 	expected := "root"
1708 1708
 	if testEnv.OSType == "windows" {
1709
-		if strings.Contains(testEnv.PlatformDefaults.BaseImage, "windowsservercore") {
1709
+		if strings.Contains(testEnv.PlatformDefaults.BaseImage, "servercore") {
1710 1710
 			expected = `user manager\containeradministrator`
1711 1711
 		} else {
1712 1712
 			expected = `ContainerAdministrator` // nanoserver