Compare commits

...

35 Commits

Author SHA1 Message Date
CrazyMax
1a162644f9
Merge pull request #1172 from crazy-max/build-export-disable
opt to disable build record upload
2024-07-02 18:38:46 +02:00
CrazyMax
9eea548195
chore: update generated content
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-07-02 18:19:48 +02:00
CrazyMax
11c2faaa9e
rename DOCKER_BUILD_EXPORT_RETENTION_DAYS to DOCKER_BUILD_RECORD_RETENTION_DAYS
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-07-02 18:13:41 +02:00
CrazyMax
de2365af33
opt to disable build record upload
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-07-02 18:07:54 +02:00
CrazyMax
bca5082da7
Merge pull request #1173 from crazy-max/build-summary-env-change
switch DOCKER_BUILD_SUMMARY_DISABLE to DOCKER_BUILD_SUMMARY
2024-07-02 17:59:43 +02:00
CrazyMax
e7aab408d9
chore: update generated content
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-07-02 17:55:45 +02:00
CrazyMax
63eb7590c6
switch DOCKER_BUILD_SUMMARY_DISABLE to DOCKER_BUILD_SUMMARY
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-07-02 17:55:44 +02:00
CrazyMax
53ec48606f
Merge pull request #1171 from docker/dependabot/npm_and_yarn/docker/actions-toolkit-0.31.0
chore(deps): Bump @docker/actions-toolkit from 0.30.0 to 0.31.0
2024-07-02 15:28:50 +02:00
CrazyMax
fe9d9f1d0c
chore: update generated content
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-07-02 15:26:29 +02:00
dependabot[bot]
ad37ba1ad0
chore(deps): Bump @docker/actions-toolkit from 0.30.0 to 0.31.0
Bumps [@docker/actions-toolkit](https://github.com/docker/actions-toolkit) from 0.30.0 to 0.31.0.
- [Release notes](https://github.com/docker/actions-toolkit/releases)
- [Commits](https://github.com/docker/actions-toolkit/compare/v0.30.0...v0.31.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>
2024-07-02 13:25:11 +00:00
CrazyMax
aabbd3f4d7
Merge pull request #1170 from crazy-max/rename-summary-disable
rename DOCKER_BUILD_NO_SUMMARY to DOCKER_BUILD_SUMMARY_DISABLE
2024-07-02 15:11:52 +02:00
CrazyMax
9c7c277413
chore: update generated content
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-07-02 14:50:21 +02:00
CrazyMax
987902144c
rename DOCKER_BUILD_NO_SUMMARY to DOCKER_BUILD_SUMMARY_DISABLE
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-07-02 14:49:31 +02:00
CrazyMax
709dde20a7
Merge pull request #1160 from crazy-max/check-summary-support
move summary support check right after build
2024-07-02 14:28:05 +02:00
CrazyMax
ec2d640ea6
chore: update generated content
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-07-02 14:22:01 +02:00
CrazyMax
3dc0757c66
move summary support check right after build
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-07-02 14:20:56 +02:00
CrazyMax
dcb0699155
Merge pull request #1169 from docker/dependabot/npm_and_yarn/docker/actions-toolkit-0.30.0
chore(deps): Bump @docker/actions-toolkit from 0.29.0 to 0.30.0
2024-07-02 14:16:55 +02:00
CrazyMax
a3c06e8698
chore: update generated content
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-07-02 14:14:03 +02:00
dependabot[bot]
e75138d857
chore(deps): Bump @docker/actions-toolkit from 0.29.0 to 0.30.0
Bumps [@docker/actions-toolkit](https://github.com/docker/actions-toolkit) from 0.29.0 to 0.30.0.
- [Release notes](https://github.com/docker/actions-toolkit/releases)
- [Commits](https://github.com/docker/actions-toolkit/compare/v0.29.0...v0.30.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>
2024-07-02 12:03:13 +00:00
CrazyMax
9552610e81
Merge pull request #1166 from crazy-max/subdir-supported
docs: subdir for git context supported since Docker 23
2024-07-01 13:43:50 +02:00
CrazyMax
99c83871c1
docs: subdir for git context supported since Docker 23
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-07-01 00:54:10 +02:00
CrazyMax
af64c4e18f
Merge pull request #1161 from docker/readme-summaries
readme: add section on job summaries
2024-06-27 14:15:15 +02:00
David Karlsson
6fdff4fb09 readme: add section on job summaries
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
2024-06-27 13:51:35 +02:00
CrazyMax
9e59c61762
Merge pull request #1159 from docker/dependabot/npm_and_yarn/docker/actions-toolkit-0.29.0
chore(deps): Bump @docker/actions-toolkit from 0.28.0 to 0.29.0
2024-06-27 11:11:05 +02:00
CrazyMax
49351df2b7
chore: update generated content
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-06-27 11:08:00 +02:00
dependabot[bot]
723ff6ffad
chore(deps): Bump @docker/actions-toolkit from 0.28.0 to 0.29.0
Bumps [@docker/actions-toolkit](https://github.com/docker/actions-toolkit) from 0.28.0 to 0.29.0.
- [Release notes](https://github.com/docker/actions-toolkit/releases)
- [Commits](https://github.com/docker/actions-toolkit/compare/v0.28.0...v0.29.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>
2024-06-27 09:03:36 +00:00
CrazyMax
15560696de
Merge pull request #1158 from docker/dependabot/npm_and_yarn/docker/actions-toolkit-0.28.0
chore(deps): Bump @docker/actions-toolkit from 0.27.0 to 0.28.0
2024-06-26 14:20:37 +02:00
CrazyMax
57e1d34ac3
chore: update generated content
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-06-26 14:14:54 +02:00
dependabot[bot]
309982ebc9
chore(deps): Bump @docker/actions-toolkit from 0.27.0 to 0.28.0
Bumps [@docker/actions-toolkit](https://github.com/docker/actions-toolkit) from 0.27.0 to 0.28.0.
- [Release notes](https://github.com/docker/actions-toolkit/releases)
- [Commits](https://github.com/docker/actions-toolkit/compare/v0.27.0...v0.28.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>
2024-06-26 12:10:23 +00:00
CrazyMax
9476c25b2a
Merge pull request #1153 from crazy-max/export-retention
use default retention days for build export artifact
2024-06-26 14:00:48 +02:00
CrazyMax
97be5a4928
chore: update generated content
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-06-24 10:28:21 +02:00
CrazyMax
9cac6c8ea0
use default retention days for build export artifact
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-06-24 10:28:21 +02:00
CrazyMax
31159d49c0
Merge pull request #1149 from docker/dependabot/npm_and_yarn/docker/actions-toolkit-0.27.0
chore(deps): Bump @docker/actions-toolkit from 0.26.2 to 0.27.0
2024-06-20 19:22:45 +02:00
CrazyMax
07e1c3e148
chore: update generated content
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
2024-06-20 19:18:43 +02:00
dependabot[bot]
f7febd621d
chore(deps): Bump @docker/actions-toolkit from 0.26.2 to 0.27.0
Bumps [@docker/actions-toolkit](https://github.com/docker/actions-toolkit) from 0.26.2 to 0.27.0.
- [Release notes](https://github.com/docker/actions-toolkit/releases)
- [Commits](https://github.com/docker/actions-toolkit/compare/v0.26.2...v0.27.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>
2024-06-20 17:13:56 +00:00
10 changed files with 261 additions and 75 deletions

BIN
.github/build-push-summary.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

View File

@ -1345,7 +1345,30 @@ jobs:
run: | run: |
docker image inspect localhost:5000/name/app:latest docker image inspect localhost:5000/name/app:latest
disable-summary: summary-disable:
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_SUMMARY: false
summary-disable-deprecated:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- -
@ -1367,3 +1390,76 @@ jobs:
file: ./test/Dockerfile file: ./test/Dockerfile
env: env:
DOCKER_BUILD_NO_SUMMARY: true DOCKER_BUILD_NO_SUMMARY: true
summary-not-supported:
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: v0.12.1
driver-opts: |
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
-
name: Build
uses: ./action
with:
file: ./test/Dockerfile
record-upload-disable:
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_RECORD_UPLOAD: false
record-retention-days:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
days:
- 2
- 0
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_RECORD_RETENTION_DAYS: ${{ matrix.days }}

View File

@ -19,21 +19,7 @@ ___
* [Git context](#git-context) * [Git context](#git-context)
* [Path context](#path-context) * [Path context](#path-context)
* [Examples](#examples) * [Examples](#examples)
* [Multi-platform image](https://docs.docker.com/build/ci/github-actions/multi-platform/) * [Summaries](#summaries)
* [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) * [Customizing](#customizing)
* [inputs](#inputs) * [inputs](#inputs)
* [outputs](#outputs) * [outputs](#outputs)
@ -69,8 +55,6 @@ name: ci
on: on:
push: push:
branches:
- 'main'
jobs: jobs:
docker: docker:
@ -108,11 +92,6 @@ expression `{{defaultContext}}`. Here we can use it to provide a subdirectory
to the default Git context: to the default Git context:
```yaml ```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 name: Build and push
uses: docker/build-push-action@v6 uses: docker/build-push-action@v6
@ -145,8 +124,6 @@ name: ci
on: on:
push: push:
branches:
- 'main'
jobs: jobs:
docker: docker:
@ -194,11 +171,31 @@ jobs:
* [Annotations](https://docs.docker.com/build/ci/github-actions/annotations/) * [Annotations](https://docs.docker.com/build/ci/github-actions/annotations/)
* [Reproducible builds](https://docs.docker.com/build/ci/github-actions/reproducible-builds/) * [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_SUMMARY` [environment variable](#environment-variables).
For more information about summaries, refer to the
[documentation](https://docs.docker.com/go/build-summary/).
## Customizing ## Customizing
### inputs ### inputs
Following inputs can be used as `step.with` keys The following inputs can be used as `step.with` keys:
> `List` type is a newline-delimited string > `List` type is a newline-delimited string
> ```yaml > ```yaml
@ -259,9 +256,11 @@ The following outputs are available:
### environment variables ### environment variables
| Name | Type | Description | | Name | Type | Default | Description |
|---------------------------|------|-------------------------------------------------------------------------------------------------------------------| |--------------------------------------|--------|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `DOCKER_BUILD_NO_SUMMARY` | Bool | If `true`, [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_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` |
## Troubleshooting ## Troubleshooting

23
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

24
dist/licenses.txt generated vendored
View File

@ -2516,6 +2516,30 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE. THE SOFTWARE.
he
MIT
Copyright Mathias Bynens <https://mathiasbynens.be/>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
iconv-lite iconv-lite
MIT MIT
Copyright (c) 2011 Alexander Shtuchkin Copyright (c) 2011 Alexander Shtuchkin

View File

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

View File

@ -13,7 +13,9 @@ import {GitHub} from '@docker/actions-toolkit/lib/github';
import {Toolkit} from '@docker/actions-toolkit/lib/toolkit'; import {Toolkit} from '@docker/actions-toolkit/lib/toolkit';
import {Util} from '@docker/actions-toolkit/lib/util'; import {Util} from '@docker/actions-toolkit/lib/util';
import {BuilderInfo} from '@docker/actions-toolkit/lib/types/buildx/builder';
import {ConfigFile} from '@docker/actions-toolkit/lib/types/docker/docker'; import {ConfigFile} from '@docker/actions-toolkit/lib/types/docker/docker';
import {UploadArtifactResponse} from '@docker/actions-toolkit/lib/types/github';
import * as context from './context'; import * as context from './context';
@ -80,10 +82,10 @@ actionsToolkit.run(
await toolkit.buildx.printVersion(); await toolkit.buildx.printVersion();
}); });
let builder: BuilderInfo;
await core.group(`Builder info`, async () => { await core.group(`Builder info`, async () => {
const builder = await toolkit.builder.inspect(inputs.builder); builder = await toolkit.builder.inspect(inputs.builder);
core.info(JSON.stringify(builder, null, 2)); core.info(JSON.stringify(builder, null, 2));
stateHelper.setBuilder(builder);
}); });
const args: string[] = await context.getArgs(inputs, toolkit); const args: string[] = await context.getArgs(inputs, toolkit);
@ -105,7 +107,6 @@ actionsToolkit.run(
const imageID = toolkit.buildxBuild.resolveImageID(); const imageID = toolkit.buildxBuild.resolveImageID();
const metadata = toolkit.buildxBuild.resolveMetadata(); const metadata = toolkit.buildxBuild.resolveMetadata();
const digest = toolkit.buildxBuild.resolveDigest(); const digest = toolkit.buildxBuild.resolveDigest();
if (imageID) { if (imageID) {
await core.group(`ImageID`, async () => { await core.group(`ImageID`, async () => {
core.info(imageID); core.info(imageID);
@ -125,42 +126,65 @@ actionsToolkit.run(
core.setOutput('metadata', metadatadt); core.setOutput('metadata', metadatadt);
}); });
} }
let ref: string;
await core.group(`Reference`, async () => { await core.group(`Reference`, async () => {
const ref = await buildRef(toolkit, startedTime, inputs.builder); ref = await buildRef(toolkit, startedTime, inputs.builder);
if (ref) { if (ref) {
core.info(ref); core.info(ref);
stateHelper.setBuildRef(ref); stateHelper.setBuildRef(ref);
} else { } else {
core.warning('No build ref found'); core.info('No build reference found');
} }
}); });
await core.group(`Check build summary support`, async () => {
if (!buildSummaryEnabled()) {
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 {
core.info('Build summary supported!');
stateHelper.setSummarySupported();
}
});
if (err) { if (err) {
throw err; throw err;
} }
}, },
// post // post
async () => { async () => {
if (stateHelper.buildRef.length > 0) { if (stateHelper.isSummarySupported) {
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;
}
if (stateHelper.builder && stateHelper.builder.driver === 'cloud') {
core.info('Summary is not yet supported with Docker Build Cloud');
return;
}
try { try {
const recordUploadEnabled = buildRecordUploadEnabled();
let recordRetentionDays: number | undefined;
if (recordUploadEnabled) {
recordRetentionDays = buildRecordRetentionDays();
}
const buildxHistory = new BuildxHistory(); const buildxHistory = new BuildxHistory();
const exportRes = await buildxHistory.export({ const exportRes = await buildxHistory.export({
refs: [stateHelper.buildRef] refs: stateHelper.buildRef ? [stateHelper.buildRef] : []
}); });
core.info(`Build record exported to ${exportRes.dockerbuildFilename} (${Util.formatFileSize(exportRes.dockerbuildSize)})`); core.info(`Build record written to ${exportRes.dockerbuildFilename} (${Util.formatFileSize(exportRes.dockerbuildSize)})`);
const uploadRes = await GitHub.uploadArtifact({
let uploadRes: UploadArtifactResponse | undefined;
if (recordUploadEnabled) {
uploadRes = await GitHub.uploadArtifact({
filename: exportRes.dockerbuildFilename, filename: exportRes.dockerbuildFilename,
mimeType: 'application/gzip', mimeType: 'application/gzip',
retentionDays: 90 retentionDays: recordRetentionDays
}); });
}
await GitHub.writeBuildSummary({ await GitHub.writeBuildSummary({
exportRes: exportRes, exportRes: exportRes,
uploadRes: uploadRes, uploadRes: uploadRes,
@ -197,3 +221,37 @@ 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 buildSummaryEnabled(): boolean {
if (process.env.DOCKER_BUILD_NO_SUMMARY) {
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 true;
}
function buildRecordUploadEnabled(): boolean {
if (process.env.DOCKER_BUILD_RECORD_UPLOAD) {
return Util.parseBool(process.env.DOCKER_BUILD_RECORD_UPLOAD);
}
return true;
}
function buildRecordRetentionDays(): number | undefined {
let val: string | undefined;
if (process.env.DOCKER_BUILD_EXPORT_RETENTION_DAYS) {
core.warning('DOCKER_BUILD_EXPORT_RETENTION_DAYS is deprecated. Use DOCKER_BUILD_RECORD_RETENTION_DAYS instead.');
val = process.env.DOCKER_BUILD_EXPORT_RETENTION_DAYS;
} else if (process.env.DOCKER_BUILD_RECORD_RETENTION_DAYS) {
val = process.env.DOCKER_BUILD_RECORD_RETENTION_DAYS;
}
if (val) {
const res = parseInt(val);
if (isNaN(res)) {
throw Error(`Invalid build record retention days: ${val}`);
}
return res;
}
}

View File

@ -1,13 +1,11 @@
import * as core from '@actions/core'; import * as core from '@actions/core';
import {BuilderInfo} from '@docker/actions-toolkit/lib/types/buildx/builder';
import {Inputs, sanitizeInputs} from './context'; import {Inputs, sanitizeInputs} from './context';
export const tmpDir = process.env['STATE_tmpDir'] || ''; export const tmpDir = process.env['STATE_tmpDir'] || '';
export const inputs = process.env['STATE_inputs'] ? JSON.parse(process.env['STATE_inputs']) : undefined; export const inputs = process.env['STATE_inputs'] ? JSON.parse(process.env['STATE_inputs']) : undefined;
export const builder = process.env['STATE_builder'] ? <BuilderInfo>JSON.parse(process.env['STATE_builder']) : undefined;
export const buildRef = process.env['STATE_buildRef'] || ''; export const buildRef = process.env['STATE_buildRef'] || '';
export const isSummarySupported = !!process.env['STATE_isSummarySupported'];
export function setTmpDir(tmpDir: string) { export function setTmpDir(tmpDir: string) {
core.saveState('tmpDir', tmpDir); core.saveState('tmpDir', tmpDir);
@ -17,10 +15,10 @@ export function setInputs(inputs: Inputs) {
core.saveState('inputs', JSON.stringify(sanitizeInputs(inputs))); core.saveState('inputs', JSON.stringify(sanitizeInputs(inputs)));
} }
export function setBuilder(builder: BuilderInfo) {
core.saveState('builder', JSON.stringify(builder));
}
export function setBuildRef(buildRef: string) { export function setBuildRef(buildRef: string) {
core.saveState('buildRef', buildRef); core.saveState('buildRef', buildRef);
} }
export function setSummarySupported() {
core.saveState('isSummarySupported', 'true');
}

View File

@ -1055,9 +1055,9 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"@docker/actions-toolkit@npm:0.26.2": "@docker/actions-toolkit@npm:0.31.0":
version: 0.26.2 version: 0.31.0
resolution: "@docker/actions-toolkit@npm:0.26.2" resolution: "@docker/actions-toolkit@npm:0.31.0"
dependencies: dependencies:
"@actions/artifact": ^2.1.7 "@actions/artifact": ^2.1.7
"@actions/cache": ^3.2.4 "@actions/cache": ^3.2.4
@ -1074,12 +1074,13 @@ __metadata:
csv-parse: ^5.5.6 csv-parse: ^5.5.6
gunzip-maybe: ^1.4.2 gunzip-maybe: ^1.4.2
handlebars: ^4.7.8 handlebars: ^4.7.8
he: ^1.2.0
js-yaml: ^4.1.0 js-yaml: ^4.1.0
jwt-decode: ^4.0.0 jwt-decode: ^4.0.0
semver: ^7.6.2 semver: ^7.6.2
tar-stream: ^3.1.7 tar-stream: ^3.1.7
tmp: ^0.2.3 tmp: ^0.2.3
checksum: f123f3f1c3369d7557948707e98a0005e43beb4c586f55befc0168426d29cab2ab4daa9dcf114b9e1de45883e2cc42365c69bdca8d61dbb5b2f3241ef4377049 checksum: 34fdc08b6380bbee05fc740b161bb1172658da6d3e58f0f9cf8bc12011da638b37314e2a92a689542955189459ace241769c9f247a6917bf8365bc461221eecd
languageName: node languageName: node
linkType: hard linkType: hard
@ -3149,7 +3150,7 @@ __metadata:
resolution: "docker-build-push@workspace:." resolution: "docker-build-push@workspace:."
dependencies: dependencies:
"@actions/core": ^1.10.1 "@actions/core": ^1.10.1
"@docker/actions-toolkit": 0.26.2 "@docker/actions-toolkit": 0.31.0
"@types/node": ^20.12.12 "@types/node": ^20.12.12
"@typescript-eslint/eslint-plugin": ^7.9.0 "@typescript-eslint/eslint-plugin": ^7.9.0
"@typescript-eslint/parser": ^7.9.0 "@typescript-eslint/parser": ^7.9.0
@ -3962,6 +3963,15 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"he@npm:^1.2.0":
version: 1.2.0
resolution: "he@npm:1.2.0"
bin:
he: bin/he
checksum: 3d4d6babccccd79c5c5a3f929a68af33360d6445587d628087f39a965079d84f18ce9c3d3f917ee1e3978916fc833bb8b29377c3b403f919426f91bc6965e7a7
languageName: node
linkType: hard
"html-escaper@npm:^2.0.0": "html-escaper@npm:^2.0.0":
version: 2.0.2 version: 2.0.2
resolution: "html-escaper@npm:2.0.2" resolution: "html-escaper@npm:2.0.2"