mirror of
https://github.com/docker/setup-buildx-action.git
synced 2024-11-30 09:39:02 +00:00
Group log output
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
parent
55b445ecbc
commit
f9ddc94e27
14
dist/index.js
generated
vendored
14
dist/index.js
generated
vendored
@ -515,7 +515,9 @@ function run() {
|
|||||||
const inputs = yield context.getInputs();
|
const inputs = yield context.getInputs();
|
||||||
const dockerConfigHome = process.env.DOCKER_CONFIG || path.join(os.homedir(), '.docker');
|
const dockerConfigHome = process.env.DOCKER_CONFIG || path.join(os.homedir(), '.docker');
|
||||||
if (!(yield buildx.isAvailable()) || inputs.version) {
|
if (!(yield buildx.isAvailable()) || inputs.version) {
|
||||||
|
core.startGroup(`👉 Installing Buildx`);
|
||||||
yield buildx.install(inputs.version || 'latest', dockerConfigHome);
|
yield buildx.install(inputs.version || 'latest', dockerConfigHome);
|
||||||
|
core.endGroup();
|
||||||
}
|
}
|
||||||
const buildxVersion = yield buildx.getVersion();
|
const buildxVersion = yield buildx.getVersion();
|
||||||
core.info(`📣 Buildx version: ${buildxVersion}`);
|
core.info(`📣 Buildx version: ${buildxVersion}`);
|
||||||
@ -523,7 +525,7 @@ function run() {
|
|||||||
core.setOutput('name', builderName);
|
core.setOutput('name', builderName);
|
||||||
stateHelper.setBuilderName(builderName);
|
stateHelper.setBuilderName(builderName);
|
||||||
if (inputs.driver !== 'docker') {
|
if (inputs.driver !== 'docker') {
|
||||||
core.info('🔨 Creating a new builder instance...');
|
core.startGroup(`🔨 Creating a new builder instance`);
|
||||||
let createArgs = ['buildx', 'create', '--name', builderName, '--driver', inputs.driver];
|
let createArgs = ['buildx', 'create', '--name', builderName, '--driver', inputs.driver];
|
||||||
if (semver.satisfies(buildxVersion, '>=0.3.0')) {
|
if (semver.satisfies(buildxVersion, '>=0.3.0')) {
|
||||||
let hasImageDriverOpt = false;
|
let hasImageDriverOpt = false;
|
||||||
@ -548,17 +550,21 @@ function run() {
|
|||||||
createArgs.push(inputs.endpoint);
|
createArgs.push(inputs.endpoint);
|
||||||
}
|
}
|
||||||
yield exec.exec('docker', createArgs);
|
yield exec.exec('docker', createArgs);
|
||||||
core.info('🏃 Booting builder...');
|
core.endGroup();
|
||||||
|
core.startGroup(`🏃 Booting builder`);
|
||||||
yield exec.exec('docker', ['buildx', 'inspect', '--bootstrap']);
|
yield exec.exec('docker', ['buildx', 'inspect', '--bootstrap']);
|
||||||
|
core.endGroup();
|
||||||
}
|
}
|
||||||
if (inputs.install) {
|
if (inputs.install) {
|
||||||
core.info('🤝 Setting buildx as default builder...');
|
core.startGroup(`🤝 Setting buildx as default builder`);
|
||||||
yield exec.exec('docker', ['buildx', 'install']);
|
yield exec.exec('docker', ['buildx', 'install']);
|
||||||
|
core.endGroup();
|
||||||
}
|
}
|
||||||
core.info('🛒 Extracting available platforms...');
|
core.startGroup(`🛒 Extracting available platforms`);
|
||||||
const platforms = yield buildx.platforms();
|
const platforms = yield buildx.platforms();
|
||||||
core.info(`${platforms}`);
|
core.info(`${platforms}`);
|
||||||
core.setOutput('platforms', platforms);
|
core.setOutput('platforms', platforms);
|
||||||
|
core.endGroup();
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
core.setFailed(error.message);
|
core.setFailed(error.message);
|
||||||
|
14
src/main.ts
14
src/main.ts
@ -19,7 +19,9 @@ async function run(): Promise<void> {
|
|||||||
const dockerConfigHome: string = process.env.DOCKER_CONFIG || path.join(os.homedir(), '.docker');
|
const dockerConfigHome: string = process.env.DOCKER_CONFIG || path.join(os.homedir(), '.docker');
|
||||||
|
|
||||||
if (!(await buildx.isAvailable()) || inputs.version) {
|
if (!(await buildx.isAvailable()) || inputs.version) {
|
||||||
|
core.startGroup(`👉 Installing Buildx`);
|
||||||
await buildx.install(inputs.version || 'latest', dockerConfigHome);
|
await buildx.install(inputs.version || 'latest', dockerConfigHome);
|
||||||
|
core.endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
const buildxVersion = await buildx.getVersion();
|
const buildxVersion = await buildx.getVersion();
|
||||||
@ -31,7 +33,7 @@ async function run(): Promise<void> {
|
|||||||
stateHelper.setBuilderName(builderName);
|
stateHelper.setBuilderName(builderName);
|
||||||
|
|
||||||
if (inputs.driver !== 'docker') {
|
if (inputs.driver !== 'docker') {
|
||||||
core.info('🔨 Creating a new builder instance...');
|
core.startGroup(`🔨 Creating a new builder instance`);
|
||||||
let createArgs: Array<string> = ['buildx', 'create', '--name', builderName, '--driver', inputs.driver];
|
let createArgs: Array<string> = ['buildx', 'create', '--name', builderName, '--driver', inputs.driver];
|
||||||
if (semver.satisfies(buildxVersion, '>=0.3.0')) {
|
if (semver.satisfies(buildxVersion, '>=0.3.0')) {
|
||||||
let hasImageDriverOpt: boolean = false;
|
let hasImageDriverOpt: boolean = false;
|
||||||
@ -56,20 +58,24 @@ async function run(): Promise<void> {
|
|||||||
createArgs.push(inputs.endpoint);
|
createArgs.push(inputs.endpoint);
|
||||||
}
|
}
|
||||||
await exec.exec('docker', createArgs);
|
await exec.exec('docker', createArgs);
|
||||||
|
core.endGroup();
|
||||||
|
|
||||||
core.info('🏃 Booting builder...');
|
core.startGroup(`🏃 Booting builder`);
|
||||||
await exec.exec('docker', ['buildx', 'inspect', '--bootstrap']);
|
await exec.exec('docker', ['buildx', 'inspect', '--bootstrap']);
|
||||||
|
core.endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inputs.install) {
|
if (inputs.install) {
|
||||||
core.info('🤝 Setting buildx as default builder...');
|
core.startGroup(`🤝 Setting buildx as default builder`);
|
||||||
await exec.exec('docker', ['buildx', 'install']);
|
await exec.exec('docker', ['buildx', 'install']);
|
||||||
|
core.endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
core.info('🛒 Extracting available platforms...');
|
core.startGroup(`🛒 Extracting available platforms`);
|
||||||
const platforms = await buildx.platforms();
|
const platforms = await buildx.platforms();
|
||||||
core.info(`${platforms}`);
|
core.info(`${platforms}`);
|
||||||
core.setOutput('platforms', platforms);
|
core.setOutput('platforms', platforms);
|
||||||
|
core.endGroup();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.setFailed(error.message);
|
core.setFailed(error.message);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user