Skip to content

Commit cc73cdd

Browse files
Make Docker command exec error output optional based on the pipeline feature (#445)
* Make Docker exec error logging optional based on the HideDockerExecTaskLogIssueErrorOutput feature flag. Context: When the flag is enabled, Docker exec log output is processed as error logs rather than individual log issues, resulting in a cleaner build UI where these errors are not displayed. * Move getPipelineFeature outside the loop to cache its value * Update the docker-common package verison
1 parent 88e7c7c commit cc73cdd

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

common-npm-packages/docker-common/containerconnection.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,29 @@ export default class ContainerConnection {
4343
public execCommand(command: tr.ToolRunner, options?: tr.IExecOptions) {
4444
let errlines = [];
4545
let dockerHostVar = tl.getVariable("DOCKER_HOST");
46+
4647
if (dockerHostVar) {
4748
tl.debug(tl.loc('ConnectingToDockerHost', dockerHostVar));
4849
}
4950

5051
command.on("errline", line => {
5152
errlines.push(line);
5253
});
53-
return command.exec(options).fail(error => {
54+
55+
const hideDockerExecTaskLogIssueErrorOutput = tl.getPipelineFeature("hideDockerExecTaskLogIssueErrorOutput");
56+
57+
return command.exec(options).fail(error => {
5458
if (dockerHostVar) {
5559
tl.warning(tl.loc('DockerHostVariableWarning', dockerHostVar));
5660
}
5761

58-
errlines.forEach(line => tl.error(line));
62+
errlines.forEach(line => {
63+
if (hideDockerExecTaskLogIssueErrorOutput) {
64+
console.log(`##[error]${line}`);
65+
} else {
66+
tl.error(line);
67+
}
68+
});
5969
throw error;
6070
});
6171
}

common-npm-packages/docker-common/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

common-npm-packages/docker-common/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "azure-pipelines-tasks-docker-common",
3-
"version": "2.254.0",
3+
"version": "2.256.0",
44
"description": "Common Library for Azure Rest Calls",
55
"repository": {
66
"type": "git",

0 commit comments

Comments
 (0)