From 85ce96bcbc0c18d9568eaa4e8a5bd82d97429fe3 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Fri, 3 Mar 2023 13:46:26 +0100 Subject: [PATCH] do not remove builder using the docker driver Signed-off-by: CrazyMax --- src/main.ts | 3 ++- src/state-helper.ts | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main.ts b/src/main.ts index eeb6d00..b99b9fb 100644 --- a/src/main.ts +++ b/src/main.ts @@ -60,6 +60,7 @@ actionsToolkit.run( core.setOutput('name', inputs.name); stateHelper.setBuilderName(inputs.name); + stateHelper.setBuilderDriver(inputs.driver); fs.mkdirSync(Buildx.certsDir, {recursive: true}); stateHelper.setCertsDir(Buildx.certsDir); @@ -169,7 +170,7 @@ actionsToolkit.run( return; } - if (stateHelper.builderName.length > 0) { + if (stateHelper.builderDriver != 'docker' && stateHelper.builderName.length > 0) { await core.group(`Removing builder`, async () => { const buildx = new Buildx({standalone: stateHelper.standalone}); const rmCmd = await buildx.getCommand(['rm', stateHelper.builderName]); diff --git a/src/state-helper.ts b/src/state-helper.ts index 294c02b..5f513ca 100644 --- a/src/state-helper.ts +++ b/src/state-helper.ts @@ -3,6 +3,7 @@ import * as core from '@actions/core'; export const IsDebug = !!process.env['STATE_isDebug']; export const standalone = /true/i.test(process.env['STATE_standalone'] || ''); export const builderName = process.env['STATE_builderName'] || ''; +export const builderDriver = process.env['STATE_builderDriver'] || ''; export const containerName = process.env['STATE_containerName'] || ''; export const certsDir = process.env['STATE_certsDir'] || ''; export const cleanup = /true/i.test(process.env['STATE_cleanup'] || ''); @@ -19,6 +20,10 @@ export function setBuilderName(builderName: string) { core.saveState('builderName', builderName); } +export function setBuilderDriver(builderDriver: string) { + core.saveState('builderDriver', builderDriver); +} + export function setContainerName(containerName: string) { core.saveState('containerName', containerName); }