Skip to content

Commit 13e9e4e

Browse files
committed
ci: test bake reusable workflow
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
1 parent 1df786a commit 13e9e4e

File tree

2 files changed

+57
-69
lines changed

2 files changed

+57
-69
lines changed

.github/workflows/build.yml

Lines changed: 50 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -11,65 +11,48 @@ on:
1111
- main
1212
pull_request:
1313

14-
env:
15-
# Use edge release of buildx (latest RC, fallback to latest stable)
16-
SETUP_BUILDX_VERSION: edge
17-
SETUP_BUILDKIT_IMAGE: "moby/buildkit:latest"
18-
19-
permissions:
20-
contents: read # to fetch code (actions/checkout)
21-
2214
jobs:
2315
releaser:
24-
runs-on: ubuntu-24.04
25-
steps:
26-
-
27-
name: Set up Docker Buildx
28-
uses: docker/setup-buildx-action@v3
29-
with:
30-
version: ${{ env.SETUP_BUILDX_VERSION }}
31-
driver-opts: image=${{ env.SETUP_BUILDKIT_IMAGE }}
32-
-
33-
name: Build
34-
uses: docker/bake-action@v6
35-
with:
36-
files: |
37-
docker-bake.hcl
38-
targets: releaser-build
16+
uses: docker/github-builder-experimental/.github/workflows/bake.yml@main
17+
permissions:
18+
contents: read
19+
packages: write
20+
id-token: write
21+
with:
22+
output: local
23+
target: releaser-build
3924

4025
build:
41-
runs-on: ubuntu-24.04
42-
needs:
43-
- releaser
44-
steps:
45-
-
46-
name: Checkout
47-
uses: actions/checkout@v5
48-
-
49-
name: Set up Docker Buildx
50-
uses: docker/setup-buildx-action@v3
51-
-
52-
name: Build
53-
uses: docker/bake-action@v6
54-
with:
55-
source: .
56-
files: |
57-
docker-bake.hcl
58-
targets: release
59-
-
60-
name: Check Cloudfront config
61-
uses: docker/bake-action@v6
62-
with:
63-
source: .
64-
targets: aws-cloudfront-update
65-
env:
66-
DRY_RUN: true
67-
AWS_REGION: us-east-1
68-
AWS_CLOUDFRONT_ID: 0123456789ABCD
69-
AWS_LAMBDA_FUNCTION: DockerDocsRedirectFunction-dummy
26+
uses: docker/github-builder-experimental/.github/workflows/bake.yml@main
27+
permissions:
28+
contents: read
29+
packages: write
30+
id-token: write
31+
with:
32+
output: local
33+
target: release
34+
35+
check-cloudfront:
36+
uses: docker/github-builder-experimental/.github/workflows/bake.yml@main
37+
permissions:
38+
contents: read
39+
packages: write
40+
id-token: write
41+
with:
42+
output: local
43+
target: aws-cloudfront-update
44+
envs: |
45+
DRY_RUN: true
46+
AWS_REGION: us-east-1
47+
AWS_CLOUDFRONT_ID: 0123456789ABCD
48+
AWS_LAMBDA_FUNCTION: DockerDocsRedirectFunction-dummy
7049
7150
validate:
72-
runs-on: ubuntu-24.04
51+
uses: docker/github-builder-experimental/.github/workflows/bake.yml@main
52+
permissions:
53+
contents: read
54+
packages: write
55+
id-token: write
7356
strategy:
7457
fail-fast: false
7558
matrix:
@@ -82,29 +65,28 @@ jobs:
8265
- dockerfile-lint
8366
- path-warnings
8467
- validate-vendor
68+
with:
69+
output: local
70+
target: ${{ matrix.target }}
71+
artifact-name: ${{ matrix.target }}
72+
73+
reviewdog:
74+
runs-on: ubuntu-24.04
75+
needs: validate
76+
if: ${{ github.event_name == 'pull_request' }}
8577
steps:
8678
-
87-
name: Checkout
88-
uses: actions/checkout@v5
89-
-
90-
name: Set up Docker Buildx
91-
uses: docker/setup-buildx-action@v3
92-
-
93-
name: Validate
94-
uses: docker/bake-action@v6
79+
name: Download vale output
80+
uses: actions/download-artifact@v4
9581
with:
96-
source: .
97-
files: |
98-
docker-bake.hcl
99-
targets: ${{ matrix.target }}
82+
name: vale
83+
path: ./vale-output
10084
-
10185
name: Install reviewdog
102-
if: ${{ matrix.target == 'vale' && github.event_name == 'pull_request' }}
10386
uses: reviewdog/action-setup@d8a7baabd7f3e8544ee4dbde3ee41d0011c3a93f # v1.5.0
10487
-
10588
name: Run reviewdog for vale
106-
if: ${{ matrix.target == 'vale' && github.event_name == 'pull_request' }}
10789
run: |
108-
cat ./tmp/vale.out | reviewdog -f=rdjsonl -name=vale -reporter=github-pr-annotations -fail-on-error=false -filter-mode=added -level=info -fail-level=warning
90+
cat ./vale-output/vale.out | reviewdog -f=rdjsonl -name=vale -reporter=github-pr-annotations -fail-on-error=false -filter-mode=added -level=info -fail-level=warning
10991
env:
11092
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}

docker-bake.hcl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ target "release" {
3333
args = {
3434
HUGO_ENV = HUGO_ENV
3535
DOCS_URL = DOCS_URL
36+
BUILDKIT_CONTEXT_KEEP_GIT_DIR = 1
3637
}
3738
target = "release"
3839
output = [DOCS_SITE_DIR]
@@ -44,6 +45,7 @@ group "validate" {
4445
}
4546

4647
target "test" {
48+
args = { BUILDKIT_CONTEXT_KEEP_GIT_DIR = 1 }
4749
target = "test"
4850
output = ["type=cacheonly"]
4951
provenance = false
@@ -71,16 +73,19 @@ target "unused-media" {
7173
}
7274

7375
target "test-go-redirects" {
76+
args = { BUILDKIT_CONTEXT_KEEP_GIT_DIR = 1 }
7477
target = "test-go-redirects"
7578
output = ["type=cacheonly"]
7679
provenance = false
7780
}
7881

7982
target "dockerfile-lint" {
83+
args = { BUILDKIT_CONTEXT_KEEP_GIT_DIR = 1 }
8084
call = "check"
8185
}
8286

8387
target "path-warnings" {
88+
args = { BUILDKIT_CONTEXT_KEEP_GIT_DIR = 1 }
8489
target = "path-warnings"
8590
output = ["type=cacheonly"]
8691
}
@@ -143,7 +148,7 @@ target "aws-cloudfront-update" {
143148
context = "hack/releaser"
144149
target = "aws-cloudfront-update"
145150
contexts = {
146-
sitedir = DOCS_SITE_DIR
151+
sitedir = "target:release"
147152
}
148153
no-cache-filter = ["aws-cloudfront-update"]
149154
output = ["type=cacheonly"]
@@ -163,6 +168,7 @@ target "vendor" {
163168
}
164169

165170
target "validate-vendor" {
171+
args = { BUILDKIT_CONTEXT_KEEP_GIT_DIR = 1 }
166172
target = "validate-vendor"
167173
output = ["type=cacheonly"]
168174
}

0 commit comments

Comments
 (0)