mirror of
https://github.com/docker/setup-buildx-action.git
synced 2025-04-20 01:26:46 +00:00
Allow building buildx from source
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
parent
a1c666d855
commit
f40e8894f1
14 changed files with 342 additions and 44 deletions
|
@ -1,10 +1,20 @@
|
|||
import fs from 'fs';
|
||||
import * as os from 'os';
|
||||
import path from 'path';
|
||||
import * as core from '@actions/core';
|
||||
import {issueCommand} from '@actions/core/lib/command';
|
||||
|
||||
let _tmpDir: string;
|
||||
export const osPlat: string = os.platform();
|
||||
export const osArch: string = os.arch();
|
||||
|
||||
export function tmpDir(): string {
|
||||
if (!_tmpDir) {
|
||||
_tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'docker-setup-buildx-')).split(path.sep).join(path.posix.sep);
|
||||
}
|
||||
return _tmpDir;
|
||||
}
|
||||
|
||||
export interface Inputs {
|
||||
version: string;
|
||||
driver: string;
|
||||
|
@ -21,9 +31,7 @@ export async function getInputs(): Promise<Inputs> {
|
|||
version: core.getInput('version'),
|
||||
driver: core.getInput('driver') || 'docker-container',
|
||||
driverOpts: await getInputList('driver-opts', true),
|
||||
buildkitdFlags:
|
||||
core.getInput('buildkitd-flags') ||
|
||||
'--allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host',
|
||||
buildkitdFlags: core.getInput('buildkitd-flags') || '--allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host',
|
||||
install: core.getBooleanInput('install'),
|
||||
use: core.getBooleanInput('use'),
|
||||
endpoint: core.getInput('endpoint'),
|
||||
|
@ -39,10 +47,7 @@ export async function getInputList(name: string, ignoreComma?: boolean): Promise
|
|||
return items
|
||||
.split(/\r?\n/)
|
||||
.filter(x => x)
|
||||
.reduce<string[]>(
|
||||
(acc, line) => acc.concat(!ignoreComma ? line.split(',').filter(x => x) : line).map(pat => pat.trim()),
|
||||
[]
|
||||
);
|
||||
.reduce<string[]>((acc, line) => acc.concat(!ignoreComma ? line.split(',').filter(x => x) : line).map(pat => pat.trim()), []);
|
||||
}
|
||||
|
||||
export const asyncForEach = async (array, callback) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue