Skip to content

Commit aefd381

Browse files
authored
Merge pull request #290 from crazy-max/v4_backport_buildx-version-support
[v4] mark buildx >= 0.20.0 as incompatible with docker/bake-action < v5
2 parents a99697d + 1a883d7 commit aefd381

4 files changed

Lines changed: 65 additions & 3 deletions

File tree

.github/workflows/ci.yml

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ on:
3232
- 'subaction/**'
3333

3434
env:
35-
BUILDX_VERSION: latest
35+
BUILDX_VERSION: v0.18.0
3636
BUILDKIT_IMAGE: moby/buildkit:buildx-stable-1
3737

3838
jobs:
@@ -82,6 +82,12 @@ jobs:
8282
-
8383
name: Checkout
8484
uses: actions/checkout@v4
85+
-
86+
name: Set up Docker Buildx
87+
uses: docker/setup-buildx-action@v3
88+
with:
89+
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
90+
driver: docker
8591
-
8692
name: Build
8793
continue-on-error: true
@@ -98,6 +104,12 @@ jobs:
98104
-
99105
name: Checkout
100106
uses: actions/checkout@v4
107+
-
108+
name: Set up Docker Buildx
109+
uses: docker/setup-buildx-action@v3
110+
with:
111+
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
112+
driver: docker
101113
-
102114
name: Stop docker
103115
run: |
@@ -153,6 +165,12 @@ jobs:
153165
-
154166
name: Checkout
155167
uses: actions/checkout@v4
168+
-
169+
name: Set up Docker Buildx
170+
uses: docker/setup-buildx-action@v3
171+
with:
172+
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
173+
driver: docker
156174
-
157175
name: Build
158176
uses: ./
@@ -270,6 +288,12 @@ jobs:
270288
-
271289
name: Checkout
272290
uses: actions/checkout@v4
291+
-
292+
name: Set up Docker Buildx
293+
uses: docker/setup-buildx-action@v3
294+
with:
295+
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
296+
driver: docker
273297
-
274298
name: Build
275299
uses: ./
@@ -315,6 +339,12 @@ jobs:
315339
-
316340
name: Checkout
317341
uses: actions/checkout@v4
342+
-
343+
name: Set up Docker Buildx
344+
uses: docker/setup-buildx-action@v3
345+
with:
346+
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
347+
driver: docker
318348
-
319349
name: Set malformed docker config
320350
run: |
@@ -522,3 +552,31 @@ jobs:
522552
name: Check docker
523553
run: |
524554
docker image inspect localhost:5000/name/app:latest
555+
556+
error-buildx-latest:
557+
runs-on: ubuntu-latest
558+
steps:
559+
-
560+
name: Checkout
561+
uses: actions/checkout@v4
562+
-
563+
name: Set up Docker Buildx
564+
uses: docker/setup-buildx-action@v3
565+
with:
566+
version: v0.20.0
567+
-
568+
name: Build
569+
id: bake
570+
continue-on-error: true
571+
uses: ./
572+
with:
573+
files: |
574+
./test/config.hcl
575+
-
576+
name: Check
577+
run: |
578+
echo "${{ toJson(steps.bake) }}"
579+
if [ "${{ steps.bake.outcome }}" != "failure" ] || [ "${{ steps.bake.conclusion }}" != "success" ]; then
580+
echo "::error::Should have failed"
581+
exit 1
582+
fi

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ actionsToolkit.run(
2020
async () => {
2121
const inputs: context.Inputs = await context.getInputs();
2222
const toolkit = new Toolkit();
23+
if (await toolkit.buildx.versionSatisfies('>=0.20.0')) {
24+
throw new Error('docker/bake-action < v5 is not compatible with buildx >= 0.20.0, please update your workflow to latest docker/bake-action or use an older buildx version.');
25+
}
26+
2327
const gitAuthToken = process.env.BUILDX_BAKE_GIT_AUTH_TOKEN ?? inputs['github-token'];
2428

2529
await core.group(`GitHub Actions runtime token ACs`, async () => {

0 commit comments

Comments
 (0)