DOCKER_BUILD_NO_SUMMARY env to disable summary

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax 2024-05-15 09:40:14 +02:00
parent d880b1964b
commit 667cb22c52
No known key found for this signature in database
GPG Key ID: ADE44D8C9D44FBE4
3 changed files with 34 additions and 0 deletions

View File

@ -1344,3 +1344,26 @@ jobs:
name: Check docker name: Check docker
run: | run: |
docker image inspect localhost:5000/name/app:latest docker image inspect localhost:5000/name/app:latest
disable-summary:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v4
with:
path: action
-
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: ./action
with:
file: ./test/Dockerfile
env:
DOCKER_BUILD_NO_SUMMARY: true

View File

@ -37,6 +37,7 @@ ___
* [Customizing](#customizing) * [Customizing](#customizing)
* [inputs](#inputs) * [inputs](#inputs)
* [outputs](#outputs) * [outputs](#outputs)
* [environment variables](#environment-variables)
* [Troubleshooting](#troubleshooting) * [Troubleshooting](#troubleshooting)
* [Contributing](#contributing) * [Contributing](#contributing)
@ -256,6 +257,12 @@ The following outputs are available:
| `digest` | String | Image digest | | `digest` | String | Image digest |
| `metadata` | JSON | Build result metadata | | `metadata` | JSON | Build result metadata |
### environment variables
| Name | Type | Description |
|---------------------------|------|-------------------------------------------------------------------------------------------------------------------|
| `DOCKER_BUILD_NO_SUMMARY` | Bool | If `true`, [build summary](https://docs.docker.com/build/ci/github-actions/build-summary/) generation is disabled |
## Troubleshooting ## Troubleshooting
See [TROUBLESHOOTING.md](TROUBLESHOOTING.md) See [TROUBLESHOOTING.md](TROUBLESHOOTING.md)

View File

@ -141,6 +141,10 @@ actionsToolkit.run(
async () => { async () => {
if (stateHelper.buildRef.length > 0) { if (stateHelper.buildRef.length > 0) {
await core.group(`Generating build summary`, async () => { await core.group(`Generating build summary`, async () => {
if (process.env.DOCKER_BUILD_NO_SUMMARY && Util.parseBool(process.env.DOCKER_BUILD_NO_SUMMARY)) {
core.info('Summary disabled');
return;
}
try { try {
const buildxHistory = new BuildxHistory(); const buildxHistory = new BuildxHistory();
const exportRes = await buildxHistory.export({ const exportRes = await buildxHistory.export({