Skip to content

Commit

Permalink
Merge pull request #290 from crazy-max/v4_backport_buildx-version-sup…
Browse files Browse the repository at this point in the history
…port

[v4] mark buildx >= 0.20.0 as incompatible with docker/bake-action < v5
  • Loading branch information
crazy-max authored Jan 21, 2025
2 parents a99697d + 1a883d7 commit aefd381
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 3 deletions.
60 changes: 59 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ on:
- 'subaction/**'

env:
BUILDX_VERSION: latest
BUILDX_VERSION: v0.18.0
BUILDKIT_IMAGE: moby/buildkit:buildx-stable-1

jobs:
Expand Down Expand Up @@ -82,6 +82,12 @@ jobs:
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
driver: docker
-
name: Build
continue-on-error: true
Expand All @@ -98,6 +104,12 @@ jobs:
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
driver: docker
-
name: Stop docker
run: |
Expand Down Expand Up @@ -153,6 +165,12 @@ jobs:
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
driver: docker
-
name: Build
uses: ./
Expand Down Expand Up @@ -270,6 +288,12 @@ jobs:
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
driver: docker
-
name: Build
uses: ./
Expand Down Expand Up @@ -315,6 +339,12 @@ jobs:
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
driver: docker
-
name: Set malformed docker config
run: |
Expand Down Expand Up @@ -522,3 +552,31 @@ jobs:
name: Check docker
run: |
docker image inspect localhost:5000/name/app:latest
error-buildx-latest:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
version: v0.20.0
-
name: Build
id: bake
continue-on-error: true
uses: ./
with:
files: |
./test/config.hcl
-
name: Check
run: |
echo "${{ toJson(steps.bake) }}"
if [ "${{ steps.bake.outcome }}" != "failure" ] || [ "${{ steps.bake.conclusion }}" != "success" ]; then
echo "::error::Should have failed"
exit 1
fi
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ actionsToolkit.run(
async () => {
const inputs: context.Inputs = await context.getInputs();
const toolkit = new Toolkit();
if (await toolkit.buildx.versionSatisfies('>=0.20.0')) {
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.');
}

const gitAuthToken = process.env.BUILDX_BAKE_GIT_AUTH_TOKEN ?? inputs['github-token'];

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

0 comments on commit aefd381

Please sign in to comment.