Skip to content

Commit 8e1d546

Browse files
authored
Merge pull request #494 from crazy-max/bake-v6
update bake-action to v6
2 parents 906ecf0 + 2af3007 commit 8e1d546

File tree

5 files changed

+46
-58
lines changed

5 files changed

+46
-58
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -392,12 +392,12 @@ jobs:
392392
type=sha
393393
-
394394
name: Build
395-
uses: docker/bake-action@v5
395+
uses: docker/bake-action@v6
396396
with:
397397
files: |
398398
./test/docker-bake.hcl
399-
${{ steps.docker_meta.outputs.bake-file-tags }}
400-
${{ steps.docker_meta.outputs.bake-file-labels }}
399+
cwd://${{ steps.docker_meta.outputs.bake-file-tags }}
400+
cwd://${{ steps.docker_meta.outputs.bake-file-labels }}
401401
targets: |
402402
release
403403
@@ -504,12 +504,12 @@ jobs:
504504
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index
505505
-
506506
name: Build
507-
uses: docker/bake-action@v5
507+
uses: docker/bake-action@v6
508508
with:
509509
files: |
510510
./test/docker-bake.hcl
511-
${{ steps.docker_meta.outputs.bake-file-tags }}
512-
${{ steps.docker_meta.outputs.bake-file-annotations }}
511+
cwd://${{ steps.docker_meta.outputs.bake-file-tags }}
512+
cwd://${{ steps.docker_meta.outputs.bake-file-annotations }}
513513
targets: |
514514
release
515515
@@ -539,7 +539,7 @@ jobs:
539539
name: Print envs
540540
run: env|sort
541541

542-
bake-cwd:
542+
bake-path-context:
543543
runs-on: ubuntu-latest
544544
steps:
545545
-
@@ -556,13 +556,13 @@ jobs:
556556
uses: ./
557557
-
558558
name: Build
559-
uses: docker/bake-action@v5
559+
uses: docker/bake-action@v6
560560
with:
561-
source: "{{defaultContext}}"
561+
source: .
562562
files: |
563563
./test/docker-bake.hcl
564-
cwd://${{ steps.docker_meta.outputs.bake-file-tags }}
565-
cwd://${{ steps.docker_meta.outputs.bake-file-labels }}
564+
${{ steps.docker_meta.outputs.bake-file-tags }}
565+
${{ steps.docker_meta.outputs.bake-file-labels }}
566566
targets: |
567567
release
568568

.github/workflows/test.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,9 @@ jobs:
1515
test:
1616
runs-on: ubuntu-latest
1717
steps:
18-
-
19-
name: Checkout
20-
uses: actions/checkout@v4
2118
-
2219
name: Test
23-
uses: docker/bake-action@v5
20+
uses: docker/bake-action@v6
2421
with:
2522
targets: test
2623
-

.github/workflows/validate.yml

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,17 @@ jobs:
1515
prepare:
1616
runs-on: ubuntu-latest
1717
outputs:
18-
targets: ${{ steps.targets.outputs.matrix }}
18+
targets: ${{ steps.generate.outputs.targets }}
1919
steps:
2020
-
2121
name: Checkout
2222
uses: actions/checkout@v4
2323
-
24-
name: Targets matrix
25-
id: targets
26-
run: |
27-
echo "matrix=$(docker buildx bake validate --print | jq -cr '.group.validate.targets')" >> $GITHUB_OUTPUT
24+
name: List targets
25+
id: generate
26+
uses: docker/bake-action/subaction/list-targets@v6
27+
with:
28+
target: validate
2829

2930
validate:
3031
runs-on: ubuntu-latest
@@ -35,11 +36,8 @@ jobs:
3536
matrix:
3637
target: ${{ fromJson(needs.prepare.outputs.targets) }}
3738
steps:
38-
-
39-
name: Checkout
40-
uses: actions/checkout@v4
4139
-
4240
name: Validate
43-
uses: docker/bake-action@v5
41+
uses: docker/bake-action@v6
4442
with:
4543
targets: ${{ matrix.target }}

README.md

