Skip to content

Commit

Permalink
Merge pull request #62 from stuartleeks/sl/silent-buildx-check
Browse files Browse the repository at this point in the history
Suppress buildx check output
  • Loading branch information
stuartleeks authored Jun 22, 2021
2 parents 50291aa + 9b2b18e commit 6200cc2
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 11 deletions.
4 changes: 2 additions & 2 deletions azdo-task/DevContainerBuildRun/src/docker.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as task from 'azure-pipelines-task-lib/task'
import * as docker from '../../../common/src/docker'
import {exec} from './exec'
import {exec, execSilent} from './exec'

export async function isDockerBuildXInstalled(): Promise<boolean> {
return await docker.isDockerBuildXInstalled(exec)
Expand All @@ -12,7 +12,7 @@ export async function buildImage(
): Promise<boolean> {
console.log('🏗 Building dev container...')
try {
await docker.buildImage(exec, imageName, checkoutPath, subFolder)
await docker.buildImage(execSilent, imageName, checkoutPath, subFolder)
return true
} catch (error) {
task.setResult(task.TaskResult.Failed, error)
Expand Down
11 changes: 10 additions & 1 deletion azdo-task/DevContainerBuildRun/src/exec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,16 @@ import * as task from 'azure-pipelines-task-lib/task'
export async function exec(command: string, args: string[]): Promise<number> {
const exitCode = await task.exec(command, args, {
failOnStdErr: false,
silent: false, // TODO add execSilent for BuildX install check
silent: false,
ignoreReturnCode: true
})

return exitCode
}
export async function execSilent(command: string, args: string[]): Promise<number> {
const exitCode = await task.exec(command, args, {
failOnStdErr: false,
silent: true,
ignoreReturnCode: true
})

Expand Down
15 changes: 13 additions & 2 deletions github-action/dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion github-action/dist/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion github-action/lib/docker.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const docker = __importStar(require("../../common/src/docker"));
const exec_1 = require("./exec");
function isDockerBuildXInstalled() {
return __awaiter(this, void 0, void 0, function* () {
return yield docker.isDockerBuildXInstalled(exec_1.exec);
return yield docker.isDockerBuildXInstalled(exec_1.execSilent);
});
}
exports.isDockerBuildXInstalled = isDockerBuildXInstalled;
Expand Down
13 changes: 12 additions & 1 deletion github-action/lib/exec.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.exec = void 0;
exports.execSilent = exports.exec = void 0;
const actions_exec = __importStar(require("@actions/exec"));
function exec(command, args) {
return __awaiter(this, void 0, void 0, function* () {
Expand All @@ -41,3 +41,14 @@ function exec(command, args) {
});
}
exports.exec = exec;
function execSilent(command, args) {
return __awaiter(this, void 0, void 0, function* () {
const actionOptions = {
ignoreReturnCode: true,
silent: true
};
const exitCode = yield actions_exec.exec(command, args, actionOptions);
return exitCode;
});
}
exports.execSilent = execSilent;
5 changes: 2 additions & 3 deletions github-action/src/docker.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import * as core from '@actions/core'
import {check} from 'prettier'
import * as docker from '../../common/src/docker'
import {exec} from './exec'
import {exec, execSilent} from './exec'


export async function isDockerBuildXInstalled(): Promise<boolean> {
return await docker.isDockerBuildXInstalled(exec)
return await docker.isDockerBuildXInstalled(execSilent)
}
export async function buildImage(
imageName: string,
Expand Down
14 changes: 14 additions & 0 deletions github-action/src/exec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,17 @@ export async function exec(

return exitCode;
}

export async function execSilent(
command: string,
args: string[]
): Promise<number> {

const actionOptions: actions_exec.ExecOptions = {
ignoreReturnCode: true,
silent: true
}
const exitCode = await actions_exec.exec(command, args, actionOptions)

return exitCode;
}

0 comments on commit 6200cc2

Please sign in to comment.