From 65fdd10d4e455c9ecb61fd2e607987046ae90f02 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Fri, 26 Aug 2022 04:09:48 +0200 Subject: [PATCH] ci(windows): move windows-2019 to another workflow Signed-off-by: CrazyMax --- .../workflows/{windows.yml => .windows.yml} | 93 +++++++------------ .github/workflows/windows-2019.yml | 17 ++++ .github/workflows/windows-2022.yml | 20 ++++ Dockerfile.windows | 2 +- contrib/busybox/Dockerfile | 2 +- integration-cli/docker_cli_pull_test.go | 2 +- 6 files changed, 74 insertions(+), 62 deletions(-) rename .github/workflows/{windows.yml => .windows.yml} (90%) create mode 100644 .github/workflows/windows-2019.yml create mode 100644 .github/workflows/windows-2022.yml diff --git a/.github/workflows/windows.yml b/.github/workflows/.windows.yml similarity index 90% rename from .github/workflows/windows.yml rename to .github/workflows/.windows.yml index 3297d2d29a..535bad17df 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/.windows.yml @@ -1,18 +1,16 @@ +# reusable workflow name: windows -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - on: - workflow_dispatch: - push: - branches: - - 'master' - - '[0-9]+.[0-9]{2}' - tags: - - 'v*' - pull_request: + workflow_call: + inputs: + os: + required: true + type: string + send_coverage: + required: false + type: boolean + default: false env: GO_VERSION: 1.18.5 @@ -24,16 +22,11 @@ env: TEST_IMAGE_NAME: moby:test TEST_CTN_NAME: moby DOCKER_BUILDKIT: 0 + ITG_CLI_MATRIX_SIZE: 6 jobs: build: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: - - windows-2019 - - windows-2022 + runs-on: ${{ inputs.os }} env: GOPATH: ${{ github.workspace }}\go GOBIN: ${{ github.workspace }}\go\bin @@ -56,9 +49,9 @@ jobs: run: | New-Item -ItemType "directory" -Path "${{ github.workspace }}\go-build" New-Item -ItemType "directory" -Path "${{ github.workspace }}\go\pkg\mod" - If ("${{ matrix.os }}" -eq "windows-2019") { + If ("${{ inputs.os }}" -eq "windows-2019") { echo "WINDOWS_BASE_IMAGE_TAG=${{ env.WINDOWS_BASE_TAG_2019 }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append - } ElseIf ("${{ matrix.os }}" -eq "windows-2022") { + } ElseIf ("${{ inputs.os }}" -eq "windows-2022") { echo "WINDOWS_BASE_IMAGE_TAG=${{ env.WINDOWS_BASE_TAG_2022 }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append } - @@ -70,9 +63,9 @@ jobs: ~\go\pkg\mod ${{ github.workspace }}\go-build ${{ env.GOPATH }}\pkg\mod - key: ${{ matrix.os }}-${{ github.job }}-${{ hashFiles('**/vendor.sum') }} + key: ${{ inputs.os }}-${{ github.job }}-${{ hashFiles('**/vendor.sum') }} restore-keys: | - ${{ matrix.os }}-${{ github.job }}- + ${{ inputs.os }}-${{ github.job }}- - name: Docker info run: | @@ -103,19 +96,13 @@ jobs: name: Upload artifacts uses: actions/upload-artifact@v3 with: - name: build-${{ matrix.os }} + name: build-${{ inputs.os }} path: ${{ env.BIN_OUT }}/* if-no-files-found: error retention-days: 2 unit-test: - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: - - windows-2019 - - windows-2022 + runs-on: ${{ inputs.os }} env: GOPATH: ${{ github.workspace }}\go GOBIN: ${{ github.workspace }}\go\bin @@ -138,9 +125,9 @@ jobs: New-Item -ItemType "directory" -Path "${{ github.workspace }}\go-build" New-Item -ItemType "directory" -Path "${{ github.workspace }}\go\pkg\mod" New-Item -ItemType "directory" -Path "bundles" - If ("${{ matrix.os }}" -eq "windows-2019") { + If ("${{ inputs.os }}" -eq "windows-2019") { echo "WINDOWS_BASE_IMAGE_TAG=${{ env.WINDOWS_BASE_TAG_2019 }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append - } ElseIf ("${{ matrix.os }}" -eq "windows-2022") { + } ElseIf ("${{ inputs.os }}" -eq "windows-2022") { echo "WINDOWS_BASE_IMAGE_TAG=${{ env.WINDOWS_BASE_TAG_2022 }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append } - @@ -152,9 +139,9 @@ jobs: ~\go\pkg\mod ${{ github.workspace }}\go-build ${{ env.GOPATH }}\pkg\mod - key: ${{ matrix.os }}-${{ github.job }}-${{ hashFiles('**/vendor.sum') }} + key: ${{ inputs.os }}-${{ github.job }}-${{ hashFiles('**/vendor.sum') }} restore-keys: | - ${{ matrix.os }}-${{ github.job }}- + ${{ inputs.os }}-${{ github.job }}- - name: Docker info run: | @@ -175,7 +162,7 @@ jobs: ${{ env.TEST_IMAGE_NAME }} hack\make.ps1 -TestUnit - name: Send to Codecov - if: matrix.os == 'windows-2022' + if: inputs.send_coverage uses: codecov/codecov-action@v3 with: working-directory: ${{ env.GOPATH }}\src\github.com\docker\docker @@ -187,7 +174,7 @@ jobs: if: always() uses: actions/upload-artifact@v3 with: - name: ${{ matrix.os }}-unit-reports + name: ${{ inputs.os }}-unit-reports path: ${{ env.GOPATH }}\src\github.com\docker\docker\bundles\* unit-test-report: @@ -195,12 +182,6 @@ jobs: if: always() needs: - unit-test - strategy: - fail-fast: false - matrix: - os: - - windows-2019 - - windows-2022 steps: - name: Set up Go @@ -211,7 +192,7 @@ jobs: name: Download artifacts uses: actions/download-artifact@v3 with: - name: ${{ matrix.os }}-unit-reports + name: ${{ inputs.os }}-unit-reports path: /tmp/artifacts - name: Install teststat @@ -246,7 +227,7 @@ jobs: run: | # Distribute integration-cli tests for the matrix in integration-test job. # Also prepend ./... to the matrix. This is a special case to run "Test integration" step exclusively. - matrix="$(gotestlist -d 4 ./...)" + matrix="$(gotestlist -d ${{ env.ITG_CLI_MATRIX_SIZE }} ./...)" matrix="$(echo "$matrix" | jq -c '. |= ["./..."] + .')" echo "::set-output name=matrix::$matrix" - @@ -255,16 +236,13 @@ jobs: echo ${{ steps.tests.outputs.matrix }} integration-test: - runs-on: ${{ matrix.os }} + runs-on: ${{ inputs.os }} needs: - build - integration-test-prepare strategy: fail-fast: false matrix: - os: - - windows-2019 - - windows-2022 runtime: - builtin - containerd @@ -290,15 +268,15 @@ jobs: name: Download artifacts uses: actions/download-artifact@v3 with: - name: build-${{ matrix.os }} + name: build-${{ inputs.os }} path: ${{ env.BIN_OUT }} - name: Init run: | New-Item -ItemType "directory" -Path "bundles" - If ("${{ matrix.os }}" -eq "windows-2019") { + If ("${{ inputs.os }}" -eq "windows-2019") { echo "WINDOWS_BASE_IMAGE_TAG=${{ env.WINDOWS_BASE_TAG_2019 }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append - } ElseIf ("${{ matrix.os }}" -eq "windows-2022") { + } ElseIf ("${{ inputs.os }}" -eq "windows-2022") { echo "WINDOWS_BASE_IMAGE_TAG=${{ env.WINDOWS_BASE_TAG_2022 }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append } Write-Output "${{ env.BIN_OUT }}" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append @@ -315,7 +293,7 @@ jobs: Stop-Service -Force -Name docker Remove-Service -Name docker # removes event log entry. we could use "Remove-EventLog -LogName -Source docker" - # but this cmd is only available since windows-2022 + # but this cmd is not available atm $ErrorActionPreference = "SilentlyContinue" & reg delete "HKLM\SYSTEM\CurrentControlSet\Services\EventLog\Application\docker" /f 2>&1 | Out-Null $ErrorActionPreference = "Stop" @@ -431,7 +409,7 @@ jobs: INTEGRATION_TESTRUN: ${{ matrix.test }} - name: Send to Codecov - if: matrix.os == 'windows-2022' + if: inputs.send_coverage uses: codecov/codecov-action@v3 with: working-directory: ${{ env.GOPATH }}\src\github.com\docker\docker @@ -480,7 +458,7 @@ jobs: if: always() uses: actions/upload-artifact@v3 with: - name: ${{ matrix.os }}-integration-reports-${{ matrix.runtime }} + name: ${{ inputs.os }}-integration-reports-${{ matrix.runtime }} path: ${{ env.GOPATH }}\src\github.com\docker\docker\bundles\* integration-test-report: @@ -491,9 +469,6 @@ jobs: strategy: fail-fast: false matrix: - os: - - windows-2019 - - windows-2022 runtime: - builtin - containerd @@ -507,7 +482,7 @@ jobs: name: Download artifacts uses: actions/download-artifact@v3 with: - name: ${{ matrix.os }}-integration-reports-${{ matrix.runtime }} + name: ${{ inputs.os }}-integration-reports-${{ matrix.runtime }} path: /tmp/artifacts - name: Install teststat diff --git a/.github/workflows/windows-2019.yml b/.github/workflows/windows-2019.yml new file mode 100644 index 0000000000..22100f69c5 --- /dev/null +++ b/.github/workflows/windows-2019.yml @@ -0,0 +1,17 @@ +name: windows-2019 + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +on: + schedule: + - cron: '0 10 * * *' + workflow_dispatch: + +jobs: + run: + uses: ./.github/workflows/.windows.yml + with: + os: windows-2019 + send_coverage: false diff --git a/.github/workflows/windows-2022.yml b/.github/workflows/windows-2022.yml new file mode 100644 index 0000000000..29545f11f8 --- /dev/null +++ b/.github/workflows/windows-2022.yml @@ -0,0 +1,20 @@ +name: windows-2022 + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +on: + workflow_dispatch: + push: + branches: + - 'master' + - '[0-9]+.[0-9]{2}' + pull_request: + +jobs: + run: + uses: ./.github/workflows/.windows.yml + with: + os: windows-2022 + send_coverage: true diff --git a/Dockerfile.windows b/Dockerfile.windows index 6490620880..12e0e1fc3f 100644 --- a/Dockerfile.windows +++ b/Dockerfile.windows @@ -155,7 +155,7 @@ # The number of build steps below are explicitly minimised to improve performance. # Extremely important - do not change the following line to reference a "specific" image, -# such as `mcr.microsoft.com/windows/servercore:ltsc2019`. If using this Dockerfile in process +# such as `mcr.microsoft.com/windows/servercore:ltsc2022`. If using this Dockerfile in process # isolated containers, the kernel of the host must match the container image, and hence # would fail between Windows Server 2016 (aka RS1) and Windows Server 2019 (aka RS5). # It is expected that the image `microsoft/windowsservercore:latest` is present, and matches diff --git a/contrib/busybox/Dockerfile b/contrib/busybox/Dockerfile index b2f40d53cd..b57c09a724 100644 --- a/contrib/busybox/Dockerfile +++ b/contrib/busybox/Dockerfile @@ -9,7 +9,7 @@ # To build: docker build -t busybox . # To publish: Needs someone with publishing rights ARG WINDOWS_BASE_IMAGE=mcr.microsoft.com/windows/servercore -ARG WINDOWS_BASE_IMAGE_TAG=ltsc2019 +ARG WINDOWS_BASE_IMAGE_TAG=ltsc2022 ARG BUSYBOX_VERSION=FRP-3329-gcf0fa4d13 # Checksum taken from https://frippery.org/files/busybox/SHA256SUM diff --git a/integration-cli/docker_cli_pull_test.go b/integration-cli/docker_cli_pull_test.go index 27af1f7eed..e6f193d0ef 100644 --- a/integration-cli/docker_cli_pull_test.go +++ b/integration-cli/docker_cli_pull_test.go @@ -284,6 +284,6 @@ func (s *DockerCLIPullSuite) TestPullLinuxImageFailsOnWindows(c *testing.T) { // Regression test for https://github.com/docker/docker/issues/28892 func (s *DockerCLIPullSuite) TestPullWindowsImageFailsOnLinux(c *testing.T) { testRequires(c, DaemonIsLinux, Network) - _, _, err := dockerCmdWithError("pull", "mcr.microsoft.com/windows/servercore:ltsc2019") + _, _, err := dockerCmdWithError("pull", "mcr.microsoft.com/windows/servercore:ltsc2022") assert.ErrorContains(c, err, "no matching manifest for linux") }