Skip to content

Commit 268e1f3

Browse files
committed
bake: rename runner input to runs-on and defaults to empty
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
1 parent a98d2d3 commit 268e1f3

1 file changed

Lines changed: 17 additions & 15 deletions

File tree

.github/workflows/bake.yml

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@ name: bake
33
on:
44
workflow_call:
55
inputs:
6-
runner:
6+
runs-on:
77
type: string
8-
description: "Runner instance"
8+
description: "Type of machine to run the jobs on similar to jobs.<job_id>.runs-on"
99
required: false
10-
default: 'auto'
1110
context:
1211
type: string
1312
description: "Context to build from, defaults to repository root"
@@ -135,11 +134,12 @@ env:
135134
DOCKER_ACTIONS_TOOLKIT_MODULE: "@docker/actions-toolkit@0.67.0"
136135
COSIGN_VERSION: "v3.0.2"
137136
LOCAL_EXPORT_DIR: "/tmp/buildx-output"
138-
MATRIX_SIZE_LIMIT: 20
137+
DEFAULT_RUNNER: "ubuntu-latest"
138+
MATRIX_SIZE_LIMIT: "20"
139139

140140
jobs:
141141
prepare:
142-
runs-on: ${{ inputs.runner == 'auto' && 'ubuntu-latest' || inputs.runner }}
142+
runs-on: ${{ inputs.runs-on || env.DEFAULT_RUNNER }}
143143
outputs:
144144
includes: ${{ steps.set.outputs.includes }}
145145
steps:
@@ -169,7 +169,8 @@ jobs:
169169
uses: actions/github-script@v8
170170
env:
171171
INPUT_MATRIX-SIZE-LIMIT: ${{ env.MATRIX_SIZE_LIMIT }}
172-
INPUT_RUNNER: ${{ inputs.runner }}
172+
INPUT_DEFAULT-RUNNER: ${{ env.DEFAULT_RUNNER }}
173+
INPUT_RUNS-ON: ${{ inputs.runs-on || env.DEFAULT_RUNNER }}
173174
INPUT_CONTEXT: ${{ inputs.context }}
174175
INPUT_TARGET: ${{ inputs.target }}
175176
INPUT_BAKE-ALLOW: ${{ inputs.bake-allow }}
@@ -185,8 +186,9 @@ jobs:
185186
const { Util } = require('@docker/actions-toolkit/lib/util');
186187
187188
const inpMatrixSizeLimit = parseInt(core.getInput('matrix-size-limit'), 10);
188-
189-
const inpRunner = core.getInput('runner');
189+
const inpDefaultRunner = core.getInput('default-runner');
190+
191+
const inpRunsOn = core.getInput('runs-on');
190192
const inpContext = core.getInput('context');
191193
const inpTarget = core.getInput('target');
192194
const inpBakeAllow = core.getInput('bake-allow');
@@ -232,18 +234,18 @@ jobs:
232234
} else if (platforms.length === 0) {
233235
includes.push({
234236
index: 0,
235-
runner: inpRunner === 'auto' ? 'ubuntu-latest' : inpRunner
237+
runsOn: inpRunsOn
236238
});
237239
} else {
238240
platforms.forEach((platform, index) => {
239-
let runner = inpRunner;
240-
if (runner === 'auto') {
241-
runner = platform.startsWith('linux/arm') ? 'ubuntu-24.04-arm' : 'ubuntu-latest';
241+
let runsOn = inpRunsOn;
242+
if (!runsOn) {
243+
runsOn = platform.startsWith('linux/arm') ? 'ubuntu-24.04-arm' : inpDefaultRunner;
242244
}
243245
includes.push({
244246
index: index,
245247
platform: platform,
246-
runner: runner
248+
runs-on: runsOn
247249
});
248250
});
249251
}
@@ -252,7 +254,7 @@ jobs:
252254
});
253255
254256
build:
255-
runs-on: ${{ matrix.runner }}
257+
runs-on: ${{ matrix.runs-on }}
256258
needs:
257259
- prepare
258260
permissions:
@@ -626,7 +628,7 @@ jobs:
626628
core.setOutput(`result_${inpIndex}`, JSON.stringify(result));
627629
628630
post:
629-
runs-on: ubuntu-latest
631+
runs-on: ${{ inputs.runs-on || env.DEFAULT_RUNNER }}
630632
outputs:
631633
cosign-version: ${{ env.COSIGN_VERSION }}
632634
cosign-verify-commands: ${{ steps.set.outputs.cosign-verify-commands }}

0 commit comments

Comments
 (0)