Skip to content

Commit 99cb7de

Browse files
authored
[HelmDeployV0] Added newline to comma conversion logic (#13579)
* Added newline to comma conversion logic * Adding filter for removing null values * Resolving PR comments
1 parent 6671746 commit 99cb7de

File tree

6 files changed

+13
-8
lines changed

6 files changed

+13
-8
lines changed

Tasks/HelmDeployV0/Strings/resources.resjson/en-US/resources.resjson

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"loc.input.label.releaseName": "Release Name",
4242
"loc.input.help.releaseName": "Release name. If unspecified, it will autogenerate one for you.",
4343
"loc.input.label.overrideValues": "Set Values",
44-
"loc.input.help.overrideValues": "Set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2). The task will construct the helm command by using these set values. For example, helm install --set key1=val1 ./redis.",
44+
"loc.input.help.overrideValues": "Set values on the command line (can specify multiple or separate values with commas or newlines: key1=val1,key2=val2 or <br>key1=val1<br>key2=val2<br>). The task will construct the helm command by using these set values. For example, helm install --set key1=val1 ./redis.",
4545
"loc.input.label.valueFile": "Value File",
4646
"loc.input.help.valueFile": "Specify values in a YAML file or a URL. For example, specifying myvalues.yaml will result in 'helm install --values=myvals.yaml'.",
4747
"loc.input.label.destination": "Destination",

Tasks/HelmDeployV0/src/helmcommands/helminstall.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export function addArguments(helmCli: helmcli): void {
4242
}
4343

4444
if (overrideValues) {
45-
helmCli.addArgument("--set ".concat(overrideValues));
45+
helmCli.addArgument("--set ".concat(helmutil.replaceNewlinesWithCommas(overrideValues)));
4646
}
4747

4848
if (updatedependency) {

Tasks/HelmDeployV0/src/helmcommands/helmupgrade.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export function addArguments(helmCli: helmcli): void {
5454
}
5555

5656
if (overrideValues) {
57-
helmCli.addArgument("--set ".concat(overrideValues));
57+
helmCli.addArgument("--set ".concat(helmutil.replaceNewlinesWithCommas(overrideValues)));
5858
}
5959

6060
if (waitForExecution) {

Tasks/HelmDeployV0/src/utils.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,9 @@ export function addVersion(helmCli: helmcli, version: string) {
9898
helmCli.addArgument("--version ".concat(version));
9999
else
100100
console.log("The given version is not valid. Running the helm install command with latest version");
101+
}
102+
103+
export function replaceNewlinesWithCommas(overrideValues: string): string {
104+
const keyValuePairs = overrideValues.split("\n").filter(pair => pair);
105+
return keyValuePairs.join(",");
101106
}

Tasks/HelmDeployV0/task.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
"author": "Microsoft Corporation",
1414
"version": {
1515
"Major": 0,
16-
"Minor": 175,
17-
"Patch": 4
16+
"Minor": 176,
17+
"Patch": 0
1818
},
1919
"demands": [],
2020
"groups": [
@@ -253,7 +253,7 @@
253253
"name": "overrideValues",
254254
"label": "Set Values",
255255
"type": "string",
256-
"helpMarkDown": "Set values on the command line (can specify multiple or separate values with commas: key1=val1,key2=val2). The task will construct the helm command by using these set values. For example, helm install --set key1=val1 ./redis.",
256+
"helpMarkDown": "Set values on the command line (can specify multiple or separate values with commas or newlines: key1=val1,key2=val2 or <br>key1=val1<br>key2=val2<br>). The task will construct the helm command by using these set values. For example, helm install --set key1=val1 ./redis.",
257257
"defaultValue": "",
258258
"visibleRule": "command == install || command == upgrade",
259259
"groupName": "commands"

Tasks/HelmDeployV0/task.loc.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
"author": "Microsoft Corporation",
1414
"version": {
1515
"Major": 0,
16-
"Minor": 175,
17-
"Patch": 4
16+
"Minor": 176,
17+
"Patch": 0
1818
},
1919
"demands": [],
2020
"groups": [

0 commit comments

Comments
 (0)