Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/workflows/.test-bake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -408,3 +408,42 @@ jobs:
output: local
sbom: true
target: hello-cross

bake-aws-nodistrib:
uses: ./.github/workflows/bake.yml
permissions:
contents: read
id-token: write
with:
distribute: false
cache: true
cache-scope: bake-aws-nodistrib
context: test
output: image
push: ${{ github.event_name != 'pull_request' }}
sbom: true
target: hello-cross
meta-images: |
public.ecr.aws/q3b5f1u4/test-docker-action
meta-tags: |
type=raw,value=bake-ghbuilder-nodistrib-${{ github.run_id }}
secrets:
registry-auths: |
- registry: public.ecr.aws
username: ${{ secrets.AWS_ACCESS_KEY_ID }}
password: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

bake-local-nodistrib:
uses: ./.github/workflows/bake.yml
permissions:
contents: read
id-token: write
with:
distribute: false
artifact-name: bake-nodistrib-output
artifact-upload: true
context: test
output: local
sbom: true
sign: ${{ github.event_name != 'pull_request' }}
target: hello-cross
39 changes: 39 additions & 0 deletions .github/workflows/.test-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -503,3 +503,42 @@ jobs:
output: local
platforms: linux/amd64,linux/arm64
sbom: true

build-aws-nodistrib:
uses: ./.github/workflows/build.yml
permissions:
contents: read
id-token: write
with:
distribute: false
cache: true
cache-scope: build-aws-nodistrib
file: test/hello.Dockerfile
output: image
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
sbom: true
meta-images: |
public.ecr.aws/q3b5f1u4/test-docker-action
meta-tags: |
type=raw,value=build-ghbuilder-nodistrib-${{ github.run_id }}
secrets:
registry-auths: |
- registry: public.ecr.aws
username: ${{ secrets.AWS_ACCESS_KEY_ID }}
password: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

build-local-nodistrib:
uses: ./.github/workflows/build.yml
permissions:
contents: read
id-token: write
with:
distribute: false
artifact-name: build-nodistrib-output
artifact-upload: true
file: test/hello.Dockerfile
output: local
platforms: linux/amd64,linux/arm64
sbom: true
sign: ${{ github.event_name != 'pull_request' }}
11 changes: 9 additions & 2 deletions .github/workflows/bake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ on:
description: "Ubuntu GitHub Hosted Runner to build on (one of auto, amd64, arm64). The auto runner selects the best-matching runner based on target platforms. You can set it to amd64 if your build doesn't require emulation (e.g. cross-compilation)"
required: false
default: 'auto'
distribute:
type: boolean
description: "Whether to distribute the build across multiple runners (one platform per runner)"
required: false
default: true
setup-qemu:
type: boolean
description: "Runs the setup-qemu-action step to install QEMU static binaries"
Expand Down Expand Up @@ -174,6 +179,7 @@ jobs:
INPUT_MATRIX-SIZE-LIMIT: ${{ env.MATRIX_SIZE_LIMIT }}
INPUT_ACTIONS-ID-TOKEN-SET: ${{ env.ACTIONS_ID_TOKEN_REQUEST_TOKEN != '' && env.ACTIONS_ID_TOKEN_REQUEST_URL != '' }}
INPUT_RUNNER: ${{ inputs.runner }}
INPUT_DISTRIBUTE: ${{ inputs.distribute }}
INPUT_ARTIFACT-UPLOAD: ${{ inputs.artifact-upload }}
INPUT_CONTEXT: ${{ inputs.context }}
INPUT_FILES: ${{ inputs.files }}
Expand All @@ -196,6 +202,7 @@ jobs:
const inpActionsIdTokenSet = core.getBooleanInput('actions-id-token-set');

const inpRunner = core.getInput('runner');
const inpDistribute = core.getBooleanInput('distribute');
const inpArtifactUpload = core.getBooleanInput('artifact-upload');
const inpContext = core.getInput('context');
const inpFiles = Util.getInputList('files');
Expand Down Expand Up @@ -265,7 +272,7 @@ jobs:
}

