Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: docker/build-push-action
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v6.5.0
Choose a base ref
...
head repository: docker/build-push-action
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v6.6.0
Choose a head ref
  • 10 commits
  • 8 files changed
  • 2 contributors

Commits on Jul 30, 2024

  1. chore(deps): Bump @docker/actions-toolkit from 0.35.0 to 0.36.0

    Bumps [@docker/actions-toolkit](https://github.com/docker/actions-toolkit) from 0.35.0 to 0.36.0.
    - [Release notes](https://github.com/docker/actions-toolkit/releases)
    - [Commits](docker/actions-toolkit@v0.35.0...v0.36.0)
    
    ---
    updated-dependencies:
    - dependency-name: "@docker/actions-toolkit"
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Jul 30, 2024

    Verified

    This commit was signed with the committer’s verified signature.
    crazy-max CrazyMax
    Copy the full SHA
    a04f51d View commit details
  2. chore: update generated content

    Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
    crazy-max committed Jul 30, 2024
    Copy the full SHA
    1672e74 View commit details
  3. Merge pull request #1196 from docker/dependabot/npm_and_yarn/docker/a…

    …ctions-toolkit-0.36.0
    
    chore(deps): Bump @docker/actions-toolkit from 0.35.0 to 0.36.0
    crazy-max authored Jul 30, 2024
    Copy the full SHA
    a8d3541 View commit details
  4. generate GitHub annotations for build checks

    Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
    crazy-max committed Jul 30, 2024
    Copy the full SHA
    806a2a4 View commit details

Commits on Jul 31, 2024

  1. opt to disable github annotations generation for build checks

    Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
    crazy-max committed Jul 31, 2024
    Copy the full SHA
    175aa53 View commit details
  2. chore: update generated content

    Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
    crazy-max committed Jul 31, 2024
    Copy the full SHA
    7de3854 View commit details

Commits on Aug 6, 2024

  1. Merge pull request #1197 from crazy-max/build-checks

    generate GitHub annotations for build checks
    crazy-max authored Aug 6, 2024
    Copy the full SHA
    2dbe91d View commit details

Commits on Aug 7, 2024

  1. chore(deps): Bump @docker/actions-toolkit from 0.36.0 to 0.37.0

    Bumps [@docker/actions-toolkit](https://github.com/docker/actions-toolkit) from 0.36.0 to 0.37.0.
    - [Release notes](https://github.com/docker/actions-toolkit/releases)
    - [Commits](docker/actions-toolkit@v0.36.0...v0.37.0)
    
    ---
    updated-dependencies:
    - dependency-name: "@docker/actions-toolkit"
      dependency-type: direct:production
      update-type: version-update:semver-minor
    ...
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Aug 7, 2024
    Copy the full SHA
    3efbc13 View commit details
  2. chore: update generated content

    Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
    crazy-max committed Aug 7, 2024
    Copy the full SHA
    ad3cd77 View commit details
  3. Merge pull request #1198 from docker/dependabot/npm_and_yarn/docker/a…

    …ctions-toolkit-0.37.0
    
    chore(deps): Bump @docker/actions-toolkit from 0.36.0 to 0.37.0
    crazy-max authored Aug 7, 2024
    Copy the full SHA
    4f7cdeb View commit details
Showing with 107 additions and 19 deletions.
  1. +48 −0 .github/workflows/ci.yml
  2. +1 −0 README.md
  3. +9 −9 dist/index.js
  4. +1 −1 dist/index.js.map
  5. +1 −1 package.json
  6. +30 −3 src/main.ts
  7. +12 −0 test/lint.Dockerfile
  8. +5 −5 yarn.lock
48 changes: 48 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1463,3 +1463,51 @@ jobs:
file: ./test/Dockerfile
env:
DOCKER_BUILD_RECORD_RETENTION_DAYS: ${{ matrix.days }}

checks:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
buildx-version:
- latest
- v0.14.1
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
version: ${{ matrix.buildx-version }}
driver-opts: |
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
-
name: Build
uses: ./
with:
context: ./test
file: ./test/lint.Dockerfile

annotations-disabled:
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
uses: ./
with:
context: ./test
file: ./test/lint.Dockerfile
env:
DOCKER_BUILD_CHECKS_ANNOTATIONS: false
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -258,6 +258,7 @@ The following outputs are available:

| Name | Type | Default | Description |
|--------------------------------------|--------|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `DOCKER_BUILD_CHECKS_ANNOTATIONS` | Bool | `true` | If `false`, GitHub annotations are not generated for [build checks](https://docs.docker.com/build/checks/) |
| `DOCKER_BUILD_SUMMARY` | Bool | `true` | If `false`, [build summary](https://docs.docker.com/build/ci/github-actions/build-summary/) generation is disabled |
| `DOCKER_BUILD_RECORD_UPLOAD` | Bool | `true` | If `false`, build record upload as [GitHub artifact](https://docs.github.com/en/actions/using-workflows/storing-workflow-data-as-artifacts) is disabled |
| `DOCKER_BUILD_RECORD_RETENTION_DAYS` | Number | | Duration after which build record artifact will expire in days. Defaults to repository/org [retention settings](https://docs.github.com/en/actions/learn-github-actions/usage-limits-billing-and-administration#artifact-and-log-retention-policy) if unset or `0` |
18 changes: 9 additions & 9 deletions dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@
"packageManager": "yarn@3.6.3",
"dependencies": {
"@actions/core": "^1.10.1",
"@docker/actions-toolkit": "0.35.0",
"@docker/actions-toolkit": "0.37.0",
"handlebars": "^4.7.7"
},
"devDependencies": {
33 changes: 30 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -97,7 +97,12 @@ actionsToolkit.run(

let err: Error | undefined;
await Exec.getExecOutput(buildCmd.command, buildCmd.args, {
ignoreReturnCode: true
ignoreReturnCode: true,
env: Object.assign({}, process.env, {
BUILDX_METADATA_WARNINGS: 'true'
}) as {
[key: string]: string;
}
}).then(res => {
if (res.stderr.length > 0 && res.exitCode != 0) {
err = Error(`buildx failed with: ${res.stderr.match(/(.*)\s*$/)?.[0]?.trim() ?? 'unknown error'}`);
@@ -106,7 +111,7 @@ actionsToolkit.run(

const imageID = toolkit.buildxBuild.resolveImageID();
const metadata = toolkit.buildxBuild.resolveMetadata();
const digest = toolkit.buildxBuild.resolveDigest();
const digest = toolkit.buildxBuild.resolveDigest(metadata);
if (imageID) {
await core.group(`ImageID`, async () => {
core.info(imageID);
@@ -127,7 +132,7 @@ actionsToolkit.run(
});
}

let ref: string;
let ref: string | undefined;
await core.group(`Reference`, async () => {
ref = await buildRef(toolkit, startedTime, inputs.builder);
if (ref) {
@@ -138,6 +143,21 @@ actionsToolkit.run(
}
});

if (buildChecksAnnotationsEnabled()) {
const warnings = toolkit.buildxBuild.resolveWarnings(metadata);
if (ref && warnings && warnings.length > 0) {
const annotations = await Buildx.convertWarningsToGitHubAnnotations(warnings, [ref]);
core.debug(`annotations: ${JSON.stringify(annotations, null, 2)}`);
if (annotations && annotations.length > 0) {
await core.group(`Generating GitHub annotations (${annotations.length} build checks found)`, async () => {
for (const annotation of annotations) {
core.warning(annotation.message, annotation);
}
});
}
}
}

await core.group(`Check build summary support`, async () => {
if (!buildSummaryEnabled()) {
core.info('Build summary disabled');
@@ -222,6 +242,13 @@ async function buildRef(toolkit: Toolkit, since: Date, builder?: string): Promis
return Object.keys(refs).length > 0 ? Object.keys(refs)[0] : '';
}

function buildChecksAnnotationsEnabled(): boolean {
if (process.env.DOCKER_BUILD_CHECKS_ANNOTATIONS) {
return Util.parseBool(process.env.DOCKER_BUILD_CHECKS_ANNOTATIONS);
}
return true;
}

function buildSummaryEnabled(): boolean {
if (process.env.DOCKER_BUILD_NO_SUMMARY) {
core.warning('DOCKER_BUILD_NO_SUMMARY is deprecated. Set DOCKER_BUILD_SUMMARY to false instead.');
12 changes: 12 additions & 0 deletions test/lint.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
frOM busybox as base

Check warning on line 1 in test/lint.Dockerfile

GitHub Actions / checks (latest)

All commands within the Dockerfile should use the same casing (either upper or lower)

ConsistentInstructionCasing: Command 'frOM' should match the case of the command majority (uppercase) More info: https://docs.docker.com/go/dockerfile/rule/consistent-instruction-casing/

Check warning on line 1 in test/lint.Dockerfile

GitHub Actions / checks (latest)

All commands within the Dockerfile should use the same casing (either upper or lower)

ConsistentInstructionCasing: Command 'frOM' should match the case of the command majority (uppercase) More info: https://docs.docker.com/go/dockerfile/rule/consistent-instruction-casing/
cOpy lint.Dockerfile .

Check warning on line 2 in test/lint.Dockerfile

GitHub Actions / checks (latest)

All commands within the Dockerfile should use the same casing (either upper or lower)

ConsistentInstructionCasing: Command 'cOpy' should match the case of the command majority (uppercase) More info: https://docs.docker.com/go/dockerfile/rule/consistent-instruction-casing/

Check warning on line 2 in test/lint.Dockerfile

GitHub Actions / checks (latest)

All commands within the Dockerfile should use the same casing (either upper or lower)

ConsistentInstructionCasing: Command 'cOpy' should match the case of the command majority (uppercase) More info: https://docs.docker.com/go/dockerfile/rule/consistent-instruction-casing/

from scratch

Check warning on line 4 in test/lint.Dockerfile

GitHub Actions / checks (latest)

All commands within the Dockerfile should use the same casing (either upper or lower)

ConsistentInstructionCasing: Command 'from' should match the case of the command majority (uppercase) More info: https://docs.docker.com/go/dockerfile/rule/consistent-instruction-casing/

Check warning on line 4 in test/lint.Dockerfile

GitHub Actions / checks (latest)

All commands within the Dockerfile should use the same casing (either upper or lower)

ConsistentInstructionCasing: Command 'from' should match the case of the command majority (uppercase) More info: https://docs.docker.com/go/dockerfile/rule/consistent-instruction-casing/
MAINTAINER moby@example.com

Check warning on line 5 in test/lint.Dockerfile

GitHub Actions / checks (latest)

The MAINTAINER instruction is deprecated, use a label instead to define an image author

MaintainerDeprecated: Maintainer instruction is deprecated in favor of using label More info: https://docs.docker.com/go/dockerfile/rule/maintainer-deprecated/

Check warning on line 5 in test/lint.Dockerfile

GitHub Actions / checks (latest)

The MAINTAINER instruction is deprecated, use a label instead to define an image author

MaintainerDeprecated: Maintainer instruction is deprecated in favor of using label More info: https://docs.docker.com/go/dockerfile/rule/maintainer-deprecated/
COPy --from=base \

Check warning on line 6 in test/lint.Dockerfile

GitHub Actions / checks (latest)

All commands within the Dockerfile should use the same casing (either upper or lower)

ConsistentInstructionCasing: Command 'COPy' should match the case of the command majority (uppercase) More info: https://docs.docker.com/go/dockerfile/rule/consistent-instruction-casing/

Check warning on line 6 in test/lint.Dockerfile

GitHub Actions / checks (latest)

All commands within the Dockerfile should use the same casing (either upper or lower)

ConsistentInstructionCasing: Command 'COPy' should match the case of the command majority (uppercase) More info: https://docs.docker.com/go/dockerfile/rule/consistent-instruction-casing/
/lint.Dockerfile \
/

CMD [ "echo", "Hello, Norway!" ]

Check warning on line 10 in test/lint.Dockerfile

GitHub Actions / checks (latest)

Multiple instructions of the same type should not be used in the same stage

MultipleInstructionsDisallowed: Multiple CMD instructions should not be used in the same stage because only the last one will be used More info: https://docs.docker.com/go/dockerfile/rule/multiple-instructions-disallowed/

Check warning on line 10 in test/lint.Dockerfile

GitHub Actions / checks (latest)

Multiple instructions of the same type should not be used in the same stage

MultipleInstructionsDisallowed: Multiple CMD instructions should not be used in the same stage because only the last one will be used More info: https://docs.docker.com/go/dockerfile/rule/multiple-instructions-disallowed/
CMD [ "echo", "Hello, Sweden!" ]
ENTRYPOINT my-program start

Check warning on line 12 in test/lint.Dockerfile

GitHub Actions / checks (latest)

JSON arguments recommended for ENTRYPOINT/CMD to prevent unintended behavior related to OS signals

JSONArgsRecommended: JSON arguments recommended for ENTRYPOINT to prevent unintended behavior related to OS signals More info: https://docs.docker.com/go/dockerfile/rule/json-args-recommended/

Check warning on line 12 in test/lint.Dockerfile

GitHub Actions / checks (latest)

JSON arguments recommended for ENTRYPOINT/CMD to prevent unintended behavior related to OS signals

JSONArgsRecommended: JSON arguments recommended for ENTRYPOINT to prevent unintended behavior related to OS signals More info: https://docs.docker.com/go/dockerfile/rule/json-args-recommended/
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
@@ -1055,9 +1055,9 @@ __metadata:
languageName: node
linkType: hard

"@docker/actions-toolkit@npm:0.35.0":
version: 0.35.0
resolution: "@docker/actions-toolkit@npm:0.35.0"
"@docker/actions-toolkit@npm:0.37.0":
version: 0.37.0
resolution: "@docker/actions-toolkit@npm:0.37.0"
dependencies:
"@actions/artifact": ^2.1.8
"@actions/cache": ^3.2.4
@@ -1080,7 +1080,7 @@ __metadata:
semver: ^7.6.3
tar-stream: ^3.1.7
tmp: ^0.2.3
checksum: 27fa4a500e94beff376bc322cc1074c82b20f6ceb0104c43ed5efc613763c8b7ea37b231c32c4dfcb5f7ce8a14948eecc799aa363d60d11d848466d5718d63f0
checksum: e0972ce4a205ddb72542cbaba3c08342ccadb198baa3093ca2b66fb926d49bed41e5b55fd1ed48df04d375529c16e1166dc0571360fc01921b30f6e55879e1f1
languageName: node
linkType: hard

@@ -3150,7 +3150,7 @@ __metadata:
resolution: "docker-build-push@workspace:."
dependencies:
"@actions/core": ^1.10.1
"@docker/actions-toolkit": 0.35.0
"@docker/actions-toolkit": 0.37.0
"@types/node": ^20.12.12
"@typescript-eslint/eslint-plugin": ^7.9.0
"@typescript-eslint/parser": ^7.9.0