mirror of
https://github.com/docker/setup-buildx-action.git
synced 2025-03-28 11:00:07 +01:00
WIP - always download precompiled binaries first
before this change, we would try to determine ahead of time if we should build from source. after this change, we try to download precompiled binaries first, and only fall back to a source build if that fails. building from source can take up to 2 minutes, so is probably too slow for most users. Signed-off-by: Nick Santos <nick.santos@docker.com>
This commit is contained in:
parent
16c0bc4a6e
commit
f915b50e4f
3 changed files with 22 additions and 9 deletions
4
dist/index.js
generated
vendored
4
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
25
src/main.ts
25
src/main.ts
|
@ -32,19 +32,32 @@ actionsToolkit.run(
|
|||
}
|
||||
});
|
||||
|
||||
let toolPath;
|
||||
if (Util.isValidRef(inputs.version)) {
|
||||
let toolPath = '';
|
||||
let downloadFailed = false;
|
||||
if (!(await toolkit.buildx.isAvailable()) || inputs.version) {
|
||||
try {
|
||||
await core.group(`Download buildx from GitHub Releases`, async () => {
|
||||
toolPath = await toolkit.buildxInstall.download(inputs.version || 'latest');
|
||||
});
|
||||
} catch (e) {
|
||||
core.info(`Download buildx failed: ${e}`);
|
||||
downloadFailed = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!toolPath && Util.isValidRef(inputs.version)) {
|
||||
if (downloadFailed) {
|
||||
core.info(`After failed download, falling back to building from source`);
|
||||
}
|
||||
|
||||
if (standalone) {
|
||||
throw new Error(`Cannot build from source without the Docker CLI`);
|
||||
}
|
||||
await core.group(`Build buildx from source`, async () => {
|
||||
toolPath = await toolkit.buildxInstall.build(inputs.version);
|
||||
});
|
||||
} else if (!(await toolkit.buildx.isAvailable()) || inputs.version) {
|
||||
await core.group(`Download buildx from GitHub Releases`, async () => {
|
||||
toolPath = await toolkit.buildxInstall.download(inputs.version || 'latest');
|
||||
});
|
||||
}
|
||||
|
||||
if (toolPath) {
|
||||
await core.group(`Install buildx`, async () => {
|
||||
if (standalone) {
|
||||
|
|
Loading…
Add table
Reference in a new issue