Skip to content

Commit f79a6e1

Browse files
willcl-arkSjors
authored andcommitted
ci: refactor docker action to return provider str
Avoid relying on future truthy evaluations of string 'false'. Based on: bitcoin/bitcoin#33302 Minus Windows changes.
1 parent 31f9bbc commit f79a6e1

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
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: 6 additions & 6 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
@@ -183,7 +183,7 @@ jobs:
183183
ci-matrix:
184184
name: ${{ matrix.name }}
185185
needs: runners
186-
runs-on: ${{ needs.runners.outputs.use-cirrus-runners == 'true' && matrix.cirrus-runner || matrix.fallback-runner }}
186+
runs-on: ${{ needs.runners.outputs.provider == 'cirrus' && matrix.cirrus-runner || matrix.fallback-runner }}
187187
if: ${{ vars.SKIP_BRANCH_PUSH != 'true' || github.event_name == 'pull_request' }}
188188
timeout-minutes: ${{ matrix.timeout-minutes }}
189189

@@ -268,7 +268,7 @@ jobs:
268268
- name: Configure Docker
269269
uses: ./.github/actions/configure-docker
270270
with:
271-
use-cirrus: ${{ needs.runners.outputs.use-cirrus-runners }}
271+
cache-provider: ${{ needs.runners.outputs.provider }}
272272

273273
- name: Set mmap_rnd_bits
274274
if: ${{ env.CONTAINER_NAME == 'ci_native_tsan' || env.CONTAINER_NAME == 'ci_native_msan' }}
@@ -299,7 +299,7 @@ jobs:
299299
- name: Configure Docker
300300
uses: ./.github/actions/configure-docker
301301
with:
302-
use-cirrus: ${{ needs.runners.outputs.use-cirrus-runners }}
302+
cache-provider: ${{ needs.runners.outputs.provider }}
303303

304304
- name: CI script
305305
run: |

0 commit comments

Comments
 (0)