From bc6d272b50c7194d0417ebf1ddf8ab1fcc495519 Mon Sep 17 00:00:00 2001 From: CrazyMax <1951866+crazy-max@users.noreply.github.com> Date: Tue, 2 Jul 2024 18:52:07 +0200 Subject: [PATCH] switch DOCKER_BUILD_SUMMARY_DISABLE to DOCKER_BUILD_SUMMARY Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com> --- .github/workflows/ci.yml | 25 ++++++++++++++++++++++++- README.md | 10 +++++----- src/main.ts | 14 +++++++------- 3 files changed, 36 insertions(+), 13 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e1b69d1..0f496eb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -544,7 +544,30 @@ jobs: ./test/config.hcl targets: app env: - DOCKER_BUILD_SUMMARY_DISABLE: true + DOCKER_BUILD_SUMMARY: false + + summary-disable-deprecated: + 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: + files: | + ./test/config.hcl + targets: app + env: + DOCKER_BUILD_NO_SUMMARY: true summary-not-supported: runs-on: ubuntu-latest diff --git a/README.md b/README.md index a18e617..8d6940d 100644 --- a/README.md +++ b/README.md @@ -154,7 +154,7 @@ including build stats, logs, outputs, and more. The build record can be imported to Docker Desktop for inspecting the build in greater detail. Summaries are enabled by default, but can be disabled with the -`DOCKER_BUILD_NO_SUMMARY` [environment variable](#environment-variables). +`DOCKER_BUILD_SUMMARY` [environment variable](#environment-variables). For more information about summaries, refer to the [documentation](https://docs.docker.com/go/build-summary/). @@ -279,10 +279,10 @@ The following outputs are available ### environment variables -| Name | Type | Description | -|--------------------------------------|--------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `DOCKER_BUILD_SUMMARY_DISABLE` | Bool | If `true`, [build summary](https://docs.docker.com/build/ci/github-actions/build-summary/) generation is disabled | -| `DOCKER_BUILD_EXPORT_RETENTION_DAYS` | Number | Duration after which build export 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` | +| Name | Type | Default | Description | +|--------------------------------------|--------|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| `DOCKER_BUILD_SUMMARY` | Bool | `true` | If `false`, [build summary](https://docs.docker.com/build/ci/github-actions/build-summary/) generation is disabled | +| `DOCKER_BUILD_EXPORT_RETENTION_DAYS` | Number | | Duration after which build export 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` | ## Contributing diff --git a/src/main.ts b/src/main.ts index 5265192..9ffd667 100644 --- a/src/main.ts +++ b/src/main.ts @@ -164,7 +164,7 @@ actionsToolkit.run( }); await core.group(`Check build summary support`, async () => { - if (buildSummaryDisabled()) { + if (!buildSummaryEnabled()) { core.info('Build summary disabled'); } else if (GitHub.isGHES) { core.warning('Build summary is not yet supported on GHES'); @@ -244,14 +244,14 @@ async function buildRefs(toolkit: Toolkit, since: Date, builder?: string): Promi return refs; } -function buildSummaryDisabled(): boolean { +function buildSummaryEnabled(): boolean { if (process.env.DOCKER_BUILD_NO_SUMMARY) { - core.warning('DOCKER_BUILD_NO_SUMMARY is deprecated. Use DOCKER_BUILD_SUMMARY_DISABLE instead.'); - return Util.parseBool(process.env.DOCKER_BUILD_NO_SUMMARY); - } else if (process.env.DOCKER_BUILD_SUMMARY_DISABLE) { - return Util.parseBool(process.env.DOCKER_BUILD_SUMMARY_DISABLE); + core.warning('DOCKER_BUILD_NO_SUMMARY is deprecated. Set DOCKER_BUILD_SUMMARY to false instead.'); + return !Util.parseBool(process.env.DOCKER_BUILD_NO_SUMMARY); + } else if (process.env.DOCKER_BUILD_SUMMARY) { + return Util.parseBool(process.env.DOCKER_BUILD_SUMMARY); } - return false; + return true; } function buildExportRetentionDays(): number | undefined {