Skip to content

Commit 35188f7

Browse files
authored
Adding null check for tag input in DockerV2 - Porting to release (#14266)
* Adding null check for tag input in DockerV2 * Adding null check in docker push
1 parent 87f91ea commit 35188f7

File tree

4 files changed

+17
-12
lines changed

4 files changed

+17
-12
lines changed

Tasks/DockerV2/dockerbuild.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,10 @@ export function run(connection: ContainerConnection, outputUpdate: (data: string
5151
imageNames.forEach(imageName => {
5252
if (tags && tags.length > 0) {
5353
tags.forEach(tag => {
54-
tagArguments.push(imageName + ":" + tag);
54+
if(tag)
55+
{
56+
tagArguments.push(imageName + ":" + tag);
57+
}
5558
});
5659
}
5760
else {

Tasks/DockerV2/dockerpush.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,17 @@ function pushMultipleImages(connection: ContainerConnection, imageNames: string[
2222
imageNames.forEach(imageName => {
2323
if (tags && tags.length > 0) {
2424
tags.forEach(tag => {
25-
let imageNameWithTag = imageName + ":" + tag;
26-
tl.debug("Pushing ImageNameWithTag: " + imageNameWithTag);
27-
if (promise) {
28-
promise = promise.then(() => {
29-
return dockerCommandUtils.push(connection, imageNameWithTag, commandArguments, onCommandOut)
30-
});
31-
}
32-
else {
33-
promise = dockerCommandUtils.push(connection, imageNameWithTag, commandArguments, onCommandOut);
25+
if (tag) {
26+
let imageNameWithTag = imageName + ":" + tag;
27+
tl.debug("Pushing ImageNameWithTag: " + imageNameWithTag);
28+
if (promise) {
29+
promise = promise.then(() => {
30+
return dockerCommandUtils.push(connection, imageNameWithTag, commandArguments, onCommandOut)
31+
});
32+
}
33+
else {
34+
promise = dockerCommandUtils.push(connection, imageNameWithTag, commandArguments, onCommandOut);
35+
}
3436
}
3537
});
3638
}

Tasks/DockerV2/task.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"version": {
1515
"Major": 2,
1616
"Minor": 181,
17-
"Patch": 0
17+
"Patch": 2
1818
},
1919
"minimumAgentVersion": "2.172.0",
2020
"demands": [],

Tasks/DockerV2/task.loc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"version": {
1515
"Major": 2,
1616
"Minor": 181,
17-
"Patch": 0
17+
"Patch": 2
1818
},
1919
"minimumAgentVersion": "2.172.0",
2020
"demands": [],

0 commit comments

Comments
 (0)