Setting KUBECONFIG for current step
This commit is contained in:
@ -91,10 +91,12 @@ function getKubectlPath() {
|
||||
return kubectlPath;
|
||||
});
|
||||
}
|
||||
function setContext() {
|
||||
function setContext(kubeconfigPath) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let context = core.getInput('context');
|
||||
if (context) {
|
||||
//To use kubectl commands, the environment variable KUBECONFIG needs to be set for this step
|
||||
process.env['KUBECONFIG'] = kubeconfigPath;
|
||||
const kubectlPath = yield getKubectlPath();
|
||||
let toolRunner = new toolrunner_1.ToolRunner(kubectlPath, ['config', 'use-context', context]);
|
||||
yield toolRunner.exec();
|
||||
@ -112,7 +114,7 @@ function run() {
|
||||
fs.writeFileSync(kubeconfigPath, kubeconfig);
|
||||
command_1.issueCommand('set-env', { name: 'KUBECONFIG' }, kubeconfigPath);
|
||||
console.log('KUBECONFIG environment variable is set');
|
||||
yield setContext();
|
||||
yield setContext(kubeconfigPath);
|
||||
});
|
||||
}
|
||||
exports.run = run;
|
||||
|
Reference in New Issue
Block a user