From ff18b6bbaf322739fe98fd51b0d89d65a5775ab5 Mon Sep 17 00:00:00 2001 From: will Date: Wed, 10 Sep 2025 21:22:29 +0100 Subject: [PATCH] ci: refactor docker action to return provider str Avoid relying on future truthy evaluations of string 'false'. --- .github/actions/configure-docker/action.yml | 9 ++++++--- .github/workflows/ci.yml | 16 ++++++++-------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/.github/actions/configure-docker/action.yml b/.github/actions/configure-docker/action.yml index c78df86b6cf..09a1e6fd3af 100644 --- a/.github/actions/configure-docker/action.yml +++ b/.github/actions/configure-docker/action.yml @@ -1,9 +1,12 @@ name: 'Configure Docker' description: 'Set up Docker build driver and configure build cache args' inputs: - use-cirrus: - description: 'Use cirrus cache' + cache-provider: + description: 'gha or cirrus cache provider' required: true + options: + - gh + - cirrus runs: using: 'composite' steps: @@ -32,7 +35,7 @@ runs: # which are set automatically when running on GitHub infra: https://docs.docker.com/build/cache/backends/gha/#synopsis # Use cirrus cache host - if [[ ${{ inputs.use-cirrus }} == 'true' ]]; then + if [[ ${{ inputs.cache-provider }} == 'cirrus' ]]; then url_args="url=${CIRRUS_CACHE_HOST},url_v2=${CIRRUS_CACHE_HOST}" else url_args="" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 52d21ef3ab5..43beb53e88b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,15 +33,15 @@ jobs: name: 'determine runners' runs-on: ubuntu-latest outputs: - use-cirrus-runners: ${{ steps.runners.outputs.use-cirrus-runners }} + provider: ${{ steps.runners.outputs.provider }} steps: - id: runners run: | if [[ "${REPO_USE_CIRRUS_RUNNERS}" == "${{ github.repository }}" ]]; then - echo "use-cirrus-runners=true" >> "$GITHUB_OUTPUT" + echo "provider=cirrus" >> "$GITHUB_OUTPUT" echo "::notice title=Runner Selection::Using Cirrus Runners" else - echo "use-cirrus-runners=false" >> "$GITHUB_OUTPUT" + echo "provider=gha" >> "$GITHUB_OUTPUT" echo "::notice title=Runner Selection::Using GitHub-hosted runners" fi @@ -312,7 +312,7 @@ jobs: windows-cross: name: 'Linux->Windows cross, no tests' needs: runners - runs-on: ${{ needs.runners.outputs.use-cirrus-runners == 'true' && 'ghcr.io/cirruslabs/ubuntu-runner-amd64:24.04-sm' || 'ubuntu-24.04' }} + runs-on: ${{ needs.runners.outputs.provider == 'cirrus' && 'ghcr.io/cirruslabs/ubuntu-runner-amd64:24.04-sm' || 'ubuntu-24.04' }} if: ${{ vars.SKIP_BRANCH_PUSH != 'true' || github.event_name == 'pull_request' }} env: @@ -332,7 +332,7 @@ jobs: - name: Configure Docker uses: ./.github/actions/configure-docker with: - use-cirrus: ${{ needs.runners.outputs.use-cirrus-runners }} + cache-provider: ${{ needs.runners.outputs.provider }} - name: CI script run: ./ci/test_run_all.sh @@ -422,7 +422,7 @@ jobs: ci-matrix: name: ${{ matrix.name }} needs: runners - runs-on: ${{ needs.runners.outputs.use-cirrus-runners == 'true' && matrix.cirrus-runner || matrix.fallback-runner }} + runs-on: ${{ needs.runners.outputs.provider == 'cirrus' && matrix.cirrus-runner || matrix.fallback-runner }} if: ${{ vars.SKIP_BRANCH_PUSH != 'true' || github.event_name == 'pull_request' }} timeout-minutes: ${{ matrix.timeout-minutes }} @@ -513,7 +513,7 @@ jobs: - name: Configure Docker uses: ./.github/actions/configure-docker with: - use-cirrus: ${{ needs.runners.outputs.use-cirrus-runners }} + cache-provider: ${{ needs.runners.outputs.provider }} - name: Enable bpfcc script if: ${{ env.CONTAINER_NAME == 'ci_native_asan' }} @@ -550,7 +550,7 @@ jobs: - name: Configure Docker uses: ./.github/actions/configure-docker with: - use-cirrus: ${{ needs.runners.outputs.use-cirrus-runners }} + cache-provider: ${{ needs.runners.outputs.provider }} - name: CI script run: |