Skip to content

Commit

Permalink
Merge pull request #11773 from microsoft/users/ansheno/m159Helmfix3
Browse files Browse the repository at this point in the history
Users/ansheno/m159 helmfix3
  • Loading branch information
Anumita authored Nov 14, 2019
2 parents 57a57f6 + 117a4b8 commit e25488f
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 19 deletions.
18 changes: 12 additions & 6 deletions Tasks/HelmInstallerV0/src/helmtoolinstaller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import * as helminstaller from "./helminstaller"

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

var helmVersion = ""

async function configureKubectl() {
var version = await kubectlinstaller.getKuberctlVersion();
var kubectlPath = await kubectlinstaller.downloadKubectl(version);
Expand All @@ -21,8 +23,8 @@ async function configureKubectl() {
}

async function configureHelm() {
var version = await helminstaller.getHelmVersion();
var helmPath = await helminstaller.downloadHelm(version);
helmVersion = await helminstaller.getHelmVersion();
var helmPath = await helminstaller.downloadHelm(helmVersion);

// prepend the tools path. instructs the agent to prepend for future tasks
if (!process.env['PATH'].startsWith(path.dirname(helmPath))) {
Expand All @@ -33,10 +35,14 @@ async function configureHelm() {
async function verifyHelm() {
console.log(tl.loc("VerifyHelmInstallation"));
var helmToolPath = tl.which("helm", true);
var helmTool = tl.tool(helmToolPath);
helmTool.arg("init");
helmTool.arg("--client-only");
return helmTool.exec()

// Check if using Helm 2 or Helm 3
if (helmVersion.startsWith("v2")) {
var helmTool = tl.tool(helmToolPath);
helmTool.arg("init");
helmTool.arg("--client-only");
return helmTool.exec()
}
}

configureHelm()
Expand Down
4 changes: 2 additions & 2 deletions Tasks/HelmInstallerV0/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"author": "Microsoft Corporation",
"version": {
"Major": 0,
"Minor": 155,
"Patch": 1
"Minor": 159,
"Patch": 0
},
"demands": [],
"satisfies": [
Expand Down
6 changes: 3 additions & 3 deletions Tasks/HelmInstallerV0/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"author": "Microsoft Corporation",
"version": {
"Major": 0,
"Minor": 155,
"Patch": 1
"Minor": 159,
"Patch": 0
},
"demands": [],
"satisfies": [
Expand Down Expand Up @@ -93,4 +93,4 @@
"HelmLatestNotKnown": "ms-resource:loc.messages.HelmLatestNotKnown",
"VerifyHelmInstallation": "ms-resource:loc.messages.VerifyHelmInstallation"
}
}
}
15 changes: 10 additions & 5 deletions Tasks/HelmInstallerV1/src/helmtoolinstaller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ import utils = require("./utils");

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

var version = ""

async function configureHelm() {
var version = await utils.getHelmVersion();
version = await utils.getHelmVersion();
var helmPath = await utils.downloadHelm(version);

// prepend the tools path. instructs the agent to prepend for future tasks
Expand All @@ -21,10 +22,14 @@ async function configureHelm() {
async function verifyHelm() {
console.log(tl.loc("VerifyHelmInstallation"));
var helmToolPath = tl.which("helm", true);
var helmTool = tl.tool(helmToolPath);
helmTool.arg("init");
helmTool.arg("--client-only");
return helmTool.exec()

// Check if using Helm 2 or Helm 3
if (version.startsWith("v2")) {
var helmTool = tl.tool(helmToolPath);
helmTool.arg("init");
helmTool.arg("--client-only");
return helmTool.exec()
}
}

configureHelm()
Expand Down
2 changes: 1 addition & 1 deletion Tasks/HelmInstallerV1/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"version": {
"Major": 1,
"Minor": 159,
"Patch": 2
"Patch": 3
},
"preview": true,
"demands": [],
Expand Down
4 changes: 2 additions & 2 deletions Tasks/HelmInstallerV1/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"version": {
"Major": 1,
"Minor": 159,
"Patch": 2
"Patch": 3
},
"preview": true,
"demands": [],
Expand All @@ -41,4 +41,4 @@
"NotAValidSemverVersion": "ms-resource:loc.messages.NotAValidSemverVersion",
"VerifyHelmInstallation": "ms-resource:loc.messages.VerifyHelmInstallation"
}
}
}

0 comments on commit e25488f

Please sign in to comment.