@@ -10,6 +10,8 @@ import * as helminstaller from "./helminstaller"
1010
1111tl . setResourcePath ( path . join ( __dirname , '..' , 'task.json' ) ) ;
1212
13+ var helmVersion = ""
14+
1315async function configureKubectl ( ) {
1416 var version = await kubectlinstaller . getKuberctlVersion ( ) ;
1517 var kubectlPath = await kubectlinstaller . downloadKubectl ( version ) ;
@@ -21,8 +23,8 @@ async function configureKubectl() {
2123}
2224
2325async 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() {
3335async 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
4248configureHelm ( )
0 commit comments