const platforms = def.target[target].platforms || [];
if (platforms.length > inpMatrixSizeLimit) {
if (inpDistribute && platforms.length > inpMatrixSizeLimit) {
core.setFailed(`Platforms to build exceed matrix size limit of ${inpMatrixSizeLimit}`);
return;
}
Expand All @@ -278,7 +285,7 @@ jobs:

await core.group(`Set includes output`, async () => {
let includes = [];
if (platforms.length === 0) {
if (!inpDistribute || platforms.length === 0) {
includes.push({
index: 0,
runner: runner === 'auto' ? 'ubuntu-24.04' : runner
Expand Down
17 changes: 15 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ on:
description: "Ubuntu GitHub Hosted Runner to build on (one of auto, amd64, arm64). The auto runner selects the best-matching runner based on target platforms. You can set it to amd64 if your build doesn't require emulation (e.g. cross-compilation)"
required: false
default: 'auto'
distribute:
type: boolean
description: "Whether to distribute the build across multiple runners (one platform per runner)"
required: false
default: true
setup-qemu:
type: boolean
description: "Runs the setup-qemu-action step to install QEMU static binaries"
Expand Down Expand Up @@ -181,6 +186,7 @@ jobs:
INPUT_MATRIX-SIZE-LIMIT: ${{ env.MATRIX_SIZE_LIMIT }}
INPUT_ACTIONS-ID-TOKEN-SET: ${{ env.ACTIONS_ID_TOKEN_REQUEST_TOKEN != '' && env.ACTIONS_ID_TOKEN_REQUEST_URL != '' }}
INPUT_RUNNER: ${{ inputs.runner }}
INPUT_DISTRIBUTE: ${{ inputs.distribute }}
INPUT_ARTIFACT-UPLOAD: ${{ inputs.artifact-upload }}
INPUT_OUTPUT: ${{ inputs.output }}
INPUT_PLATFORMS: ${{ inputs.platforms }}
Expand All @@ -195,6 +201,7 @@ jobs:
const inpActionsIdTokenSet = core.getBooleanInput('actions-id-token-set');

const inpRunner = core.getInput('runner');
const inpDistribute = core.getBooleanInput('distribute');
const inpArtifactUpload = core.getBooleanInput('artifact-upload');
const inpPlatforms = Util.getInputList('platforms');
const inpOutput = core.getInput('output');
Expand Down Expand Up @@ -226,7 +233,7 @@ jobs:
return;
}

if (inpPlatforms.length > inpMatrixSizeLimit) {
if (inpDistribute && inpPlatforms.length > inpMatrixSizeLimit) {
core.setFailed(`Platforms to build exceed matrix size limit of ${inpMatrixSizeLimit}`);
return;
}
Expand All @@ -239,7 +246,7 @@ jobs:

await core.group(`Set includes output`, async () => {
let includes = [];
if (inpPlatforms.length === 0) {
if (!inpDistribute || inpPlatforms.length === 0) {
includes.push({
index: 0,
runner: runner === 'auto' ? 'ubuntu-24.04' : runner
Expand Down Expand Up @@ -438,13 +445,15 @@ jobs:
INPUT_PLATFORM: ${{ matrix.platform }}
INPUT_SBOM-IMAGE: ${{ env.SBOM_IMAGE }}
INPUT_LOCAL-EXPORT-DIR: ${{ env.LOCAL_EXPORT_DIR }}
INPUT_DISTRIBUTE: ${{ inputs.distribute }}
INPUT_ANNOTATIONS: ${{ inputs.annotations }}
INPUT_CACHE: ${{ inputs.cache }}
INPUT_CACHE-SCOPE: ${{ inputs.cache-scope }}
INPUT_CACHE-MODE: ${{ inputs.cache-mode }}
INPUT_LABELS: ${{ inputs.labels }}
INPUT_CONTEXT: ${{ inputs.context }}
INPUT_OUTPUT: ${{ inputs.output }}
INPUT_PLATFORMS: ${{ inputs.platforms }}
INPUT_PUSH: ${{ inputs.push }}
INPUT_SBOM: ${{ inputs.sbom }}
INPUT_TARGET: ${{ inputs.target }}
Expand All @@ -463,6 +472,7 @@ jobs:

const inpSbomImage = core.getInput('sbom-image');
const inpLocalExportDir = core.getInput('local-export-dir');
const inpDistribute = core.getBooleanInput('distribute');

const inpAnnotations = core.getMultilineInput('annotations');
const inpCache = core.getBooleanInput('cache');
Expand All @@ -471,6 +481,7 @@ jobs:
const inpContext = core.getInput('context');
const inpLabels = core.getMultilineInput('labels');
const inpOutput = core.getInput('output');
const inpPlatforms = core.getInput('platforms');
const inpPush = core.getBooleanInput('push');
const inpSbom = core.getBooleanInput('sbom');
const inpTarget = core.getInput('target');
Expand Down Expand Up @@ -502,6 +513,8 @@ jobs:

if (inpPlatform) {
core.setOutput('platform', inpPlatform);
} else if (!inpDistribute && inpPlatforms) {
core.setOutput('platform', inpPlatforms);
}

core.setOutput('sbom', inpSbom ? `generator=${inpSbomImage}` : 'false');
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ on:
| Name | Type | Default | Description |
|------------------------|----------|--------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `runner` | String | `auto` | [Ubuntu GitHub Hosted Runner](https://github.com/actions/runner-images?tab=readme-ov-file#available-images) to build on (one of `auto`, `amd64`, `arm64`). The `auto` runner selects the best-matching runner based on target `platforms`. You can set it to `amd64` if your build doesn't require emulation (e.g. cross-compilation) |
| `distribute` | Bool | `true` | Whether to distribute the build across multiple runners (one platform per runner) |
| `setup-qemu` | Bool | `false` | Runs the `setup-qemu-action` step to install QEMU static binaries |
| `artifact-name` | String | `docker-github-builder-assets` | Name of the uploaded GitHub artifact (for `local` output) |
| `artifact-upload` | Bool | `false` | Upload build output GitHub artifact (for `local` output) |
Expand Down Expand Up @@ -335,6 +336,7 @@ on:
| Name | Type | Default | Description |
|------------------------|--------|--------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `runner` | String | `auto` | [Ubuntu GitHub Hosted Runner](https://github.com/actions/runner-images?tab=readme-ov-file#available-images) to build on (one of `auto`, `amd64`, `arm64`). The `auto` runner selects the best-matching runner based on target `platforms`. You can set it to `amd64` if your build doesn't require emulation (e.g. cross-compilation) |
| `distribute` | Bool | `true` | Whether to distribute the build across multiple runners (one platform per runner) |
| `setup-qemu` | Bool | `false` | Runs the `setup-qemu-action` step to install QEMU static binaries |
| `artifact-name` | String | `docker-github-builder-assets` | Name of the uploaded GitHub artifact (for `local` output) |
| `artifact-upload` | Bool | `false` | Upload build output GitHub artifact (for `local` output) |
Expand Down
Loading