Skip to content

Commit bfc5252

Browse files
committed
rename DOCKER_BUILD_EXPORT_RETENTION_DAYS to DOCKER_BUILD_RECORD_RETENTION_DAYS
Signed-off-by: CrazyMax <[email protected]>
1 parent 216ea56 commit bfc5252

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
@@ -613,7 +613,7 @@ jobs:
613613
env:
614614
DOCKER_BUILD_RECORD_UPLOAD: false
615615

616-
export-retention-days:
616+
record-retention-days:
617617
runs-on: ubuntu-latest
618618
strategy:
619619
fail-fast: false
@@ -640,4 +640,4 @@ jobs:
640640
./test/config.hcl
641641
targets: app
642642
env:
643-
DOCKER_BUILD_EXPORT_RETENTION_DAYS: ${{ matrix.days }}
643+
DOCKER_BUILD_RECORD_RETENTION_DAYS: ${{ matrix.days }}

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ The following outputs are available
283283
|--------------------------------------|--------|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
284284
| `DOCKER_BUILD_SUMMARY` | Bool | `true` | If `false`, [build summary](https://docs.docker.com/build/ci/github-actions/build-summary/) generation is disabled |
285285
| `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 |
286-
| `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` |
286+
| `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` |
287287

288288
## Contributing
289289

src/main.ts

+13-6
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,9 @@ actionsToolkit.run(
191191
await core.group(`Generating build summary`, async () => {
192192
try {
193193
const recordUploadEnabled = buildRecordUploadEnabled();
194-
let exportRetentionDays: number | undefined;
194+
let recordRetentionDays: number | undefined;
195195
if (recordUploadEnabled) {
196-
exportRetentionDays = buildExportRetentionDays();
196+
recordRetentionDays = buildRecordRetentionDays();
197197
}
198198

199199
const buildxHistory = new BuildxHistory();
@@ -207,7 +207,7 @@ actionsToolkit.run(
207207
uploadRes = await GitHub.uploadArtifact({
208208
filename: exportRes.dockerbuildFilename,
209209
mimeType: 'application/gzip',
210-
retentionDays: exportRetentionDays
210+
retentionDays: recordRetentionDays
211211
});
212212
}
213213

@@ -272,11 +272,18 @@ function buildRecordUploadEnabled(): boolean {
272272
return true;
273273
}
274274

275-
function buildExportRetentionDays(): number | undefined {
275+
function buildRecordRetentionDays(): number | undefined {
276+
let val: string | undefined;
276277
if (process.env.DOCKER_BUILD_EXPORT_RETENTION_DAYS) {
277-
const res = parseInt(process.env.DOCKER_BUILD_EXPORT_RETENTION_DAYS);
278+
core.warning('DOCKER_BUILD_EXPORT_RETENTION_DAYS is deprecated. Use DOCKER_BUILD_RECORD_RETENTION_DAYS instead.');
279+
val = process.env.DOCKER_BUILD_EXPORT_RETENTION_DAYS;
280+
} else if (process.env.DOCKER_BUILD_RECORD_RETENTION_DAYS) {
281+
val = process.env.DOCKER_BUILD_RECORD_RETENTION_DAYS;
282+
}
283+
if (val) {
284+
const res = parseInt(val);
278285
if (isNaN(res)) {
279-
throw Error(`Invalid build export retention days: ${process.env.DOCKER_BUILD_EXPORT_RETENTION_DAYS}`);
286+
throw Error(`Invalid build record retention days: ${val}`);
280287
}
281288
return res;
282289
}

0 commit comments

Comments
 (0)