@@ -78,17 +78,21 @@ function runHelmSaveCommand(helmCli: helmcli, kubectlCli: kubernetescli, failOnS
7878
7979async function run ( ) {
8080 var command = tl . getInput ( "command" , true ) . toLowerCase ( ) ;
81+ var connectionType = tl . getInput ( "connectionType" , true ) ;
8182 var isKubConfigRequired = isKubConfigSetupRequired ( command ) ;
8283 var kubectlCli : kubernetescli ;
83- if ( isKubConfigRequired ) {
84- var kubeconfigfilePath = command === "logout" ? tl . getVariable ( "KUBECONFIG" ) : await getKubeConfigFile ( ) ;
84+ var externalAuth = connectionType === "None" && ( command === "install" || command === "upgrade" ) ;
85+ if ( externalAuth && ! tl . getVariable ( "KUBECONFIG" ) ) {
86+ tl . error ( "KUBECONFIG kube configuration file path must be set when connectionType is none and command is install or upgrade." ) ;
87+ }
88+ if ( isKubConfigRequired || externalAuth ) {
89+ var kubeconfigfilePath = ( command === "logout" || externalAuth ) ? tl . getVariable ( "KUBECONFIG" ) : await getKubeConfigFile ( ) ;
8590 kubectlCli = new kubernetescli ( kubeconfigfilePath ) ;
8691 kubectlCli . login ( ) ;
8792 }
8893
8994 var helmCli : helmcli = new helmcli ( ) ;
9095 helmCli . login ( ) ;
91- var connectionType = tl . getInput ( "connectionType" , true ) ;
9296 var telemetry = {
9397 connectionType : connectionType ,
9498 command : command ,
@@ -120,7 +124,7 @@ async function run() {
120124 tl . setResult ( tl . TaskResult . Failed , err . message ) ;
121125 }
122126 finally {
123- if ( isKubConfigLogoutRequired ( command ) ) {
127+ if ( isKubConfigLogoutRequired ( command ) || externalAuth ) {
124128 kubectlCli . logout ( ) ;
125129 }
126130
@@ -202,7 +206,7 @@ function runHelm(helmCli: helmcli, command: string, kubectlCli: kubernetescli, f
202206 }
203207 }
204208 catch ( e ) {
205- tl . warning ( "Capturing deployment metadata failed with error: " + e ) ;
209+ tl . error ( "Capturing deployment metadata failed with error: " + e ) ;
206210 }
207211 }
208212}
0 commit comments