Skip to content

Commit 11c2faa

Browse files
committed
rename DOCKER_BUILD_EXPORT_RETENTION_DAYS to DOCKER_BUILD_RECORD_RETENTION_DAYS
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
1 parent de2365a commit 11c2faa

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed

.github/workflows/ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1435,7 +1435,7 @@ jobs:
14351435
env:
14361436
DOCKER_BUILD_RECORD_UPLOAD: false
14371437

1438-
export-retention-days:
1438+
record-retention-days:
14391439
runs-on: ubuntu-latest
14401440
strategy:
14411441
fail-fast: false
@@ -1462,4 +1462,4 @@ jobs:
14621462
with:
14631463
file: ./test/Dockerfile
14641464
env:
1465-
DOCKER_BUILD_EXPORT_RETENTION_DAYS: ${{ matrix.days }}
1465+
DOCKER_BUILD_RECORD_RETENTION_DAYS: ${{ matrix.days }}

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ The following outputs are available:
260260
|--------------------------------------|--------|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
261261
| `DOCKER_BUILD_SUMMARY` | Bool | `true` | If `false`, [build summary](https://docs.docker.com/build/ci/github-actions/build-summary/) generation is disabled |
262262
| `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 |
263-
| `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` |
263+
| `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` |
264264

265265
## Troubleshooting
266266

src/main.ts

+13-6
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,9 @@ actionsToolkit.run(
165165
await core.group(`Generating build summary`, async () => {
166166
try {
167167
const recordUploadEnabled = buildRecordUploadEnabled();
168-
let exportRetentionDays: number | undefined;
168+
let recordRetentionDays: number | undefined;
169169
if (recordUploadEnabled) {
170-
exportRetentionDays = buildExportRetentionDays();
170+
recordRetentionDays = buildRecordRetentionDays();
171171
}
172172

173173
const buildxHistory = new BuildxHistory();
@@ -181,7 +181,7 @@ actionsToolkit.run(
181181
uploadRes = await GitHub.uploadArtifact({
182182
filename: exportRes.dockerbuildFilename,
183183
mimeType: 'application/gzip',
184-
retentionDays: exportRetentionDays
184+
retentionDays: recordRetentionDays
185185
});
186186
}
187187

@@ -239,11 +239,18 @@ function buildRecordUploadEnabled(): boolean {
239239
return true;
240240
}
241241

242-
function buildExportRetentionDays(): number | undefined {
242+
function buildRecordRetentionDays(): number | undefined {
243+
let val: string | undefined;
243244
if (process.env.DOCKER_BUILD_EXPORT_RETENTION_DAYS) {
244-
const res = parseInt(process.env.DOCKER_BUILD_EXPORT_RETENTION_DAYS);
245+
core.warning('DOCKER_BUILD_EXPORT_RETENTION_DAYS is deprecated. Use DOCKER_BUILD_RECORD_RETENTION_DAYS instead.');
246+
val = process.env.DOCKER_BUILD_EXPORT_RETENTION_DAYS;
247+
} else if (process.env.DOCKER_BUILD_RECORD_RETENTION_DAYS) {
248+
val = process.env.DOCKER_BUILD_RECORD_RETENTION_DAYS;
249+
}
250+
if (val) {
251+
const res = parseInt(val);
245252
if (isNaN(res)) {
246-
throw Error(`Invalid build export retention days: ${process.env.DOCKER_BUILD_EXPORT_RETENTION_DAYS}`);
253+
throw Error(`Invalid build record retention days: ${val}`);
247254
}
248255
return res;
249256
}

0 commit comments

Comments
 (0)