Skip to content

Commit e25488f

Browse files
authored
Merge pull request #11773 from microsoft/users/ansheno/m159Helmfix3
Users/ansheno/m159 helmfix3
2 parents 57a57f6 + 117a4b8 commit e25488f

File tree

6 files changed

+30
-19
lines changed

6 files changed

+30
-19
lines changed

Tasks/HelmInstallerV0/src/helmtoolinstaller.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import * as helminstaller from "./helminstaller"
1010

1111
tl.setResourcePath(path.join(__dirname, '..', 'task.json'));
1212

13+
var helmVersion = ""
14+
1315
async function configureKubectl() {
1416
var version = await kubectlinstaller.getKuberctlVersion();
1517
var kubectlPath = await kubectlinstaller.downloadKubectl(version);
@@ -21,8 +23,8 @@ async function configureKubectl() {
2123
}
2224

2325
async function configureHelm() {
24-
var version = await helminstaller.getHelmVersion();
25-
var helmPath = await helminstaller.downloadHelm(version);
26+
helmVersion = await helminstaller.getHelmVersion();
27+
var helmPath = await helminstaller.downloadHelm(helmVersion);
2628

2729
// prepend the tools path. instructs the agent to prepend for future tasks
2830
if (!process.env['PATH'].startsWith(path.dirname(helmPath))) {
@@ -33,10 +35,14 @@ async function configureHelm() {
3335
async function verifyHelm() {
3436
console.log(tl.loc("VerifyHelmInstallation"));
3537
var helmToolPath = tl.which("helm", true);
36-
var helmTool = tl.tool(helmToolPath);
37-
helmTool.arg("init");
38-
helmTool.arg("--client-only");
39-
return helmTool.exec()
38+
39+
// Check if using Helm 2 or Helm 3
40+
if (helmVersion.startsWith("v2")) {
41+
var helmTool = tl.tool(helmToolPath);
42+
helmTool.arg("init");
43+
helmTool.arg("--client-only");
44+
return helmTool.exec()
45+
}
4046
}
4147

4248
configureHelm()

Tasks/HelmInstallerV0/task.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": 155,
17-
"Patch": 1
16+
"Minor": 159,
17+
"Patch": 0
1818
},
1919
"demands": [],
2020
"satisfies": [

Tasks/HelmInstallerV0/task.loc.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": 155,
17-
"Patch": 1
16+
"Minor": 159,
17+
"Patch": 0
1818
},
1919
"demands": [],
2020
"satisfies": [
@@ -93,4 +93,4 @@
9393
"HelmLatestNotKnown": "ms-resource:loc.messages.HelmLatestNotKnown",
9494
"VerifyHelmInstallation": "ms-resource:loc.messages.VerifyHelmInstallation"
9595
}
96-
}
96+
}

Tasks/HelmInstallerV1/src/helmtoolinstaller.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ import utils = require("./utils");
77

88
tl.setResourcePath(path.join(__dirname, '..', 'task.json'));
99

10+
var version = ""
1011

1112
async function configureHelm() {
12-
var version = await utils.getHelmVersion();
13+
version = await utils.getHelmVersion();
1314
var helmPath = await utils.downloadHelm(version);
1415

1516
// prepend the tools path. instructs the agent to prepend for future tasks
@@ -21,10 +22,14 @@ async function configureHelm() {
2122
async function verifyHelm() {
2223
console.log(tl.loc("VerifyHelmInstallation"));
2324
var helmToolPath = tl.which("helm", true);
24-
var helmTool = tl.tool(helmToolPath);
25-
helmTool.arg("init");
26-
helmTool.arg("--client-only");
27-
return helmTool.exec()
25+
26+
// Check if using Helm 2 or Helm 3
27+
if (version.startsWith("v2")) {
28+
var helmTool = tl.tool(helmToolPath);
29+
helmTool.arg("init");
30+
helmTool.arg("--client-only");
31+
return helmTool.exec()
32+
}
2833
}
2934

3035
configureHelm()

Tasks/HelmInstallerV1/task.json

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

Tasks/HelmInstallerV1/task.loc.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"version": {
1515
"Major": 1,
1616
"Minor": 159,
17-
"Patch": 2
17+
"Patch": 3
1818
},
1919
"preview": true,
2020
"demands": [],
@@ -41,4 +41,4 @@
4141
"NotAValidSemverVersion": "ms-resource:loc.messages.NotAValidSemverVersion",
4242
"VerifyHelmInstallation": "ms-resource:loc.messages.VerifyHelmInstallation"
4343
}
44-
}
44+
}

0 commit comments

Comments
 (0)