mirror of
https://github.com/docker/build-push-action.git
synced 2024-12-27 00:31:05 +08:00
opt to disable github annotations generation for build checks
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
parent
806a2a461f
commit
175aa53a3f
22
.github/workflows/ci.yml
vendored
22
.github/workflows/ci.yml
vendored
@ -1489,3 +1489,25 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
context: ./test
|
context: ./test
|
||||||
file: ./test/lint.Dockerfile
|
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
|
||||||
|
@ -258,6 +258,7 @@ The following outputs are available:
|
|||||||
|
|
||||||
| Name | Type | Default | Description |
|
| 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_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_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` |
|
| `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` |
|
||||||
|
@ -143,6 +143,7 @@ actionsToolkit.run(
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (buildChecksAnnotationsEnabled()) {
|
||||||
const warnings = toolkit.buildxBuild.resolveWarnings(metadata);
|
const warnings = toolkit.buildxBuild.resolveWarnings(metadata);
|
||||||
if (ref && warnings && warnings.length > 0) {
|
if (ref && warnings && warnings.length > 0) {
|
||||||
const annotations = await Buildx.convertWarningsToGitHubAnnotations(warnings, [ref]);
|
const annotations = await Buildx.convertWarningsToGitHubAnnotations(warnings, [ref]);
|
||||||
@ -155,6 +156,7 @@ actionsToolkit.run(
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
await core.group(`Check build summary support`, async () => {
|
await core.group(`Check build summary support`, async () => {
|
||||||
if (!buildSummaryEnabled()) {
|
if (!buildSummaryEnabled()) {
|
||||||
@ -240,6 +242,13 @@ async function buildRef(toolkit: Toolkit, since: Date, builder?: string): Promis
|
|||||||
return Object.keys(refs).length > 0 ? Object.keys(refs)[0] : '';
|
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 {
|
function buildSummaryEnabled(): boolean {
|
||||||
if (process.env.DOCKER_BUILD_NO_SUMMARY) {
|
if (process.env.DOCKER_BUILD_NO_SUMMARY) {
|
||||||
core.warning('DOCKER_BUILD_NO_SUMMARY is deprecated. Set DOCKER_BUILD_SUMMARY to false instead.');
|
core.warning('DOCKER_BUILD_NO_SUMMARY is deprecated. Set DOCKER_BUILD_SUMMARY to false instead.');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user