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 Feb 5, 2024
1 parent e931756 commit 5f3d047
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 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-lock.json

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

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 5f3d047

Please sign in to comment.