1
0
Fork 0
mirror of https://github.com/docker/build-push-action.git synced 2025-04-22 14:46:39 +02:00

Throw error message instead of exit code

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax 2020-10-21 21:07:52 +02:00
parent 5af5c5fa9d
commit de804a56b7
No known key found for this signature in database
GPG key ID: 3248E46B6BB8C7F7
5 changed files with 76 additions and 14 deletions

14
dist/index.js generated vendored
View file

@ -2377,19 +2377,17 @@ const fs = __importStar(__webpack_require__(747));
const os = __importStar(__webpack_require__(87));
const buildx = __importStar(__webpack_require__(295));
const context = __importStar(__webpack_require__(842));
const exec = __importStar(__webpack_require__(757));
const stateHelper = __importStar(__webpack_require__(647));
const core = __importStar(__webpack_require__(186));
const exec = __importStar(__webpack_require__(514));
function run() {
return __awaiter(this, void 0, void 0, function* () {
try {
if (os.platform() !== 'linux') {
core.setFailed('Only supported on linux platform');
return;
throw new Error(`Only supported on linux platform`);
}
if (!(yield buildx.isAvailable())) {
core.setFailed(`Buildx is required. See https://github.com/docker/setup-buildx-action to set up buildx.`);
return;
throw new Error(`Buildx is required. See https://github.com/docker/setup-buildx-action to set up buildx.`);
}
stateHelper.setTmpDir(context.tmpDir());
const buildxVersion = yield buildx.getVersion();
@ -2398,7 +2396,11 @@ function run() {
let inputs = yield context.getInputs(defContext);
core.info(`🏃 Starting build...`);
const args = yield context.getArgs(inputs, defContext, buildxVersion);
yield exec.exec('docker', args);
yield exec.exec('docker', args).then(res => {
if (res.stderr != '' && !res.success) {
throw new Error(`buildx call failed with: ${res.stderr.match(/(.*)\s*$/)[0]}`);
}
});
const imageID = yield buildx.getImageID();
if (imageID) {
core.info('🛒 Extracting digest...');