uninstall current emulators

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2026-05-27 17:01:22 +02:00
parent 8c37cd6f34
commit 2ddad4401e
6 changed files with 45 additions and 0 deletions

View File

@@ -4,6 +4,7 @@ import {Util} from '@docker/actions-toolkit/lib/util.js';
export interface Inputs {
image: string;
platforms: string;
reset: boolean;
cacheImage: boolean;
}
@@ -11,6 +12,7 @@ export function getInputs(): Inputs {
return {
image: core.getInput('image') || 'docker.io/tonistiigi/binfmt:latest',
platforms: Util.getInputList('platforms').join(',') || 'all',
reset: core.getBooleanInput('reset'),
cacheImage: core.getBooleanInput('cache-image')
};
}

View File

@@ -44,6 +44,18 @@ actionsToolkit.run(
});
});
if (input.reset) {
await core.group(`Uninstalling current emulators`, async () => {
await Docker.getExecOutput(['run', '--rm', '--privileged', input.image, '--uninstall', 'qemu-*'], {
ignoreReturnCode: true
}).then(res => {
if (res.stderr.length > 0 && res.exitCode != 0) {
throw new Error(res.stderr.match(/(.*)\s*$/)?.[0]?.trim() ?? 'unknown error');
}
});
});
}
await core.group(`Installing QEMU static binaries`, async () => {
await Docker.getExecOutput(['run', '--rm', '--privileged', input.image, '--install', input.platforms], {
ignoreReturnCode: true