Compare commits

..

2 Commits

Author SHA1 Message Date
CrazyMax
3f2ab651b4
chore: update generated content
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-06-27 11:27:45 +02:00
CrazyMax
ffee99bff1
move summary support check right after build
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-06-27 11:26:35 +02:00
7 changed files with 43 additions and 39 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

View File

@ -19,7 +19,21 @@ ___
* [Git context](#git-context)
* [Path context](#path-context)
* [Examples](#examples)
* [Summaries](#summaries)
* [Multi-platform image](https://docs.docker.com/build/ci/github-actions/multi-platform/)
* [Secrets](https://docs.docker.com/build/ci/github-actions/secrets/)
* [Push to multi-registries](https://docs.docker.com/build/ci/github-actions/push-multi-registries/)
* [Manage tags and labels](https://docs.docker.com/build/ci/github-actions/manage-tags-labels/)
* [Cache management](https://docs.docker.com/build/ci/github-actions/cache/)
* [Export to Docker](https://docs.docker.com/build/ci/github-actions/export-docker/)
* [Test before push](https://docs.docker.com/build/ci/github-actions/test-before-push/)
* [Local registry](https://docs.docker.com/build/ci/github-actions/local-registry/)
* [Share built image between jobs](https://docs.docker.com/build/ci/github-actions/share-image-jobs/)
* [Named contexts](https://docs.docker.com/build/ci/github-actions/named-contexts/)
* [Copy image between registries](https://docs.docker.com/build/ci/github-actions/copy-image-registries/)
* [Update Docker Hub repo description](https://docs.docker.com/build/ci/github-actions/update-dockerhub-desc/)
* [SBOM and provenance attestations](https://docs.docker.com/build/ci/github-actions/attestations/)
* [Annotations](https://docs.docker.com/build/ci/github-actions/annotations/)
* [Reproducible builds](https://docs.docker.com/build/ci/github-actions/reproducible-builds/)
* [Customizing](#customizing)
* [inputs](#inputs)
* [outputs](#outputs)
@ -55,6 +69,8 @@ name: ci
on:
push:
branches:
- 'main'
jobs:
docker:
@ -92,6 +108,11 @@ expression `{{defaultContext}}`. Here we can use it to provide a subdirectory
to the default Git context:
```yaml
-
# Setting up Docker Buildx with docker-container driver is required
# at the moment to be able to use a subdirectory with Git context
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Build and push
uses: docker/build-push-action@v6
@ -124,6 +145,8 @@ name: ci
on:
push:
branches:
- 'main'
jobs:
docker:
@ -171,31 +194,11 @@ jobs:
* [Annotations](https://docs.docker.com/build/ci/github-actions/annotations/)
* [Reproducible builds](https://docs.docker.com/build/ci/github-actions/reproducible-builds/)
## Summaries
This action generates a [job summary](https://github.blog/2022-05-09-supercharging-github-actions-with-job-summaries/)
that provides a detailed overview of the build execution. The summary shows an
overview of all the steps executed during the build, including the build inputs
and eventual errors.
![build-push-action job summary](./.github/build-push-summary.png)
The summary also includes a link for downloading the build record with
additional details about the build, 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).
For more information about summaries, refer to the
[documentation](https://docs.docker.com/go/build-summary/).
## Customizing
### inputs
The following inputs can be used as `step.with` keys:
Following inputs can be used as `step.with` keys
> `List` type is a newline-delimited string
> ```yaml

4
dist/index.js generated vendored

File diff suppressed because one or more lines are too long

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View File

@ -27,7 +27,7 @@
"packageManager": "yarn@3.6.3",
"dependencies": {
"@actions/core": "^1.10.1",
"@docker/actions-toolkit": "0.30.0",
"@docker/actions-toolkit": "0.29.0",
"handlebars": "^4.7.7"
},
"devDependencies": {

View File

@ -1,6 +1,7 @@
import * as fs from 'fs';
import * as path from 'path';
import * as stateHelper from './state-helper';
import {isGhes} from '@actions/artifact/lib/internal/shared/config';
import * as core from '@actions/core';
import * as actionsToolkit from '@docker/actions-toolkit';
@ -140,14 +141,14 @@ actionsToolkit.run(
await core.group(`Check build summary support`, async () => {
if (process.env.DOCKER_BUILD_NO_SUMMARY && Util.parseBool(process.env.DOCKER_BUILD_NO_SUMMARY)) {
core.info('Build summary disabled');
} else if (GitHub.isGHES) {
core.warning('Build summary is not yet supported on GHES');
} else if (!(await toolkit.buildx.versionSatisfies('>=0.13.0'))) {
core.warning('Build summary requires Buildx >= 0.13.0');
} else if (builder && builder.driver === 'cloud') {
core.warning('Build summary is not yet supported with Docker Build Cloud');
} else if (!ref) {
core.warning('Build summary requires a build reference');
} else if (isGhes()) {
core.warning('Build summary is not yet supported on GHES');
} else if (builder && builder.driver === 'cloud') {
core.warning('Build summary is not yet supported with Docker Build Cloud');
} else if (!(await toolkit.buildx.versionSatisfies('>=0.13.0'))) {
core.warning('Build summary requires Buildx >= 0.13.0');
} else {
core.info('Build summary supported!');
stateHelper.setSummarySupported();
@ -160,13 +161,13 @@ actionsToolkit.run(
},
// post
async () => {
if (stateHelper.isSummarySupported) {
if (stateHelper.isSummarySupported && stateHelper.buildRef.length > 0) {
await core.group(`Generating build summary`, async () => {
try {
const exportRetentionDays = buildExportRetentionDays();
const buildxHistory = new BuildxHistory();
const exportRes = await buildxHistory.export({
refs: stateHelper.buildRef ? [stateHelper.buildRef] : []
refs: [stateHelper.buildRef]
});
core.info(`Build record exported to ${exportRes.dockerbuildFilename} (${Util.formatFileSize(exportRes.dockerbuildSize)})`);
const uploadRes = await GitHub.uploadArtifact({

View File

@ -1055,9 +1055,9 @@ __metadata:
languageName: node
linkType: hard
"@docker/actions-toolkit@npm:0.30.0":
version: 0.30.0
resolution: "@docker/actions-toolkit@npm:0.30.0"
"@docker/actions-toolkit@npm:0.29.0":
version: 0.29.0
resolution: "@docker/actions-toolkit@npm:0.29.0"
dependencies:
"@actions/artifact": ^2.1.7
"@actions/cache": ^3.2.4
@ -1080,7 +1080,7 @@ __metadata:
semver: ^7.6.2
tar-stream: ^3.1.7
tmp: ^0.2.3
checksum: 0e5ea396c93558b4f9841485c57094a707a98cbbc4ade0de119fdf30dc4c3c7fbb0a5ed86d187f89d78db03f66ea5c6903f241d5ca87c9a0f780ae868f866310
checksum: c5685a5de22103d4d2cd978eaecd042be5fd8f5e166b11a1ff9f5a852b65b67969c237b43b3b742bfe85457b03ee60088e58ebc3cfa8b33b7df659e916fd4484
languageName: node
linkType: hard
@ -3150,7 +3150,7 @@ __metadata:
resolution: "docker-build-push@workspace:."
dependencies:
"@actions/core": ^1.10.1
"@docker/actions-toolkit": 0.30.0
"@docker/actions-toolkit": 0.29.0
"@types/node": ^20.12.12
"@typescript-eslint/eslint-plugin": ^7.9.0
"@typescript-eslint/parser": ^7.9.0