Skip to content

Commit

Permalink
Fix built image id output for subsequent builds
Browse files Browse the repository at this point in the history
For the first `docker build` task in a job, DOCKER_TASK_BUILT_IMAGES is
correct. But for subsequent builds, instead of appending the new image's
hash it was duplicating the list, e.g.

- after first build: firstBuildId
- after second build: firstBuildId;firstBuildId
- after third build: firstBuildId;firstBuildId;firstBuildId;firstBuildId
- etc.

Instead we append the new image hash, as was seemingly the original
intention. So now:

- after first build: firstBuildId
- after second build: firstBuildId;secondBuildId
- after third build: firstBuildId;secondBuildId;thirdBuildId
- etc.
  • Loading branch information
philipfalkner committed Jan 26, 2024
1 parent 470ed3d commit 0de7b20
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion common-npm-packages/docker-common/containerimageutils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ export function shareBuiltImageId(builtImageId: string) {
let builtImages: string = tl.getVariable("DOCKER_TASK_BUILT_IMAGES");

if (builtImages && builtImages != "") {
const newImageId = `${IMAGE_SEPARATOR_CHAR}${builtImages}`;
const newImageId = `${IMAGE_SEPARATOR_CHAR}${builtImageId}`;

if (newImageId.length + builtImages.length > ENV_VARIABLE_MAX_SIZE) {
tl.debug("Images id truncated maximum environment variable size reached.");
Expand Down
2 changes: 1 addition & 1 deletion common-npm-packages/docker-common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "azure-pipelines-tasks-docker-common",
"version": "2.226.0",
"version": "2.226.1",
"description": "Common Library for Azure Rest Calls",
"repository": {
"type": "git",
Expand Down

0 comments on commit 0de7b20

Please sign in to comment.