Browse code

Zap a fixed folder, add build number to folder inside

Signed-off-by: Stefan Scherer <stefan.scherer@docker.com>
(cherry picked from commit 48662075434da5a13b1316df1ac7488a81e4cf0a)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Stefan Scherer authored on 2019/09/12 21:53:33
Showing 2 changed files
... ...
@@ -743,7 +743,7 @@ pipeline {
743 743
                         SOURCES_DRIVE          = 'd'
744 744
                         SOURCES_SUBDIR         = 'gopath'
745 745
                         TESTRUN_DRIVE          = 'd'
746
-                        TESTRUN_SUBDIR         = "CI-$BUILD_NUMBER"
746
+                        TESTRUN_SUBDIR         = "CI"
747 747
                         WINDOWS_BASE_IMAGE     = 'mcr.microsoft.com/windows/servercore'
748 748
                         WINDOWS_BASE_IMAGE_TAG = 'ltsc2016'
749 749
                     }
... ...
@@ -804,7 +804,7 @@ pipeline {
804 804
                         SOURCES_DRIVE          = 'd'
805 805
                         SOURCES_SUBDIR         = 'gopath'
806 806
                         TESTRUN_DRIVE          = 'd'
807
-                        TESTRUN_SUBDIR         = "CI-$BUILD_NUMBER"
807
+                        TESTRUN_SUBDIR         = "CI"
808 808
                         WINDOWS_BASE_IMAGE     = 'mcr.microsoft.com/windows/servercore'
809 809
                         WINDOWS_BASE_IMAGE_TAG = 'ltsc2019'
810 810
                     }
... ...
@@ -51,6 +51,15 @@ Write-Host -ForegroundColor Red "-----------------------------------------------
51 51
 #                        TESTRUN_DRIVE\TESTRUN_SUBDIR\CI-<CommitID> or
52 52
 #                        d:\CI\CI-<CommitID>
53 53
 #
54
+# Optional environment variables help in CI:
55
+#
56
+#    BUILD_NUMBER + BRANCH_NAME   are optional variables to be added to the directory below TESTRUN_SUBDIR
57
+#                        to have individual folder per CI build. If some files couldn't be
58
+#                        cleaned up and we want to re-run the build in CI.
59
+#                        Hence, the daemon under test is run under
60
+#                        TESTRUN_DRIVE\TESTRUN_SUBDIR\PR-<PR-Number>\<BuildNumber> or
61
+#                        d:\CI\PR-<PR-Number>\<BuildNumber>
62
+#
54 63
 # In addition, the following variables can control the run configuration:
55 64
 #
56 65
 #    DOCKER_DUT_DEBUG         if defined starts the daemon under test in debug mode.
... ...
@@ -428,7 +437,12 @@ Try {
428 428
 
429 429
     # Redirect to a temporary location. 
430 430
     $TEMPORIG=$env:TEMP
431
-    $env:TEMP="$env:TESTRUN_DRIVE`:\$env:TESTRUN_SUBDIR\CI-$COMMITHASH"
431
+    if ($null -eq $env:BUILD_NUMBER) {
432
+      $env:TEMP="$env:TESTRUN_DRIVE`:\$env:TESTRUN_SUBDIR\CI-$COMMITHASH"
433
+    } else {
434
+      # individual temporary location per CI build that better matches the BUILD_URL
435
+      $env:TEMP="$env:TESTRUN_DRIVE`:\$env:TESTRUN_SUBDIR\$env:BRANCH_NAME\$env:BUILD_NUMBER"
436
+    }
432 437
     $env:LOCALAPPDATA="$env:TEMP\localappdata"
433 438
     $errorActionPreference='Stop'
434 439
     New-Item -ItemType Directory "$env:TEMP" -ErrorAction SilentlyContinue | Out-Null