sanitify output buildah from cmd

Signed-off-by: Luca Stocchi <lstocchi@redhat.com>
This commit is contained in:
Luca Stocchi 2020-11-07 00:08:05 +01:00
parent 20c4f351ec
commit b5c3b226ac
No known key found for this signature in database
GPG key ID: 930BB00F3FCF30A4
5 changed files with 13 additions and 4 deletions

2
dist/index.js vendored

File diff suppressed because one or more lines are too long

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View file

@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
}; };
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.BuildahCli = void 0; exports.BuildahCli = void 0;
const core = require("@actions/core");
const exec = require("@actions/exec"); const exec = require("@actions/exec");
class BuildahCli { class BuildahCli {
constructor(executable) { constructor(executable) {
@ -25,6 +26,9 @@ class BuildahCli {
} }
copy(container, content, path) { copy(container, content, path) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
core.debug('copy');
core.debug(container);
core.debug(content);
const args = ["copy", container, content]; const args = ["copy", container, content];
if (path) { if (path) {
args.push(path); args.push(path);
@ -34,6 +38,8 @@ class BuildahCli {
} }
config(container, settings) { config(container, settings) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
core.debug('config');
core.debug(container);
const args = ['config']; const args = ['config'];
if (settings.entrypoint) { if (settings.entrypoint) {
args.push('--entrypoint'); args.push('--entrypoint');
@ -49,6 +55,9 @@ class BuildahCli {
} }
commit(container, newImageName, flags = []) { commit(container, newImageName, flags = []) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
core.debug('commit');
core.debug(container);
core.debug(newImageName);
const args = ["commit", ...flags, container, newImageName]; const args = ["commit", ...flags, container, newImageName];
return yield this.execute(args); return yield this.execute(args);
}); });

View file

@ -38,7 +38,7 @@ function run() {
if (creationResult.succeeded === false) { if (creationResult.succeeded === false) {
return Promise.reject(new Error(creationResult.reason)); return Promise.reject(new Error(creationResult.reason));
} }
const containerId = creationResult.output; const containerId = creationResult.output.replace('\n', '');
const copyResult = yield cli.copy(containerId, content); const copyResult = yield cli.copy(containerId, content);
if (copyResult.succeeded === false) { if (copyResult.succeeded === false) {
return Promise.reject(new Error(copyResult.reason)); return Promise.reject(new Error(copyResult.reason));

View file

@ -28,7 +28,7 @@ export async function run(): Promise<void> {
if (creationResult.succeeded === false) { if (creationResult.succeeded === false) {
return Promise.reject(new Error(creationResult.reason)); return Promise.reject(new Error(creationResult.reason));
} }
const containerId = creationResult.output; const containerId = creationResult.output.replace('\n', '');
const copyResult = await cli.copy(containerId, content); const copyResult = await cli.copy(containerId, content);
if (copyResult.succeeded === false) { if (copyResult.succeeded === false) {