mirror of
https://github.com/docker/build-push-action.git
synced 2025-06-14 07:07:12 +02:00
Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
15560696de | |||
57e1d34ac3 | |||
309982ebc9 | |||
9476c25b2a | |||
97be5a4928 | |||
9cac6c8ea0 |
29
.github/workflows/ci.yml
vendored
29
.github/workflows/ci.yml
vendored
@ -1367,3 +1367,32 @@ jobs:
|
||||
file: ./test/Dockerfile
|
||||
env:
|
||||
DOCKER_BUILD_NO_SUMMARY: true
|
||||
|
||||
export-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_EXPORT_RETENTION_DAYS: ${{ matrix.days }}
|
||||
|
@ -259,9 +259,10 @@ The following outputs are available:
|
||||
|
||||
### 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 |
|
||||
| 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 |
|
||||
| `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` |
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
|
4
dist/index.js
generated
vendored
4
dist/index.js
generated
vendored
File diff suppressed because one or more lines are too long
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
@ -27,7 +27,7 @@
|
||||
"packageManager": "yarn@3.6.3",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.10.1",
|
||||
"@docker/actions-toolkit": "0.27.0",
|
||||
"@docker/actions-toolkit": "0.28.0",
|
||||
"handlebars": "^4.7.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
13
src/main.ts
13
src/main.ts
@ -151,6 +151,7 @@ actionsToolkit.run(
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const exportRetentionDays = buildExportRetentionDays();
|
||||
const buildxHistory = new BuildxHistory();
|
||||
const exportRes = await buildxHistory.export({
|
||||
refs: [stateHelper.buildRef]
|
||||
@ -159,7 +160,7 @@ actionsToolkit.run(
|
||||
const uploadRes = await GitHub.uploadArtifact({
|
||||
filename: exportRes.dockerbuildFilename,
|
||||
mimeType: 'application/gzip',
|
||||
retentionDays: 90
|
||||
retentionDays: exportRetentionDays
|
||||
});
|
||||
await GitHub.writeBuildSummary({
|
||||
exportRes: exportRes,
|
||||
@ -197,3 +198,13 @@ async function buildRef(toolkit: Toolkit, since: Date, builder?: string): Promis
|
||||
});
|
||||
return Object.keys(refs).length > 0 ? Object.keys(refs)[0] : '';
|
||||
}
|
||||
|
||||
function buildExportRetentionDays(): number | undefined {
|
||||
if (process.env.DOCKER_BUILD_EXPORT_RETENTION_DAYS) {
|
||||
const res = parseInt(process.env.DOCKER_BUILD_EXPORT_RETENTION_DAYS);
|
||||
if (isNaN(res)) {
|
||||
throw Error(`Invalid build export retention days: ${process.env.DOCKER_BUILD_EXPORT_RETENTION_DAYS}`);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
10
yarn.lock
10
yarn.lock
@ -1055,9 +1055,9 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@docker/actions-toolkit@npm:0.27.0":
|
||||
version: 0.27.0
|
||||
resolution: "@docker/actions-toolkit@npm:0.27.0"
|
||||
"@docker/actions-toolkit@npm:0.28.0":
|
||||
version: 0.28.0
|
||||
resolution: "@docker/actions-toolkit@npm:0.28.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: 8014c5f04006b19d635dbc9e28df493afa5839f782ee00849a0d2aa86a95201a95e4602dd96311c00bd00bec92a9719df2a18148296438a79785a4af8840af69
|
||||
checksum: 1ef7d9eb861a8f102391b9b230a6cfae808ec12f48a97b32e8afe78e241e8d4c1faece71ad8f7702c7b1cfffaf0bd7f816552b6bad0b6d8a41465142a61425a6
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@ -3150,7 +3150,7 @@ __metadata:
|
||||
resolution: "docker-build-push@workspace:."
|
||||
dependencies:
|
||||
"@actions/core": ^1.10.1
|
||||
"@docker/actions-toolkit": 0.27.0
|
||||
"@docker/actions-toolkit": 0.28.0
|
||||
"@types/node": ^20.12.12
|
||||
"@typescript-eslint/eslint-plugin": ^7.9.0
|
||||
"@typescript-eslint/parser": ^7.9.0
|
||||
|
Reference in New Issue
Block a user