Lines changed: 14 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ jobs:
9292
password: ${{ secrets.DOCKERHUB_TOKEN }}
9393
-
9494
name: Build and push
95-
uses: docker/build-push-action@v5
95+
uses: docker/build-push-action@v6
9696
with:
9797
context: .
9898
push: ${{ github.event_name != 'pull_request' }}
@@ -152,7 +152,7 @@ jobs:
152152
password: ${{ secrets.DOCKERHUB_TOKEN }}
153153
-
154154
name: Build and push
155-
uses: docker/build-push-action@v5
155+
uses: docker/build-push-action@v6
156156
with:
157157
context: .
158158
push: ${{ github.event_name != 'pull_request' }}
@@ -206,9 +206,6 @@ jobs:
206206
docker:
207207
runs-on: ubuntu-latest
208208
steps:
209-
-
210-
name: Checkout
211-
uses: actions/checkout@v4
212209
-
213210
name: Docker meta
214211
id: meta
@@ -224,11 +221,11 @@ jobs:
224221
type=sha
225222
-
226223
name: Build
227-
uses: docker/bake-action@v5
224+
uses: docker/bake-action@v6
228225
with:
229226
files: |
230227
./docker-bake.hcl
231-
${{ steps.meta.outputs.bake-file }}
228+
cwd://${{ steps.meta.outputs.bake-file }}
232229
targets: build
233230
```
234231

@@ -271,29 +268,12 @@ similar to the previous one:
271268
```yaml
272269
-
273270
name: Build
274-
uses: docker/bake-action@v5
271+
uses: docker/bake-action@v6
275272
with:
276273
files: |
277274
./docker-bake.hcl
278-
${{ steps.meta.outputs.bake-file-tags }}
279-
${{ steps.meta.outputs.bake-file-labels }}
280-
targets: build
281-
```
282-
283-
If you're building a [remote Bake definition](https://docs.docker.com/build/bake/remote-definition/)
284-
using a [Git context](https://github.com/docker/bake-action?tab=readme-ov-file#git-context),
285-
you must specify the location of the metadata-only bake file using a `cwd://`
286-
prefix:
287-
288-
```yaml
289-
-
290-
name: Build
291-
uses: docker/bake-action@v5
292-
with:
293-
source: "${{ github.server_url }}/${{ github.repository }}.git#${{ github.ref }}"
294-
files: |
295-
./docker-bake.hcl
296-
cwd://${{ steps.meta.outputs.bake-file }}
275+
cwd://${{ steps.meta.outputs.bake-file-tags }}
276+
cwd://${{ steps.meta.outputs.bake-file-labels }}
297277
targets: build
298278
```
299279

@@ -353,7 +333,7 @@ Alternatively, each output is also exported as an environment variable:
353333
So it can be used with our [Docker Build Push action](https://github.com/docker/build-push-action/):
354334

355335
```yaml
356-
- uses: docker/build-push-action@v5
336+
- uses: docker/build-push-action@v6
357337
with:
358338
build-args: |
359339
DOCKER_METADATA_OUTPUT_JSON
@@ -945,7 +925,7 @@ that you can reuse them further in your workflow using the [`fromJSON` function]
945925
images: name/app
946926
-
947927
name: Build and push
948-
uses: docker/build-push-action@v5
928+
uses: docker/build-push-action@v6
949929
with:
950930
tags: ${{ steps.meta.outputs.tags }}
951931
labels: ${{ steps.meta.outputs.labels }}
@@ -992,7 +972,7 @@ of the `metadata-action`:
992972
images: name/app
993973
-
994974
name: Build and push
995-
uses: docker/build-push-action@v5
975+
uses: docker/build-push-action@v6
996976
with:
997977
tags: ${{ steps.meta.outputs.tags }}
998978
annotations: ${{ steps.meta.outputs.annotations }}
@@ -1008,12 +988,12 @@ The same can be done with the [`bake-action`](https://github.com/docker/bake-act
1008988
images: name/app
1009989
-
1010990
name: Build
1011-
uses: docker/bake-action@v5
991+
uses: docker/bake-action@v6
1012992
with:
1013993
files: |
1014994
./docker-bake.hcl
1015-
${{ steps.meta.outputs.bake-file-tags }}
1016-
${{ steps.meta.outputs.bake-file-annotations }}
995+
cwd://${{ steps.meta.outputs.bake-file-tags }}
996+
cwd://${{ steps.meta.outputs.bake-file-annotations }}
1017997
targets: build
1018998
```
1019999

@@ -1039,7 +1019,7 @@ Please consult the documentation of your registry.
10391019
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index
10401020
-
10411021
name: Build and push
1042-
uses: docker/build-push-action@v5
1022+
uses: docker/build-push-action@v6
10431023
with:
10441024
tags: ${{ steps.meta.outputs.tags }}
10451025
annotations: ${{ steps.meta.outputs.annotations }}

docker-bake.hcl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
target "_common" {
2+
args = {
3+
BUILDKIT_CONTEXT_KEEP_GIT_DIR = 1
4+
}
5+
}
6+
17
group "default" {
28
targets = ["build"]
39
}
@@ -11,42 +17,49 @@ group "validate" {
1117
}
1218

1319
target "build" {
20+
inherits = ["_common"]
1421
dockerfile = "dev.Dockerfile"
1522
target = "build-update"
1623
output = ["."]
1724
}
1825

1926
target "build-validate" {
27+
inherits = ["_common"]
2028
dockerfile = "dev.Dockerfile"
2129
target = "build-validate"
2230
output = ["type=cacheonly"]
2331
}
2432

2533
target "format" {
34+
inherits = ["_common"]
2635
dockerfile = "dev.Dockerfile"
2736
target = "format-update"
2837
output = ["."]
2938
}
3039

3140
target "lint" {
41+
inherits = ["_common"]
3242
dockerfile = "dev.Dockerfile"
3343
target = "lint"
3444
output = ["type=cacheonly"]
3545
}
3646

3747
target "vendor" {
48+
inherits = ["_common"]
3849
dockerfile = "dev.Dockerfile"
3950
target = "vendor-update"
4051
output = ["."]
4152
}
4253

4354
target "vendor-validate" {
55+
inherits = ["_common"]
4456
dockerfile = "dev.Dockerfile"
4557
target = "vendor-validate"
4658
output = ["type=cacheonly"]
4759
}
4860

4961
target "test" {
62+
inherits = ["_common"]
5063
dockerfile = "dev.Dockerfile"
5164
target = "test-coverage"
5265
output = ["./coverage"]

0 commit comments

Comments
 (0)