mirror of
https://github.com/docker/setup-buildx-action.git
synced 2025-06-07 14:11:49 +02:00
cleanup input to remove builder and temp files
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
parent
03a7a3d9fb
commit
8b13d483f2
7 changed files with 84 additions and 24 deletions
|
@ -20,6 +20,7 @@ export interface Inputs {
|
|||
config: string;
|
||||
configInline: string;
|
||||
append: string;
|
||||
cleanup: boolean;
|
||||
}
|
||||
|
||||
export async function getInputs(): Promise<Inputs> {
|
||||
|
@ -35,7 +36,8 @@ export async function getInputs(): Promise<Inputs> {
|
|||
endpoint: core.getInput('endpoint'),
|
||||
config: core.getInput('config'),
|
||||
configInline: core.getInput('config-inline'),
|
||||
append: core.getInput('append')
|
||||
append: core.getInput('append'),
|
||||
cleanup: core.getBooleanInput('cleanup')
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -16,8 +16,9 @@ actionsToolkit.run(
|
|||
// main
|
||||
async () => {
|
||||
const inputs: context.Inputs = await context.getInputs();
|
||||
const toolkit = new Toolkit();
|
||||
stateHelper.setCleanup(inputs.cleanup);
|
||||
|
||||
const toolkit = new Toolkit();
|
||||
const standalone = await toolkit.buildx.isStandalone();
|
||||
stateHelper.setStandalone(standalone);
|
||||
|
||||
|
@ -164,9 +165,13 @@ actionsToolkit.run(
|
|||
});
|
||||
}
|
||||
|
||||
if (!stateHelper.cleanup) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (stateHelper.builderName.length > 0) {
|
||||
await core.group(`Removing builder`, async () => {
|
||||
const buildx = new Buildx({standalone: /true/i.test(stateHelper.standalone)});
|
||||
const buildx = new Buildx({standalone: stateHelper.standalone});
|
||||
const rmCmd = await buildx.getCommand(['rm', stateHelper.builderName]);
|
||||
await exec
|
||||
.getExecOutput(rmCmd.command, rmCmd.args, {
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
import * as core from '@actions/core';
|
||||
|
||||
export const IsDebug = !!process.env['STATE_isDebug'];
|
||||
export const standalone = process.env['STATE_standalone'] || '';
|
||||
export const standalone = /true/i.test(process.env['STATE_standalone'] || '');
|
||||
export const builderName = process.env['STATE_builderName'] || '';
|
||||
export const containerName = process.env['STATE_containerName'] || '';
|
||||
export const certsDir = process.env['STATE_certsDir'] || '';
|
||||
export const cleanup = /true/i.test(process.env['STATE_cleanup'] || '');
|
||||
|
||||
export function setDebug(debug: string) {
|
||||
core.saveState('isDebug', debug);
|
||||
|
@ -25,3 +26,7 @@ export function setContainerName(containerName: string) {
|
|||
export function setCertsDir(certsDir: string) {
|
||||
core.saveState('certsDir', certsDir);
|
||||
}
|
||||
|
||||
export function setCleanup(cleanup: boolean) {
|
||||
core.saveState('cleanup', cleanup);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue