Skip to content

Commit e4e5816

Browse files
committed
bake: distributed builds
Signed-off-by: CrazyMax <[email protected]>
1 parent 5e6edd2 commit e4e5816

File tree

2 files changed

+360
-28
lines changed

2 files changed

+360
-28
lines changed

.github/workflows/.test.yml

Lines changed: 89 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,18 @@ jobs:
223223
await exec.exec(cmd);
224224
}
225225
226+
build-local-single:
227+
uses: ./.github/workflows/build.yml
228+
permissions:
229+
contents: read
230+
packages: write
231+
id-token: write
232+
with:
233+
output: ${{ github.event_name != 'pull_request' && 'local' || 'cacheonly' }}
234+
artifact-name: build-output-single
235+
build-file: test/hello.Dockerfile
236+
build-sbom: true
237+
226238
bake-aws:
227239
uses: ./.github/workflows/bake.yml
228240
permissions:
@@ -279,6 +291,66 @@ jobs:
279291
await exec.exec(cmd);
280292
}
281293
294+
bake-ghcr-and-aws:
295+
uses: ./.github/workflows/bake.yml
296+
permissions:
297+
contents: read
298+
packages: write
299+
id-token: write
300+
with:
301+
context: test
302+
target: hello-cross
303+
output: ${{ github.event_name != 'pull_request' && 'registry' || 'cacheonly' }}
304+
cache: true
305+
cache-scope: bake-aws
306+
meta-images: |
307+
ghcr.io/docker/github-builder-test
308+
public.ecr.aws/q3b5f1u4/test-docker-action
309+
meta-tags: |
310+
type=raw,value=${{ github.run_id }},prefix=bake-ghcr-and-aws-
311+
bake-sbom: true
312+
secrets:
313+
registry-auths: |
314+
- registry: ghcr.io
315+
username: ${{ github.actor }}
316+
password: ${{ secrets.GITHUB_TOKEN }}
317+
- registry: public.ecr.aws
318+
username: ${{ secrets.AWS_ACCESS_KEY_ID }}
319+
password: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
320+
321+
bake-ghcr-and-aws-verify:
322+
runs-on: ubuntu-latest
323+
if: ${{ github.event_name != 'pull_request' }}
324+
needs:
325+
- bake-ghcr-and-aws
326+
steps:
327+
-
328+
name: Install Cosign
329+
uses: sigstore/cosign-installer@faadad0cce49287aee09b3a48701e75088a2c6ad # v4.0.0
330+
with:
331+
cosign-release: ${{ needs.bake-ghcr-and-aws.outputs.cosign-version }}
332+
-
333+
name: Login to registry
334+
uses: docker/login-action@v3
335+
with:
336+
registry: public.ecr.aws
337+
username: ${{ secrets.AWS_ACCESS_KEY_ID }}
338+
password: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
339+
-
340+
name: Verify signatures
341+
uses: actions/github-script@v8
342+
env:
343+
INPUT_COSIGN-VERSION: ${{ needs.bake-ghcr-and-aws.outputs.cosign-version }}
344+
INPUT_COSIGN-VERIFY-COMMANDS: ${{ needs.bake-ghcr-and-aws.outputs.cosign-verify-commands }}
345+
with:
346+
script: |
347+
const cosignVersion = core.getInput('cosign-version');
348+
core.info(`Cosign version used by Docker GitHub Builder: ${cosignVersion}`);
349+
const cosignVerifyCommands = core.getMultilineInput('cosign-verify-commands');
350+
for (const cmd of cosignVerifyCommands) {
351+
await exec.exec(cmd);
352+
}
353+
282354
bake-local:
283355
uses: ./.github/workflows/bake.yml
284356
permissions:
@@ -305,10 +377,11 @@ jobs:
305377
with:
306378
cosign-release: ${{ needs.bake-local.outputs.cosign-version }}
307379
-
308-
name: Download artifact
380+
name: Download artifacts
309381
uses: actions/download-artifact@v5
310382
with:
311-
name: ${{ needs.bake-local.outputs.artifact-name }}
383+
pattern: ${{ needs.bake-local.outputs.artifact-name }}*
384+
merge-multiple: true
312385
-
313386
name: Verify signatures
314387
uses: actions/github-script@v8
@@ -323,3 +396,17 @@ jobs:
323396
for (const cmd of cosignVerifyCommands) {
324397
await exec.exec(cmd);
325398
}
399+
400+
bake-local-single:
401+
uses: ./.github/workflows/bake.yml
402+
permissions:
403+
contents: read
404+
packages: write
405+
id-token: write
406+
with:
407+
context: test
408+
target: hello
409+
output: ${{ github.event_name != 'pull_request' && 'local' || 'cacheonly' }}
410+
cache: true
411+
artifact-name: bake-output-single
412+
bake-sbom: true

0 commit comments

Comments
 (0)