Fix stress test failures on 1es-windows-2022-open (#83211)
authorAnton Firszov <antonfir@gmail.com>
Tue, 14 Mar 2023 15:18:57 +0000 (16:18 +0100)
committerGitHub <noreply@github.com>
Tue, 14 Mar 2023 15:18:57 +0000 (16:18 +0100)
eng/pipelines/libraries/stress/http.yml
eng/pipelines/libraries/stress/ssl.yml
src/libraries/System.Net.Security/tests/StressTests/SslStress/run-docker-compose.ps1

index 83037ad..6c740e4 100644 (file)
@@ -101,6 +101,12 @@ extends:
         timeoutInMinutes: 150
         variables:
           DUMPS_SHARE_MOUNT_ROOT: "C:/dumps-share"
+
+          # The 1es-windows-2022-open image has an issue where the Chocolatey-installed V1 docker-compose takes precendence over the
+          # V2 docker-compose required by the stress tests, see: https://github.com/actions/runner-images/issues/7080
+          # This is worked around by handpicking the V2 executable.
+          # The workaround should be removed when the official fix is propagated into 1es-windows-2022-open, or when we switch to another image.
+          DOCKER_COMPOSE_CMD: "C:/ProgramData/docker/cli-plugins/docker-compose.exe"
         pool:
           name: $(DncEngPublicBuildPool)
           demands: ImageOverride -equals 1es-windows-2022-open
@@ -138,7 +144,7 @@ extends:
             New-Item -Force $env:SERVER_DUMPS_SHARE -ItemType Directory
             $env:HTTPSTRESS_CLIENT_ARGS = "$env:HTTPSTRESS_CLIENT_ARGS -http 3.0"
             $env:HTTPSTRESS_SERVER_ARGS = "$env:HTTPSTRESS_SERVER_ARGS -http 3.0"
-            docker-compose up --abort-on-container-exit --no-color
+            & $env:DOCKER_COMPOSE_CMD up --abort-on-container-exit --no-color
           displayName: Run HttpStress - HTTP 3.0
           condition: and(eq(variables['buildRuntime.succeeded'], 'true'), eq(variables['buildStress.succeeded'], 'true'))
 
@@ -150,7 +156,7 @@ extends:
             New-Item -Force $env:SERVER_DUMPS_SHARE -ItemType Directory
             $env:HTTPSTRESS_CLIENT_ARGS = "$env:HTTPSTRESS_CLIENT_ARGS -http 2.0"
             $env:HTTPSTRESS_SERVER_ARGS = "$env:HTTPSTRESS_SERVER_ARGS -http 2.0"
-            docker-compose up --abort-on-container-exit --no-color
+            & $env:DOCKER_COMPOSE_CMD up --abort-on-container-exit --no-color
           displayName: Run HttpStress - HTTP 2.0
           condition: and(eq(variables['buildRuntime.succeeded'], 'true'), eq(variables['buildStress.succeeded'], 'true'))
 
@@ -162,7 +168,7 @@ extends:
             New-Item -Force $env:SERVER_DUMPS_SHARE -ItemType Directory
             $env:HTTPSTRESS_CLIENT_ARGS = "$env:HTTPSTRESS_CLIENT_ARGS -http 1.1"
             $env:HTTPSTRESS_SERVER_ARGS = "$env:HTTPSTRESS_SERVER_ARGS -http 1.1"
-            docker-compose up --abort-on-container-exit --no-color
+            & $env:DOCKER_COMPOSE_CMD up --abort-on-container-exit --no-color
           displayName: Run HttpStress - HTTP 1.1
           condition: and(eq(variables['buildRuntime.succeeded'], 'true'), eq(variables['buildStress.succeeded'], 'true'))
 
index 0cae225..7912510 100644 (file)
@@ -62,7 +62,12 @@ extends:
         pool:
           name: $(DncEngPublicBuildPool)
           demands: ImageOverride -equals 1es-windows-2022-open
-
+        variables:
+          # The 1es-windows-2022-open image has an issue where the Chocolatey-installed V1 docker-compose takes precendence over the
+          # V2 docker-compose required by the stress tests, see: https://github.com/actions/runner-images/issues/7080
+          # This is worked around by handpicking the V2 executable.
+          # The workaround should be removed when the official fix is propagated into 1es-windows-2022-open, or when we switch to another image.
+          DOCKER_COMPOSE_CMD: "C:/ProgramData/docker/cli-plugins/docker-compose.exe"
         steps:
         - checkout: self
           clean: true
@@ -79,5 +84,5 @@ extends:
 
         - powershell: |
             cd '$(sslStressProject)'
-            docker-compose up --abort-on-container-exit --no-color
+            & $env:DOCKER_COMPOSE_CMD up --abort-on-container-exit --no-color
           displayName: Run SslStress
index 9998119..e22e463 100755 (executable)
@@ -15,6 +15,13 @@ Param(
 $REPO_ROOT_DIR = $(git -C "$PSScriptRoot" rev-parse --show-toplevel)
 $COMPOSE_FILE = "$PSScriptRoot/docker-compose.yml"
 
+# This is a workaround for an issue with 1es-windows-2022-open, which should be eventually removed.
+# See comments in <repo>/eng/pipelines/libraries/stress/ssl.yml for more info.
+$dockerComposeCmd = $env:DOCKER_COMPOSE_CMD
+if (!(Test-Path $dockerComposeCmd)) {
+    $dockerComposeCmd = "docker-compose"
+}
+
 # Build runtime libraries and place in a docker image
 
 if ($buildCurrentLibraries)
@@ -50,7 +57,7 @@ if ($useWindowsContainers)
 $originalErrorPreference = $ErrorActionPreference
 $ErrorActionPreference = 'Continue'
 try {
-       docker-compose --log-level DEBUG --file "$COMPOSE_FILE" build $BUILD_ARGS.Split() 2>&1 | ForEach-Object { "$_" }
+       & $dockerComposeCmd --log-level DEBUG --file "$COMPOSE_FILE" build $BUILD_ARGS.Split() 2>&1 | ForEach-Object { "$_" }
        if ($LASTEXITCODE -ne 0) {
                throw "docker-compose exited with error code $LASTEXITCODE"
        }
@@ -65,5 +72,5 @@ if (!$buildOnly)
 {
     $env:SSLSTRESS_CLIENT_ARGS = $clientStressArgs
     $env:SSLSTRESS_SERVER_ARGS = $serverStressArgs
-    docker-compose --file "$COMPOSE_FILE" up --abort-on-container-exit
+    & $dockerComposeCmd --file "$COMPOSE_FILE" up --abort-on-container-exit
 }