mirror of
https://github.com/redhat-actions/buildah-build.git
synced 2025-04-20 09:01:23 +00:00
Group version output in the worklflow
Signed-off-by: divyansh42 <diagrawa@redhat.com>
This commit is contained in:
parent
133ced04cc
commit
a986183b13
4 changed files with 32 additions and 16 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
|
@ -163,7 +163,10 @@ export class BuildahCli implements Buildah {
|
|||
return `${arrayAsString.slice(0, -1)}]`;
|
||||
}
|
||||
|
||||
async execute(args: string[], execOptions: exec.ExecOptions = {}): Promise<CommandResult> {
|
||||
async execute(
|
||||
args: string[],
|
||||
execOptions: exec.ExecOptions & { group?: boolean } = {},
|
||||
): Promise<CommandResult> {
|
||||
// ghCore.info(`${EXECUTABLE} ${args.join(" ")}`)
|
||||
|
||||
let stdout = "";
|
||||
|
@ -181,6 +184,11 @@ export class BuildahCli implements Buildah {
|
|||
},
|
||||
};
|
||||
|
||||
if (execOptions.group) {
|
||||
const groupName = [ this.executable, ...args ].join(" ");
|
||||
core.startGroup(groupName);
|
||||
}
|
||||
|
||||
// To solve https://github.com/redhat-actions/buildah-build/issues/45
|
||||
const execEnv: { [key: string] : string } = {};
|
||||
Object.entries(process.env).forEach(([ key, value ]) => {
|
||||
|
@ -195,6 +203,7 @@ export class BuildahCli implements Buildah {
|
|||
|
||||
finalExecOptions.env = execEnv;
|
||||
|
||||
try {
|
||||
const exitCode = await exec.exec(this.executable, args, finalExecOptions);
|
||||
|
||||
if (execOptions.ignoreReturnCode !== true && exitCode !== 0) {
|
||||
|
@ -211,4 +220,11 @@ export class BuildahCli implements Buildah {
|
|||
exitCode, output: stdout, error: stderr,
|
||||
};
|
||||
}
|
||||
|
||||
finally {
|
||||
if (execOptions.group) {
|
||||
core.endGroup();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ export async function run(): Promise<void> {
|
|||
const cli: BuildahCli = new BuildahCli(buildahPath);
|
||||
|
||||
// print buildah version
|
||||
await cli.execute([ "version" ]);
|
||||
await cli.execute([ "version" ], { group: true });
|
||||
|
||||
// Check if fuse-overlayfs exists and find the storage driver
|
||||
await cli.setStorageOptsEnv();
|
||||
|
|
Loading…
Reference in a new issue