Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Users/jcfiorenzano/add buildkit support docker v0 v1 #15326

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions Tasks/DockerV0/containerbuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,19 @@ export function run(connection: ContainerConnection): any {
output += data;
});

let err: string = "";
command.on("stderr", data =>{
err += data;
});

return connection.execCommand(command).then(() => {
if (isBuildKitEnabled())
{
// Build kit output the build results to stderr instead of stdout
// https://github.com/moby/moby/issues/40031
output = err;
}

let taskOutputPath = utils.writeTaskOutput("build", output);
tl.setVariable("DockerOutputPath", taskOutputPath);

Expand All @@ -87,3 +99,9 @@ export function run(connection: ContainerConnection): any {
}
});
}

function isBuildKitEnabled(): boolean {
// https://docs.docker.com/develop/develop-images/build_enhancements/
const isBuildKitBuildValue = tl.getVariable("DOCKER_BUILDKIT");
return isBuildKitBuildValue && Number(isBuildKitBuildValue) == 1;
}
2 changes: 1 addition & 1 deletion Tasks/DockerV0/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 0,
"Minor": 192,
"Minor": 194,
"Patch": 0
},
"demands": [],
Expand Down
2 changes: 1 addition & 1 deletion Tasks/DockerV0/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 0,
"Minor": 192,
"Minor": 194,
"Patch": 0
},
"demands": [],
Expand Down
18 changes: 18 additions & 0 deletions Tasks/DockerV1/containerbuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,19 @@ export function run(connection: ContainerConnection): any {
output += data;
});

let err: string = "";
command.on("stderr", data =>{
err += data;
});

return connection.execCommand(command).then(() => {
if (isBuildKitEnabled())
{
// Build kit output the build results to stderr instead of stdout
// https://github.com/moby/moby/issues/40031
output = err;
}

let taskOutputPath = utils.writeTaskOutput("build", output);
tl.setVariable("DockerOutputPath", taskOutputPath);

Expand All @@ -90,3 +102,9 @@ export function run(connection: ContainerConnection): any {
}
});
}

function isBuildKitEnabled(): boolean {
// https://docs.docker.com/develop/develop-images/build_enhancements/
const isBuildKitBuildValue = tl.getVariable("DOCKER_BUILDKIT");
return isBuildKitBuildValue && Number(isBuildKitBuildValue) == 1;
}
2 changes: 1 addition & 1 deletion Tasks/DockerV1/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 1,
"Minor": 192,
"Minor": 194,
"Patch": 0
},
"demands": [],
Expand Down
2 changes: 1 addition & 1 deletion Tasks/DockerV1/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"author": "Microsoft Corporation",
"version": {
"Major": 1,
"Minor": 192,
"Minor": 194,
"Patch": 0
},
"demands": [],
Expand Down