Skip to content

Commit 2378bbf

Browse files
willcl-arkfanquake
authored andcommitted
ci: refactor docker action to return provider str
Avoid relying on future truthy evaluations of string 'false'. Github-Pull: #33302 Rebased-From: ff18b6b
1 parent acf7d53 commit 2378bbf

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

.github/actions/configure-docker/action.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
name: 'Configure Docker'
22
description: 'Set up Docker build driver and configure build cache args'
33
inputs:
4-
use-cirrus:
5-
description: 'Use cirrus cache'
4+
cache-provider:
5+
description: 'gha or cirrus cache provider'
66
required: true
7+
options:
8+
- gh
9+
- cirrus
710
runs:
811
using: 'composite'
912
steps:
@@ -32,7 +35,7 @@ runs:
3235
# which are set automatically when running on GitHub infra: https://docs.docker.com/build/cache/backends/gha/#synopsis
3336
3437
# Use cirrus cache host
35-
if [[ ${{ inputs.use-cirrus }} == 'true' ]]; then
38+
if [[ ${{ inputs.cache-provider }} == 'cirrus' ]]; then
3639
url_args="url=${CIRRUS_CACHE_HOST},url_v2=${CIRRUS_CACHE_HOST}"
3740
else
3841
url_args=""

.github/workflows/ci.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ jobs:
3333
name: 'determine runners'
3434
runs-on: ubuntu-latest
3535
outputs:
36-
use-cirrus-runners: ${{ steps.runners.outputs.use-cirrus-runners }}
36+
provider: ${{ steps.runners.outputs.provider }}
3737
steps:
3838
- id: runners
3939
run: |
4040
if [[ "${REPO_USE_CIRRUS_RUNNERS}" == "${{ github.repository }}" ]]; then
41-
echo "use-cirrus-runners=true" >> "$GITHUB_OUTPUT"
41+
echo "provider=cirrus" >> "$GITHUB_OUTPUT"
4242
echo "::notice title=Runner Selection::Using Cirrus Runners"
4343
else
44-
echo "use-cirrus-runners=false" >> "$GITHUB_OUTPUT"
44+
echo "provider=gha" >> "$GITHUB_OUTPUT"
4545
echo "::notice title=Runner Selection::Using GitHub-hosted runners"
4646
fi
4747
@@ -312,7 +312,7 @@ jobs:
312312
windows-cross:
313313
name: 'Linux->Windows cross, no tests'
314314
needs: runners
315-
runs-on: ${{ needs.runners.outputs.use-cirrus-runners == 'true' && 'ghcr.io/cirruslabs/ubuntu-runner-amd64:24.04-sm' || 'ubuntu-24.04' }}
315+
runs-on: ${{ needs.runners.outputs.provider == 'cirrus' && 'ghcr.io/cirruslabs/ubuntu-runner-amd64:24.04-sm' || 'ubuntu-24.04' }}
316316
if: ${{ vars.SKIP_BRANCH_PUSH != 'true' || github.event_name == 'pull_request' }}
317317

318318
env:
@@ -332,7 +332,7 @@ jobs:
332332
- name: Configure Docker
333333
uses: ./.github/actions/configure-docker
334334
with:
335-
use-cirrus: ${{ needs.runners.outputs.use-cirrus-runners }}
335+
cache-provider: ${{ needs.runners.outputs.provider }}
336336

337337
- name: CI script
338338
run: ./ci/test_run_all.sh
@@ -422,7 +422,7 @@ jobs:
422422
ci-matrix:
423423
name: ${{ matrix.name }}
424424
needs: runners
425-
runs-on: ${{ needs.runners.outputs.use-cirrus-runners == 'true' && matrix.cirrus-runner || matrix.fallback-runner }}
425+
runs-on: ${{ needs.runners.outputs.provider == 'cirrus' && matrix.cirrus-runner || matrix.fallback-runner }}
426426
if: ${{ vars.SKIP_BRANCH_PUSH != 'true' || github.event_name == 'pull_request' }}
427427
timeout-minutes: ${{ matrix.timeout-minutes }}
428428

@@ -513,7 +513,7 @@ jobs:
513513
- name: Configure Docker
514514
uses: ./.github/actions/configure-docker
515515
with:
516-
use-cirrus: ${{ needs.runners.outputs.use-cirrus-runners }}
516+
cache-provider: ${{ needs.runners.outputs.provider }}
517517

518518
- name: Enable bpfcc script
519519
if: ${{ env.CONTAINER_NAME == 'ci_native_asan' }}
@@ -550,7 +550,7 @@ jobs:
550550
- name: Configure Docker
551551
uses: ./.github/actions/configure-docker
552552
with:
553-
use-cirrus: ${{ needs.runners.outputs.use-cirrus-runners }}
553+
cache-provider: ${{ needs.runners.outputs.provider }}
554554

555555
- name: CI script
556556
run: |

0 commit comments

Comments
 (0)