Skip to content

Commit ae6e8fe

Browse files
committed
DOCKER_BUILD_EXPORT_LEGACY env var to opt-in for legacy export
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
1 parent 57dcb4d commit ae6e8fe

File tree

3 files changed

+39
-1
lines changed

3 files changed

+39
-1
lines changed

.github/workflows/ci.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,35 @@ jobs:
653653
env:
654654
DOCKER_BUILD_RECORD_RETENTION_DAYS: ${{ matrix.days }}
655655

656+
export-legacy:
657+
runs-on: ubuntu-latest
658+
strategy:
659+
fail-fast: false
660+
matrix:
661+
legacy:
662+
- false
663+
- true
664+
steps:
665+
-
666+
name: Checkout
667+
uses: actions/checkout@v4
668+
-
669+
name: Set up Docker Buildx
670+
uses: docker/setup-buildx-action@v3
671+
with:
672+
version: ${{ inputs.buildx-version || env.BUILDX_VERSION }}
673+
driver-opts: |
674+
image=${{ inputs.buildkit-image || env.BUILDKIT_IMAGE }}
675+
-
676+
name: Build
677+
uses: ./
678+
with:
679+
files: |
680+
./test/config.hcl
681+
targets: app
682+
env:
683+
DOCKER_BUILD_EXPORT_LEGACY: ${{ matrix.legacy }}
684+
656685
checks:
657686
runs-on: ubuntu-latest
658687
strategy:

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ The following outputs are available
230230
| `DOCKER_BUILD_SUMMARY` | Bool | `true` | If `false`, [build summary](https://docs.docker.com/build/ci/github-actions/build-summary/) generation is disabled |
231231
| `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 |
232232
| `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` |
233+
| `DOCKER_BUILD_EXPORT_LEGACY` | Bool | `false` | If `true`, exports build using legacy export-build tool instead of [`buildx history export` command](https://docs.docker.com/reference/cli/docker/buildx/history/export/) |
233234

234235
## Subactions
235236

src/main.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,8 @@ actionsToolkit.run(
220220

221221
const buildxHistory = new BuildxHistory();
222222
const exportRes = await buildxHistory.export({
223-
refs: stateHelper.buildRefs
223+
refs: stateHelper.buildRefs,
224+
useContainer: buildExportLegacy()
224225
});
225226
core.info(`Build records written to ${exportRes.dockerbuildFilename} (${Util.formatFileSize(exportRes.dockerbuildSize)})`);
226227

@@ -317,3 +318,10 @@ function buildRecordRetentionDays(): number | undefined {
317318
return res;
318319
}
319320
}
321+
322+
function buildExportLegacy(): boolean {
323+
if (process.env.DOCKER_BUILD_EXPORT_LEGACY) {
324+
return Util.parseBool(process.env.DOCKER_BUILD_EXPORT_LEGACY);
325+
}
326+
return false;
327+
}

0 commit comments

Comments
 (0)