mirror of
https://github.com/docker/build-push-action.git
synced 2025-03-28 14:56:21 +01:00
Merge pull request #1265 from crazy-max/call-check
Some checks are pending
ci / provenance (, type=image,name=localhost:5000/name/app:latest,push=true, image) (push) Waiting to run
ci / minimal (push) Waiting to run
ci / git-context (push) Waiting to run
ci / git-context-secret (push) Waiting to run
ci / path-context (push) Waiting to run
ci / example (push) Waiting to run
ci / error (push) Waiting to run
ci / error-buildx (push) Waiting to run
ci / docker-driver (push) Waiting to run
ci / export-docker (push) Waiting to run
ci / secret (push) Waiting to run
ci / secret-envs (push) Waiting to run
ci / network (push) Waiting to run
ci / shm-size (push) Waiting to run
ci / ulimit (push) Waiting to run
ci / cgroup-parent (push) Waiting to run
ci / add-hosts (push) Waiting to run
ci / no-cache-filters (push) Waiting to run
ci / attests-compat (moby/buildkit:buildx-stable-1, latest) (push) Waiting to run
ci / attests-compat (moby/buildkit:buildx-stable-1, v0.9.1) (push) Waiting to run
ci / attests-compat (moby/buildkit:v0.10.6, latest) (push) Waiting to run
ci / provenance (, /tmp/buildx-build, binary) (push) Waiting to run
ci / provenance (mode=max, /tmp/buildx-build, binary) (push) Waiting to run
ci / provenance (mode=max, type=image,name=localhost:5000/name/app:latest,push=true, image) (push) Waiting to run
ci / sbom (/tmp/buildx-build, binary) (push) Waiting to run
ci / sbom (type=image,name=localhost:5000/name/app:latest,push=true, image) (push) Waiting to run
ci / multi (multi) (push) Waiting to run
ci / multi (multi-sudo) (push) Waiting to run
ci / digest (docker, false, false) (push) Waiting to run
ci / digest (docker, false, true) (push) Waiting to run
ci / digest (docker, true, false) (push) Waiting to run
ci / digest (docker-container, false, false) (push) Waiting to run
ci / digest (docker-container, false, true) (push) Waiting to run
ci / digest (docker-container, true, false) (push) Waiting to run
ci / registry-cache (push) Waiting to run
ci / github-cache (push) Waiting to run
ci / local-cache (push) Waiting to run
ci / standalone (push) Waiting to run
ci / named-context-pin (push) Waiting to run
ci / named-context-docker (push) Waiting to run
ci / named-context-container (push) Waiting to run
ci / docker-config-malformed (push) Waiting to run
ci / proxy-docker-config (push) Waiting to run
ci / proxy-buildkitd (push) Waiting to run
ci / annotations (push) Waiting to run
ci / multi-output (push) Waiting to run
ci / load-and-push (push) Waiting to run
ci / summary-disable (push) Waiting to run
ci / summary-disable-deprecated (push) Waiting to run
ci / summary-not-supported (push) Waiting to run
ci / record-upload-disable (push) Waiting to run
ci / record-retention-days (0) (push) Waiting to run
ci / record-retention-days (2) (push) Waiting to run
ci / checks (latest) (push) Waiting to run
ci / checks (v0.14.1) (push) Waiting to run
ci / annotations-disabled (push) Waiting to run
ci / call-check (push) Waiting to run
e2e / build (GitLab, GITLAB_TOKEN, registry.gitlab.com, registry.gitlab.com/test1716/test, remote, GITLAB_USERNAME) (push) Waiting to run
e2e / build (AWS ECR Public, AWS_SECRET_ACCESS_KEY, public.ecr.aws, public.ecr.aws/q3b5f1u4/test-docker-action, remote, AWS_ACCESS_KEY_ID) (push) Waiting to run
e2e / build (AWS ECR, AWS_SECRET_ACCESS_KEY, 175142243308.dkr.ecr.us-east-2.amazonaws.com, 175142243308.dkr.ecr.us-east-2.amazonaws.com/sandbox/test-docker-action, remote, AWS_ACCESS_KEY_ID) (push) Waiting to run
e2e / build (Artifactory, ARTIFACTORY_TOKEN, infradock.jfrog.io, infradock.jfrog.io/test-ghaction/build-push-action, remote, ARTIFACTORY_USERNAME) (push) Waiting to run
e2e / build (Azure Container Registry, AZURE_CLIENT_SECRET, officialgithubactions.azurecr.io, officialgithubactions.azurecr.io/test-docker-action, remote, AZURE_CLIENT_ID) (push) Waiting to run
e2e / build (Docker Hub, DOCKERHUB_TOKEN, , ghactionstest/ghactionstest, remote, DOCKERHUB_USERNAME) (push) Waiting to run
e2e / build (GitHub, GHCR_PAT, ghcr.io, ghcr.io/docker-ghactiontest/test, remote, GHCR_USERNAME) (push) Waiting to run
e2e / build (Google Artifact Registry, GAR_JSON_KEY, us-east4-docker.pkg.dev, us-east4-docker.pkg.dev/sandbox-298914/docker-official-github-actions/test-docker-action, remote, GAR_USERNAME) (push) Waiting to run
e2e / build (Google Container Registry, GCR_JSON_KEY, gcr.io, gcr.io/sandbox-298914/test-docker-action, remote, GCR_USERNAME) (push) Waiting to run
e2e / build (Quay, QUAY_TOKEN, quay.io, quay.io/docker_build_team/ghactiontest, remote, QUAY_USERNAME) (push) Waiting to run
e2e / build (distribution, Distribution, local) (push) Waiting to run
e2e / build (nexus, Nexus, local) (push) Waiting to run
test / test (push) Waiting to run
validate / prepare (push) Waiting to run
validate / validate (push) Blocked by required conditions
e2e / build (harbor, Harbor, local) (push) Waiting to run
Some checks are pending
ci / provenance (, type=image,name=localhost:5000/name/app:latest,push=true, image) (push) Waiting to run
ci / minimal (push) Waiting to run
ci / git-context (push) Waiting to run
ci / git-context-secret (push) Waiting to run
ci / path-context (push) Waiting to run
ci / example (push) Waiting to run
ci / error (push) Waiting to run
ci / error-buildx (push) Waiting to run
ci / docker-driver (push) Waiting to run
ci / export-docker (push) Waiting to run
ci / secret (push) Waiting to run
ci / secret-envs (push) Waiting to run
ci / network (push) Waiting to run
ci / shm-size (push) Waiting to run
ci / ulimit (push) Waiting to run
ci / cgroup-parent (push) Waiting to run
ci / add-hosts (push) Waiting to run
ci / no-cache-filters (push) Waiting to run
ci / attests-compat (moby/buildkit:buildx-stable-1, latest) (push) Waiting to run
ci / attests-compat (moby/buildkit:buildx-stable-1, v0.9.1) (push) Waiting to run
ci / attests-compat (moby/buildkit:v0.10.6, latest) (push) Waiting to run
ci / provenance (, /tmp/buildx-build, binary) (push) Waiting to run
ci / provenance (mode=max, /tmp/buildx-build, binary) (push) Waiting to run
ci / provenance (mode=max, type=image,name=localhost:5000/name/app:latest,push=true, image) (push) Waiting to run
ci / sbom (/tmp/buildx-build, binary) (push) Waiting to run
ci / sbom (type=image,name=localhost:5000/name/app:latest,push=true, image) (push) Waiting to run
ci / multi (multi) (push) Waiting to run
ci / multi (multi-sudo) (push) Waiting to run
ci / digest (docker, false, false) (push) Waiting to run
ci / digest (docker, false, true) (push) Waiting to run
ci / digest (docker, true, false) (push) Waiting to run
ci / digest (docker-container, false, false) (push) Waiting to run
ci / digest (docker-container, false, true) (push) Waiting to run
ci / digest (docker-container, true, false) (push) Waiting to run
ci / registry-cache (push) Waiting to run
ci / github-cache (push) Waiting to run
ci / local-cache (push) Waiting to run
ci / standalone (push) Waiting to run
ci / named-context-pin (push) Waiting to run
ci / named-context-docker (push) Waiting to run
ci / named-context-container (push) Waiting to run
ci / docker-config-malformed (push) Waiting to run
ci / proxy-docker-config (push) Waiting to run
ci / proxy-buildkitd (push) Waiting to run
ci / annotations (push) Waiting to run
ci / multi-output (push) Waiting to run
ci / load-and-push (push) Waiting to run
ci / summary-disable (push) Waiting to run
ci / summary-disable-deprecated (push) Waiting to run
ci / summary-not-supported (push) Waiting to run
ci / record-upload-disable (push) Waiting to run
ci / record-retention-days (0) (push) Waiting to run
ci / record-retention-days (2) (push) Waiting to run
ci / checks (latest) (push) Waiting to run
ci / checks (v0.14.1) (push) Waiting to run
ci / annotations-disabled (push) Waiting to run
ci / call-check (push) Waiting to run
e2e / build (GitLab, GITLAB_TOKEN, registry.gitlab.com, registry.gitlab.com/test1716/test, remote, GITLAB_USERNAME) (push) Waiting to run
e2e / build (AWS ECR Public, AWS_SECRET_ACCESS_KEY, public.ecr.aws, public.ecr.aws/q3b5f1u4/test-docker-action, remote, AWS_ACCESS_KEY_ID) (push) Waiting to run
e2e / build (AWS ECR, AWS_SECRET_ACCESS_KEY, 175142243308.dkr.ecr.us-east-2.amazonaws.com, 175142243308.dkr.ecr.us-east-2.amazonaws.com/sandbox/test-docker-action, remote, AWS_ACCESS_KEY_ID) (push) Waiting to run
e2e / build (Artifactory, ARTIFACTORY_TOKEN, infradock.jfrog.io, infradock.jfrog.io/test-ghaction/build-push-action, remote, ARTIFACTORY_USERNAME) (push) Waiting to run
e2e / build (Azure Container Registry, AZURE_CLIENT_SECRET, officialgithubactions.azurecr.io, officialgithubactions.azurecr.io/test-docker-action, remote, AZURE_CLIENT_ID) (push) Waiting to run
e2e / build (Docker Hub, DOCKERHUB_TOKEN, , ghactionstest/ghactionstest, remote, DOCKERHUB_USERNAME) (push) Waiting to run
e2e / build (GitHub, GHCR_PAT, ghcr.io, ghcr.io/docker-ghactiontest/test, remote, GHCR_USERNAME) (push) Waiting to run
e2e / build (Google Artifact Registry, GAR_JSON_KEY, us-east4-docker.pkg.dev, us-east4-docker.pkg.dev/sandbox-298914/docker-official-github-actions/test-docker-action, remote, GAR_USERNAME) (push) Waiting to run
e2e / build (Google Container Registry, GCR_JSON_KEY, gcr.io, gcr.io/sandbox-298914/test-docker-action, remote, GCR_USERNAME) (push) Waiting to run
e2e / build (Quay, QUAY_TOKEN, quay.io, quay.io/docker_build_team/ghactiontest, remote, QUAY_USERNAME) (push) Waiting to run
e2e / build (distribution, Distribution, local) (push) Waiting to run
e2e / build (nexus, Nexus, local) (push) Waiting to run
test / test (push) Waiting to run
validate / prepare (push) Waiting to run
validate / validate (push) Blocked by required conditions
e2e / build (harbor, Harbor, local) (push) Waiting to run
call input to set method for evaluating build
This commit is contained in:
commit
0259cb088b
7 changed files with 54 additions and 6 deletions
32
.github/workflows/ci.yml
vendored
32
.github/workflows/ci.yml
vendored
|
@ -288,7 +288,6 @@ jobs:
|
||||||
-
|
-
|
||||||
name: Check
|
name: Check
|
||||||
run: |
|
run: |
|
||||||
echo "${{ toJson(steps.docker_build) }}"
|
|
||||||
if [ "${{ steps.docker_build.outcome }}" != "failure" ] || [ "${{ steps.docker_build.conclusion }}" != "success" ]; then
|
if [ "${{ steps.docker_build.outcome }}" != "failure" ] || [ "${{ steps.docker_build.conclusion }}" != "success" ]; then
|
||||||
echo "::error::Should have failed"
|
echo "::error::Should have failed"
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -324,7 +323,6 @@ jobs:
|
||||||
-
|
-
|
||||||
name: Check
|
name: Check
|
||||||
run: |
|
run: |
|
||||||
echo "${{ toJson(steps.docker_build) }}"
|
|
||||||
if [ "${{ steps.docker_build.outcome }}" != "failure" ] || [ "${{ steps.docker_build.conclusion }}" != "success" ]; then
|
if [ "${{ steps.docker_build.outcome }}" != "failure" ] || [ "${{ steps.docker_build.conclusion }}" != "success" ]; then
|
||||||
echo "::error::Should have failed"
|
echo "::error::Should have failed"
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -1511,3 +1509,33 @@ jobs:
|
||||||
file: ./test/lint.Dockerfile
|
file: ./test/lint.Dockerfile
|
||||||
env:
|
env:
|
||||||
DOCKER_BUILD_CHECKS_ANNOTATIONS: false
|
DOCKER_BUILD_CHECKS_ANNOTATIONS: false
|
||||||
|
|
||||||
|
call-check:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
-
|
||||||
|
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-opts: |
|
||||||
|
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
|
||||||
|
-
|
||||||
|
name: Build
|
||||||
|
id: docker_build
|
||||||
|
continue-on-error: true
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
context: ./test
|
||||||
|
file: ./test/lint.Dockerfile
|
||||||
|
call: check
|
||||||
|
-
|
||||||
|
name: Check
|
||||||
|
run: |
|
||||||
|
if [ "${{ steps.docker_build.outcome }}" != "failure" ] || [ "${{ steps.docker_build.conclusion }}" != "success" ]; then
|
||||||
|
echo "::error::Should have failed"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
|
@ -220,6 +220,7 @@ The following inputs can be used as `step.with` keys:
|
||||||
| `build-contexts` | List | List of additional [build contexts](https://docs.docker.com/engine/reference/commandline/buildx_build/#build-context) (e.g., `name=path`) |
|
| `build-contexts` | List | List of additional [build contexts](https://docs.docker.com/engine/reference/commandline/buildx_build/#build-context) (e.g., `name=path`) |
|
||||||
| `cache-from` | List | List of [external cache sources](https://docs.docker.com/engine/reference/commandline/buildx_build/#cache-from) (e.g., `type=local,src=path/to/dir`) |
|
| `cache-from` | List | List of [external cache sources](https://docs.docker.com/engine/reference/commandline/buildx_build/#cache-from) (e.g., `type=local,src=path/to/dir`) |
|
||||||
| `cache-to` | List | List of [cache export destinations](https://docs.docker.com/engine/reference/commandline/buildx_build/#cache-to) (e.g., `type=local,dest=path/to/dir`) |
|
| `cache-to` | List | List of [cache export destinations](https://docs.docker.com/engine/reference/commandline/buildx_build/#cache-to) (e.g., `type=local,dest=path/to/dir`) |
|
||||||
|
| `call` | String | Set [method for evaluating build](https://docs.docker.com/reference/cli/docker/buildx/build/#call) (e.g., `check`) |
|
||||||
| `cgroup-parent` | String | Optional [parent cgroup](https://docs.docker.com/engine/reference/commandline/build/#use-a-custom-parent-cgroup---cgroup-parent) for the container used in the build |
|
| `cgroup-parent` | String | Optional [parent cgroup](https://docs.docker.com/engine/reference/commandline/build/#use-a-custom-parent-cgroup---cgroup-parent) for the container used in the build |
|
||||||
| `context` | String | Build's context is the set of files located in the specified [`PATH` or `URL`](https://docs.docker.com/engine/reference/commandline/build/) (default [Git context](#git-context)) |
|
| `context` | String | Build's context is the set of files located in the specified [`PATH` or `URL`](https://docs.docker.com/engine/reference/commandline/build/) (default [Git context](#git-context)) |
|
||||||
| `file` | String | Path to the Dockerfile. (default `{context}/Dockerfile`) |
|
| `file` | String | Path to the Dockerfile. (default `{context}/Dockerfile`) |
|
||||||
|
|
|
@ -34,6 +34,9 @@ inputs:
|
||||||
cache-to:
|
cache-to:
|
||||||
description: "List of cache export destinations for buildx (e.g., user/app:cache, type=local,dest=path/to/dir)"
|
description: "List of cache export destinations for buildx (e.g., user/app:cache, type=local,dest=path/to/dir)"
|
||||||
required: false
|
required: false
|
||||||
|
call:
|
||||||
|
description: "Set method for evaluating build (e.g., check)"
|
||||||
|
required: false
|
||||||
cgroup-parent:
|
cgroup-parent:
|
||||||
description: "Optional parent cgroup for the container used in the build"
|
description: "Optional parent cgroup for the container used in the build"
|
||||||
required: false
|
required: false
|
||||||
|
|
2
dist/index.js
generated
vendored
2
dist/index.js
generated
vendored
File diff suppressed because one or more lines are too long
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
|
@ -17,6 +17,7 @@ export interface Inputs {
|
||||||
builder: string;
|
builder: string;
|
||||||
'cache-from': string[];
|
'cache-from': string[];
|
||||||
'cache-to': string[];
|
'cache-to': string[];
|
||||||
|
call: string;
|
||||||
'cgroup-parent': string;
|
'cgroup-parent': string;
|
||||||
context: string;
|
context: string;
|
||||||
file: string;
|
file: string;
|
||||||
|
@ -53,6 +54,7 @@ export async function getInputs(): Promise<Inputs> {
|
||||||
builder: core.getInput('builder'),
|
builder: core.getInput('builder'),
|
||||||
'cache-from': Util.getInputList('cache-from', {ignoreComma: true}),
|
'cache-from': Util.getInputList('cache-from', {ignoreComma: true}),
|
||||||
'cache-to': Util.getInputList('cache-to', {ignoreComma: true}),
|
'cache-to': Util.getInputList('cache-to', {ignoreComma: true}),
|
||||||
|
call: core.getInput('call'),
|
||||||
'cgroup-parent': core.getInput('cgroup-parent'),
|
'cgroup-parent': core.getInput('cgroup-parent'),
|
||||||
context: core.getInput('context') || Context.gitContext(),
|
context: core.getInput('context') || Context.gitContext(),
|
||||||
file: core.getInput('file'),
|
file: core.getInput('file'),
|
||||||
|
@ -141,6 +143,12 @@ async function getBuildArgs(inputs: Inputs, context: string, toolkit: Toolkit):
|
||||||
await Util.asyncForEach(inputs['cache-to'], async cacheTo => {
|
await Util.asyncForEach(inputs['cache-to'], async cacheTo => {
|
||||||
args.push('--cache-to', cacheTo);
|
args.push('--cache-to', cacheTo);
|
||||||
});
|
});
|
||||||
|
if (inputs.call) {
|
||||||
|
if (!(await toolkit.buildx.versionSatisfies('>=0.15.0'))) {
|
||||||
|
throw new Error(`Buildx >= 0.15.0 is required to use the call flag.`);
|
||||||
|
}
|
||||||
|
args.push('--call', inputs.call);
|
||||||
|
}
|
||||||
if (inputs['cgroup-parent']) {
|
if (inputs['cgroup-parent']) {
|
||||||
args.push('--cgroup-parent', inputs['cgroup-parent']);
|
args.push('--cgroup-parent', inputs['cgroup-parent']);
|
||||||
}
|
}
|
||||||
|
|
10
src/main.ts
10
src/main.ts
|
@ -104,9 +104,15 @@ actionsToolkit.run(
|
||||||
[key: string]: string;
|
[key: string]: string;
|
||||||
}
|
}
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
if (res.stderr.length > 0 && res.exitCode != 0) {
|
if (res.exitCode != 0) {
|
||||||
|
if (inputs.call && inputs.call === 'check' && res.stdout.length > 0) {
|
||||||
|
// checks warnings are printed to stdout: https://github.com/docker/buildx/pull/2647
|
||||||
|
// take the first line with the message summaryzing the warnings
|
||||||
|
err = Error(res.stdout.split('\n')[0]?.trim());
|
||||||
|
} else if (res.stderr.length > 0) {
|
||||||
err = Error(`buildx failed with: ${res.stderr.match(/(.*)\s*$/)?.[0]?.trim() ?? 'unknown error'}`);
|
err = Error(`buildx failed with: ${res.stderr.match(/(.*)\s*$/)?.[0]?.trim() ?? 'unknown error'}`);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const imageID = toolkit.buildxBuild.resolveImageID();
|
const imageID = toolkit.buildxBuild.resolveImageID();
|
||||||
|
@ -161,6 +167,8 @@ actionsToolkit.run(
|
||||||
await core.group(`Check build summary support`, async () => {
|
await core.group(`Check build summary support`, async () => {
|
||||||
if (!buildSummaryEnabled()) {
|
if (!buildSummaryEnabled()) {
|
||||||
core.info('Build summary disabled');
|
core.info('Build summary disabled');
|
||||||
|
} else if (inputs.call && inputs.call !== 'build') {
|
||||||
|
core.info(`Build summary skipped for ${inputs.call} subrequest`);
|
||||||
} else if (GitHub.isGHES) {
|
} else if (GitHub.isGHES) {
|
||||||
core.info('Build summary is not yet supported on GHES');
|
core.info('Build summary is not yet supported on GHES');
|
||||||
} else if (!(await toolkit.buildx.versionSatisfies('>=0.13.0'))) {
|
} else if (!(await toolkit.buildx.versionSatisfies('>=0.13.0'))) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue