1
0
Fork 0
mirror of https://github.com/docker/build-push-action.git synced 2025-05-06 21:49:33 +02:00

Use built-in getExecOutput

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax 2021-06-22 19:52:21 +02:00
parent a7071c9d9a
commit a437a4518f
No known key found for this signature in database
GPG key ID: 3248E46B6BB8C7F7
6 changed files with 415 additions and 473 deletions

View file

@ -1,9 +1,9 @@
import * as fs from 'fs';
import * as buildx from './buildx';
import * as context from './context';
import * as exec 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 {
@ -23,11 +23,15 @@ async function run(): Promise<void> {
let inputs: context.Inputs = await context.getInputs(defContext);
const args: string[] = await context.getArgs(inputs, defContext, buildxVersion);
await exec.exec('docker', args).then(res => {
if (res.stderr != '' && !res.success) {
throw new Error(`buildx call failed with: ${res.stderr.match(/(.*)\s*$/)![0]}`);
}
});
await exec
.getExecOutput('docker', args, {
ignoreReturnCode: true
})
.then(res => {
if (res.stderr.length > 0 && res.exitCode != 0) {
throw new Error(`buildx bake failed with: ${res.stderr.match(/(.*)\s*$/)![0].trim()}`);
}
});
const imageID = await buildx.getImageID();
if (imageID) {