Allow building buildx from source

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax 2021-07-02 07:02:22 +02:00
parent a1c666d855
commit f40e8894f1
No known key found for this signature in database
GPG key ID: 3248E46B6BB8C7F7
14 changed files with 342 additions and 44 deletions

View file

@ -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) => {