1
0
Fork 0
mirror of https://github.com/docker/setup-buildx-action.git synced 2025-05-10 08:29:30 +02:00

Use built-in getExecOutput

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax 2021-06-23 16:11:52 +02:00
parent faca7837b0
commit 29f1eeb9e5
No known key found for this signature in database
GPG key ID: 3248E46B6BB8C7F7
6 changed files with 569 additions and 579 deletions

View file

@ -1,12 +1,11 @@
import * as core from '@actions/core';
import * as exec from '@actions/exec';
import * as os from 'os';
import * as path from 'path';
import * as semver from 'semver';
import * as buildx from './buildx';
import * as context from './context';
import * as mexec from './exec';
import * as stateHelper from './state-helper';
import * as core from '@actions/core';
import * as exec from '@actions/exec';
async function run(): Promise<void> {
try {
@ -94,21 +93,29 @@ async function run(): Promise<void> {
async function cleanup(): Promise<void> {
if (stateHelper.IsDebug && stateHelper.containerName.length > 0) {
core.startGroup(`BuildKit container logs`);
await mexec.exec('docker', ['logs', `${stateHelper.containerName}`], false).then(res => {
if (res.stderr.length > 0 && !res.success) {
core.warning(res.stderr);
}
});
await exec
.getExecOutput('docker', ['logs', `${stateHelper.containerName}`], {
ignoreReturnCode: true
})
.then(res => {
if (res.stderr.length > 0 && res.exitCode != 0) {
core.warning(res.stderr.trim());
}
});
core.endGroup();
}
if (stateHelper.builderName.length > 0) {
core.startGroup(`Removing builder`);
await mexec.exec('docker', ['buildx', 'rm', `${stateHelper.builderName}`], false).then(res => {
if (res.stderr.length > 0 && !res.success) {
core.warning(res.stderr);
}
});
await exec
.getExecOutput('docker', ['buildx', 'rm', `${stateHelper.builderName}`], {
ignoreReturnCode: true
})
.then(res => {
if (res.stderr.length > 0 && res.exitCode != 0) {
core.warning(res.stderr.trim());
}
});
core.endGroup();
}
}