From 70892220c8597d354bbd1a3ce2b545d6e0c65af5 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Fri, 13 Oct 2023 16:40:13 +0200 Subject: [PATCH] ci: use matrix to test containerd backed image store Signed-off-by: CrazyMax --- .github/workflows/.test-prepare.yml | 35 +++++++++++++++++++++++++++++ .github/workflows/.test.yml | 3 ++- .github/workflows/.windows.yml | 11 +++++++++ .github/workflows/test.yml | 9 ++++++-- .github/workflows/windows-2019.yml | 10 ++++++--- .github/workflows/windows-2022.yml | 10 ++++++--- 6 files changed, 69 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/.test-prepare.yml diff --git a/.github/workflows/.test-prepare.yml b/.github/workflows/.test-prepare.yml new file mode 100644 index 0000000000..35852fa2ec --- /dev/null +++ b/.github/workflows/.test-prepare.yml @@ -0,0 +1,35 @@ +# reusable workflow +name: .test-prepare + +# TODO: hide reusable workflow from the UI. Tracked in https://github.com/community/community/discussions/12025 + +on: + workflow_call: + outputs: + matrix: + description: Test matrix + value: ${{ jobs.run.outputs.matrix }} + +jobs: + run: + runs-on: ubuntu-20.04 + outputs: + matrix: ${{ steps.set.outputs.matrix }} + steps: + - + name: Checkout + uses: actions/checkout@v3 + - + name: Create matrix + id: set + uses: actions/github-script@v6 + with: + script: | + let matrix = ['graphdriver']; + if ("${{ contains(github.event.pull_request.labels.*.name, 'containerd-integration') || github.event_name != 'pull_request' }}" == "true") { + matrix.push('snapshotter'); + } + await core.group(`Set matrix`, async () => { + core.info(`matrix: ${JSON.stringify(matrix)}`); + core.setOutput('matrix', JSON.stringify(matrix)); + }); diff --git a/.github/workflows/.test.yml b/.github/workflows/.test.yml index a29d501732..598994e789 100644 --- a/.github/workflows/.test.yml +++ b/.github/workflows/.test.yml @@ -17,7 +17,8 @@ env: TESTSTAT_VERSION: v0.1.3 ITG_CLI_MATRIX_SIZE: 6 DOCKER_EXPERIMENTAL: 1 - DOCKER_GRAPHDRIVER: overlay2 + DOCKER_GRAPHDRIVER: ${{ inputs.storage == 'snapshotter' && 'overlayfs' || 'overlay2' }} + TEST_INTEGRATION_USE_SNAPSHOTTER: ${{ inputs.storage == 'snapshotter' && '1' || '' }} jobs: unit: diff --git a/.github/workflows/.windows.yml b/.github/workflows/.windows.yml index b92e40438b..e8c5a03bc4 100644 --- a/.github/workflows/.windows.yml +++ b/.github/workflows/.windows.yml @@ -264,6 +264,9 @@ jobs: - builtin - containerd test: ${{ fromJson(needs.integration-test-prepare.outputs.matrix) }} + exclude: + - storage: snapshotter + runtime: builtin env: GOPATH: ${{ github.workspace }}\go GOBIN: ${{ github.workspace }}\go\bin @@ -354,6 +357,11 @@ jobs: "--exec-root=$env:TEMP\moby-exec", ` "--pidfile=$env:TEMP\docker.pid", ` "--register-service" + If ("${{ inputs.storage }}" -eq "snapshotter") { + # Make the env-var visible to the service-managed dockerd, as there's no CLI flag for this option. + & reg add "HKLM\SYSTEM\CurrentControlSet\Services\docker" /v Environment /t REG_MULTI_SZ /s '@' /d TEST_INTEGRATION_USE_SNAPSHOTTER=1 + echo "TEST_INTEGRATION_USE_SNAPSHOTTER=1" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append + } Write-Host "Starting service" Start-Service -Name docker Write-Host "Service started successfully!" @@ -491,6 +499,9 @@ jobs: runtime: - builtin - containerd + exclude: + - storage: snapshotter + runtime: builtin steps: - name: Set up Go diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 77c2b116b2..30e4fec721 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -54,15 +54,20 @@ jobs: *.cache-to=type=gha,scope=dev${{ matrix.mode }},mode=max *.output=type=cacheonly + test-prepare: + uses: ./.github/workflows/.test-prepare.yml + needs: + - validate-dco + test: needs: + - test-prepare - build-dev uses: ./.github/workflows/.test.yml strategy: fail-fast: false matrix: - storage: - - graphdriver + storage: ${{ fromJson(needs.test-prepare.outputs.matrix) }} with: storage: ${{ matrix.storage }} diff --git a/.github/workflows/windows-2019.yml b/.github/workflows/windows-2019.yml index ab6b76825c..9c07a72bcf 100644 --- a/.github/workflows/windows-2019.yml +++ b/.github/workflows/windows-2019.yml @@ -13,15 +13,19 @@ jobs: validate-dco: uses: ./.github/workflows/.dco.yml - run: + test-prepare: + uses: ./.github/workflows/.test-prepare.yml needs: - validate-dco + + run: + needs: + - test-prepare uses: ./.github/workflows/.windows.yml strategy: fail-fast: false matrix: - storage: - - graphdriver + storage: ${{ fromJson(needs.test-prepare.outputs.matrix) }} with: os: windows-2019 storage: ${{ matrix.storage }} diff --git a/.github/workflows/windows-2022.yml b/.github/workflows/windows-2022.yml index ea11bb7117..5c98db059e 100644 --- a/.github/workflows/windows-2022.yml +++ b/.github/workflows/windows-2022.yml @@ -16,15 +16,19 @@ jobs: validate-dco: uses: ./.github/workflows/.dco.yml - run: + test-prepare: + uses: ./.github/workflows/.test-prepare.yml needs: - validate-dco + + run: + needs: + - test-prepare uses: ./.github/workflows/.windows.yml strategy: fail-fast: false matrix: - storage: - - graphdriver + storage: ${{ fromJson(needs.test-prepare.outputs.matrix) }} with: os: windows-2022 storage: ${{ matrix.storage }}