mirror of
https://github.com/docker/setup-qemu-action.git
synced 2025-07-06 18:38:24 +02:00
Compare commits
3 Commits
e2a9378e4f
...
b7249025a9
Author | SHA1 | Date | |
---|---|---|---|
b7249025a9 | |||
4d56188b3d | |||
1765b1e310 |
2
dist/index.js
generated
vendored
2
dist/index.js
generated
vendored
File diff suppressed because one or more lines are too long
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
26
src/main.ts
26
src/main.ts
@ -20,15 +20,33 @@ actionsToolkit.run(
|
||||
});
|
||||
|
||||
await core.group(`Pulling binfmt Docker image`, async () => {
|
||||
await Exec.exec('docker', ['pull', input.image]);
|
||||
await Exec.getExecOutput('docker', ['pull', input.image], {
|
||||
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(`Image info`, async () => {
|
||||
await Exec.exec('docker', ['image', 'inspect', input.image]);
|
||||
await Exec.getExecOutput('docker', ['image', 'inspect', input.image], {
|
||||
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 Exec.exec('docker', ['run', '--rm', '--privileged', input.image, '--install', input.platforms]);
|
||||
await Exec.getExecOutput('docker', ['run', '--rm', '--privileged', input.image, '--install', input.platforms], {
|
||||
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(`Extracting available platforms`, async () => {
|
||||
@ -37,7 +55,7 @@ actionsToolkit.run(
|
||||
silent: true
|
||||
}).then(res => {
|
||||
if (res.stderr.length > 0 && res.exitCode != 0) {
|
||||
throw new Error(res.stderr.trim());
|
||||
throw new Error(res.stderr.match(/(.*)\s*$/)?.[0]?.trim() ?? 'unknown error');
|
||||
}
|
||||
const platforms: Platforms = JSON.parse(res.stdout.trim());
|
||||
core.info(`${platforms.supported.join(',')}`);
|
||||
|
Reference in New Issue
Block a user