Skip to content

Commit 389875e

Browse files
committed
Helm v3 fix refactor
1 parent 4f2f16b commit 389875e

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

Tasks/HelmInstallerV0/src/helmtoolinstaller.ts

Lines changed: 4 additions & 2 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 versionToInstall = ""
14+
1315
async function configureKubectl() {
1416
var version = await kubectlinstaller.getKuberctlVersion();
1517
var kubectlPath = await kubectlinstaller.downloadKubectl(version);
@@ -22,6 +24,7 @@ async function configureKubectl() {
2224

2325
async function configureHelm() {
2426
var version = await helminstaller.getHelmVersion();
27+
versionToInstall = version
2528
var helmPath = await helminstaller.downloadHelm(version);
2629

2730
// prepend the tools path. instructs the agent to prepend for future tasks
@@ -32,12 +35,11 @@ async function configureHelm() {
3235

3336
async function verifyHelm() {
3437
console.log(tl.loc("VerifyHelmInstallation"));
35-
var helmVersion = await helminstaller.getHelmVersion();
3638
var helmToolPath = tl.which("helm", true);
3739
var helmTool = tl.tool(helmToolPath);
3840

3941
// Check if using Helm 2 or Helm 3
40-
if (helmVersion.startsWith("v2")) {
42+
if (versionToInstall.startsWith("v2")) {
4143
helmTool.arg("init");
4244
helmTool.arg("--client-only");
4345
} else {

Tasks/HelmInstallerV1/src/helmtoolinstaller.ts

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

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

10+
var versionToInstall = ""
1011

1112
async function configureHelm() {
1213
var version = await utils.getHelmVersion();
14+
versionToInstall = version;
1315
var helmPath = await utils.downloadHelm(version);
1416

1517
// prepend the tools path. instructs the agent to prepend for future tasks
@@ -20,12 +22,11 @@ async function configureHelm() {
2022

2123
async function verifyHelm() {
2224
console.log(tl.loc("VerifyHelmInstallation"));
23-
var helmVersion = await utils.getHelmVersion();
2425
var helmToolPath = tl.which("helm", true);
2526
var helmTool = tl.tool(helmToolPath);
2627

2728
// Check if using Helm 2 or Helm 3
28-
if (helmVersion.startsWith("v2")) {
29+
if (versionToInstall.startsWith("v2")) {
2930
helmTool.arg("init");
3031
helmTool.arg("--client-only");
3132
} else {

0 commit comments

Comments
 (0)