Skip to content

Commit 71eb77c

Browse files
authored
Check if a default kubeconfig file path exists (#18781)
* Update helm.ts * Update task.json and task.loc.json
1 parent 0ad9a35 commit 71eb77c

File tree

10 files changed

+34
-19
lines changed

10 files changed

+34
-19
lines changed

Tasks/HelmDeployV0/src/helm.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,12 @@ async function run() {
8484
var kubectlCli: kubernetescli;
8585
var externalAuth = connectionType === "None" && (command === "install" || command === "upgrade");
8686
if (externalAuth && !tl.getVariable("KUBECONFIG")) {
87-
tl.error("KUBECONFIG kube configuration file path must be set when connectionType is none and command is install or upgrade.");
87+
const kubeConfigPath = path.join(process.env.HOME, '.kube', 'config');
88+
if (fs.existsSync(kubeConfigPath)) {
89+
tl.setVariable("KUBECONFIG", kubeConfigPath);
90+
} else {
91+
tl.error("KUBECONFIG kube configuration file path must be set when connectionType is none and command is install or upgrade.");
92+
}
8893
}
8994
if (isKubConfigRequired || externalAuth) {
9095
var kubeconfigfilePath = (command === "logout" || externalAuth) ? tl.getVariable("KUBECONFIG") : await getKubeConfigFile();

Tasks/HelmDeployV0/task.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"version": {
1515
"Major": 0,
1616
"Minor": 226,
17-
"Patch": 7
17+
"Patch": 9
1818
},
1919
"demands": [],
2020
"groups": [

Tasks/HelmDeployV0/task.loc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"version": {
1515
"Major": 0,
1616
"Minor": 226,
17-
"Patch": 7
17+
"Patch": 9
1818
},
1919
"demands": [],
2020
"groups": [
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Default|0.226.7
2-
Node16-225|0.226.6
1+
Default|0.226.9
2+
Node16-225|0.226.8

_generated/HelmDeployV0/src/helm.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,12 @@ async function run() {
8484
var kubectlCli: kubernetescli;
8585
var externalAuth = connectionType === "None" && (command === "install" || command === "upgrade");
8686
if (externalAuth && !tl.getVariable("KUBECONFIG")) {
87-
tl.error("KUBECONFIG kube configuration file path must be set when connectionType is none and command is install or upgrade.");
87+
const kubeConfigPath = path.join(process.env.HOME, '.kube', 'config');
88+
if (fs.existsSync(kubeConfigPath)) {
89+
tl.setVariable("KUBECONFIG", kubeConfigPath);
90+
} else {
91+
tl.error("KUBECONFIG kube configuration file path must be set when connectionType is none and command is install or upgrade.");
92+
}
8893
}
8994
if (isKubConfigRequired || externalAuth) {
9095
var kubeconfigfilePath = (command === "logout" || externalAuth) ? tl.getVariable("KUBECONFIG") : await getKubeConfigFile();

_generated/HelmDeployV0/task.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"version": {
1515
"Major": 0,
1616
"Minor": 226,
17-
"Patch": 7
17+
"Patch": 9
1818
},
1919
"demands": [],
2020
"groups": [
@@ -549,7 +549,7 @@
549549
"KubeloginFailed": "Kubelogin authentication failed. Exception: %s"
550550
},
551551
"_buildConfigMapping": {
552-
"Default": "0.226.7",
553-
"Node16-225": "0.226.6"
552+
"Default": "0.226.9",
553+
"Node16-225": "0.226.8"
554554
}
555555
}

_generated/HelmDeployV0/task.loc.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"version": {
1515
"Major": 0,
1616
"Minor": 226,
17-
"Patch": 7
17+
"Patch": 9
1818
},
1919
"demands": [],
2020
"groups": [
@@ -549,7 +549,7 @@
549549
"KubeloginFailed": "ms-resource:loc.messages.KubeloginFailed"
550550
},
551551
"_buildConfigMapping": {
552-
"Default": "0.226.7",
553-
"Node16-225": "0.226.6"
552+
"Default": "0.226.9",
553+
"Node16-225": "0.226.8"
554554
}
555555
}

_generated/HelmDeployV0_Node16/src/helm.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,12 @@ async function run() {
8484
var kubectlCli: kubernetescli;
8585
var externalAuth = connectionType === "None" && (command === "install" || command === "upgrade");
8686
if (externalAuth && !tl.getVariable("KUBECONFIG")) {
87-
tl.error("KUBECONFIG kube configuration file path must be set when connectionType is none and command is install or upgrade.");
87+
const kubeConfigPath = path.join(process.env.HOME, '.kube', 'config');
88+
if (fs.existsSync(kubeConfigPath)) {
89+
tl.setVariable("KUBECONFIG", kubeConfigPath);
90+
} else {
91+
tl.error("KUBECONFIG kube configuration file path must be set when connectionType is none and command is install or upgrade.");
92+
}
8893
}
8994
if (isKubConfigRequired || externalAuth) {
9095
var kubeconfigfilePath = (command === "logout" || externalAuth) ? tl.getVariable("KUBECONFIG") : await getKubeConfigFile();

_generated/HelmDeployV0_Node16/task.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"version": {
1515
"Major": 0,
1616
"Minor": 226,
17-
"Patch": 6
17+
"Patch": 8
1818
},
1919
"demands": [],
2020
"groups": [
@@ -561,7 +561,7 @@
561561
"KubeloginFailed": "Kubelogin authentication failed. Exception: %s"
562562
},
563563
"_buildConfigMapping": {
564-
"Default": "0.226.7",
565-
"Node16-225": "0.226.6"
564+
"Default": "0.226.9",
565+
"Node16-225": "0.226.8"
566566
}
567567
}

_generated/HelmDeployV0_Node16/task.loc.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"version": {
1515
"Major": 0,
1616
"Minor": 226,
17-
"Patch": 6
17+
"Patch": 8
1818
},
1919
"demands": [],
2020
"groups": [
@@ -561,7 +561,7 @@
561561
"KubeloginFailed": "ms-resource:loc.messages.KubeloginFailed"
562562
},
563563
"_buildConfigMapping": {
564-
"Default": "0.226.7",
565-
"Node16-225": "0.226.6"
564+
"Default": "0.226.9",
565+
"Node16-225": "0.226.8"
566566
}
567567
}

0 commit comments

Comments
 (0)