From 6751eb6bd5a34435d6fbd112530588397c36385a Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Tue, 20 Oct 2020 17:53:03 +0200 Subject: [PATCH] Local if no type is defined for output Signed-off-by: CrazyMax --- __tests__/buildx.test.ts | 2 +- __tests__/context.test.ts | 1 - dist/index.js | 5 +++++ src/buildx.ts | 5 +++++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/__tests__/buildx.test.ts b/__tests__/buildx.test.ts index 5fb6937..2710ee4 100644 --- a/__tests__/buildx.test.ts +++ b/__tests__/buildx.test.ts @@ -80,7 +80,7 @@ describe('isLocalOrTarExporter', () => { [ '.' ], - false + true ], ])( 'given %p returns %p', diff --git a/__tests__/context.test.ts b/__tests__/context.test.ts index 6bdc30f..133f1d2 100644 --- a/__tests__/context.test.ts +++ b/__tests__/context.test.ts @@ -95,7 +95,6 @@ describe('getArgs', () => { 'buildx', 'build', '--output', '.', - '--iidfile', '/tmp/.docker-build-push-jest/iidfile', '--secret', 'id=GIT_AUTH_TOKEN,src=/tmp/.docker-build-push-jest/.tmpname-jest', '--file', 'Dockerfile', 'https://github.com/docker/build-push-action.git#test-jest' diff --git a/dist/index.js b/dist/index.js index 4a189ef..ccd9baa 100644 --- a/dist/index.js +++ b/dist/index.js @@ -5368,6 +5368,11 @@ function isLocalOrTarExporter(outputs) { columns: false, relax_column_count: true })) { + // Local if no type is defined + // https://github.com/docker/buildx/blob/d2bf42f8b4784d83fde17acb3ed84703ddc2156b/build/output.go#L29-L43 + if (output.length == 1 && !output[0].startsWith('type=')) { + return true; + } for (let [key, value] of output.map(chunk => chunk.split('=').map(item => item.trim()))) { if (key == 'type' && (value == 'local' || value == 'tar')) { return true; diff --git a/src/buildx.ts b/src/buildx.ts index cb04b45..32f5fc3 100644 --- a/src/buildx.ts +++ b/src/buildx.ts @@ -33,6 +33,11 @@ export function isLocalOrTarExporter(outputs: string[]): Boolean { columns: false, relax_column_count: true })) { + // Local if no type is defined + // https://github.com/docker/buildx/blob/d2bf42f8b4784d83fde17acb3ed84703ddc2156b/build/output.go#L29-L43 + if (output.length == 1 && !output[0].startsWith('type=')) { + return true; + } for (let [key, value] of output.map(chunk => chunk.split('=').map(item => item.trim()))) { if (key == 'type' && (value == 'local' || value == 'tar')) { return true;