mirror of
https://github.com/redhat-actions/buildah-build.git
synced 2025-04-20 17:11:23 +00:00
add debug logs
Signed-off-by: Luca Stocchi <lstocchi@redhat.com>
This commit is contained in:
parent
3c136d27ac
commit
20c4f351ec
4 changed files with 29 additions and 22 deletions
2
dist/index.js
vendored
2
dist/index.js
vendored
File diff suppressed because one or more lines are too long
2
dist/index.js.map
vendored
2
dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
|
@ -60,18 +60,17 @@ class BuildahCli {
|
||||||
}
|
}
|
||||||
let output = '';
|
let output = '';
|
||||||
let error = '';
|
let error = '';
|
||||||
const options = {
|
const options = {};
|
||||||
listeners: {
|
options.listeners = {
|
||||||
stdout: (data) => {
|
stdout: (data) => {
|
||||||
output += data.toString();
|
output += data.toString();
|
||||||
},
|
},
|
||||||
stderr: (data) => {
|
stderr: (data) => {
|
||||||
error += data.toString();
|
error += data.toString();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
yield exec.exec(`${this.executable}`, args, options);
|
const exitCode = yield exec.exec(this.executable, args, options);
|
||||||
if (error) {
|
if (exitCode === 1) {
|
||||||
return Promise.resolve({ succeeded: false, error: error });
|
return Promise.resolve({ succeeded: false, error: error });
|
||||||
}
|
}
|
||||||
return Promise.resolve({ succeeded: true, output: output });
|
return Promise.resolve({ succeeded: true, output: output });
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import * as core from "@actions/core";
|
||||||
import * as exec from "@actions/exec";
|
import * as exec from "@actions/exec";
|
||||||
|
|
||||||
interface Buildah {
|
interface Buildah {
|
||||||
|
@ -43,6 +44,9 @@ export class BuildahCli implements Buildah {
|
||||||
return await this.execute(['from', baseImage]);
|
return await this.execute(['from', baseImage]);
|
||||||
}
|
}
|
||||||
async copy(container: string, content: string, path?: string): Promise<CommandResult> {
|
async copy(container: string, content: string, path?: string): Promise<CommandResult> {
|
||||||
|
core.debug('copy');
|
||||||
|
core.debug(container);
|
||||||
|
core.debug(content);
|
||||||
const args: string[] = ["copy", container, content];
|
const args: string[] = ["copy", container, content];
|
||||||
if (path) {
|
if (path) {
|
||||||
args.push(path);
|
args.push(path);
|
||||||
|
@ -50,6 +54,8 @@ export class BuildahCli implements Buildah {
|
||||||
return await this.execute(args);
|
return await this.execute(args);
|
||||||
}
|
}
|
||||||
async config(container: string, settings: BuildahConfigSettings): Promise<CommandResult> {
|
async config(container: string, settings: BuildahConfigSettings): Promise<CommandResult> {
|
||||||
|
core.debug('config');
|
||||||
|
core.debug(container);
|
||||||
const args: string[] = ['config'];
|
const args: string[] = ['config'];
|
||||||
if (settings.entrypoint) {
|
if (settings.entrypoint) {
|
||||||
args.push('--entrypoint');
|
args.push('--entrypoint');
|
||||||
|
@ -63,6 +69,9 @@ export class BuildahCli implements Buildah {
|
||||||
return await this.execute(args);
|
return await this.execute(args);
|
||||||
}
|
}
|
||||||
async commit(container: string, newImageName: string, flags: string[] = []): Promise<CommandResult> {
|
async commit(container: string, newImageName: string, flags: string[] = []): Promise<CommandResult> {
|
||||||
|
core.debug('commit');
|
||||||
|
core.debug(container);
|
||||||
|
core.debug(newImageName);
|
||||||
const args: string[] = ["commit", ...flags, container, newImageName];
|
const args: string[] = ["commit", ...flags, container, newImageName];
|
||||||
return await this.execute(args);
|
return await this.execute(args);
|
||||||
}
|
}
|
||||||
|
@ -76,18 +85,17 @@ export class BuildahCli implements Buildah {
|
||||||
let output = '';
|
let output = '';
|
||||||
let error = '';
|
let error = '';
|
||||||
|
|
||||||
const options: exec.ExecOptions = {
|
const options: exec.ExecOptions = {};
|
||||||
listeners: {
|
options.listeners = {
|
||||||
stdout: (data: Buffer) => {
|
stdout: (data: Buffer): void => {
|
||||||
output += data.toString();
|
output += data.toString();
|
||||||
},
|
},
|
||||||
stderr: (data: Buffer) => {
|
stderr: (data: Buffer): void => {
|
||||||
error += data.toString();
|
error += data.toString();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
await exec.exec(`${this.executable}`, args, options);
|
const exitCode = await exec.exec(this.executable, args, options);
|
||||||
if (error) {
|
if (exitCode === 1) {
|
||||||
return Promise.resolve({ succeeded: false, error: error });
|
return Promise.resolve({ succeeded: false, error: error });
|
||||||
}
|
}
|
||||||
return Promise.resolve({ succeeded: true, output: output });
|
return Promise.resolve({ succeeded: true, output: output });
|
||||||
|
|
Loading…
Reference in a new issue