removed redirection changes, added constant for timeout
This commit is contained in:
@ -17,6 +17,7 @@ const path = require("path");
|
||||
const child_process_1 = require("child_process");
|
||||
const fs = require("fs");
|
||||
const io = require("@actions/io");
|
||||
const kubeconfig_timeout = 120; //timeout in seconds
|
||||
function getAzureAccessToken(servicePrincipalId, servicePrincipalKey, tenantId, authorityUrl, managementEndpointUrl) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (!servicePrincipalId || !servicePrincipalKey || !tenantId || !authorityUrl) {
|
||||
@ -82,8 +83,6 @@ function getArcKubeconfig() {
|
||||
const runnerTempDirectory = process.env['RUNNER_TEMP']; // Using process.env until the core libs are updated
|
||||
const kubeconfigPath = path.join(runnerTempDirectory, `kubeconfig_${Date.now()}`);
|
||||
let azPath = yield io.which("az", true);
|
||||
const out = fs.openSync('./out.log', 'a');
|
||||
const err = fs.openSync('./out.log', 'a');
|
||||
if (method == 'service-account') {
|
||||
let saToken = core.getInput('token');
|
||||
if (!saToken) {
|
||||
@ -92,7 +91,7 @@ function getArcKubeconfig() {
|
||||
console.log('using service account method for authenticating to arc cluster.');
|
||||
const proc = child_process_1.spawn(azPath, ['connectedk8s', 'proxy', '-n', clusterName, '-g', resourceGroupName, '-f', kubeconfigPath, '--token', saToken], {
|
||||
detached: true,
|
||||
stdio: ['ignore', out, err]
|
||||
stdio: 'ignore'
|
||||
});
|
||||
proc.unref();
|
||||
}
|
||||
@ -100,12 +99,12 @@ function getArcKubeconfig() {
|
||||
console.log('using spn method for authenticating to arc cluster.');
|
||||
const proc = child_process_1.spawn(azPath, ['connectedk8s', 'proxy', '-n', clusterName, '-g', resourceGroupName, '-f', kubeconfigPath], {
|
||||
detached: true,
|
||||
stdio: ['ignore', out, err]
|
||||
stdio: 'ignore'
|
||||
});
|
||||
proc.unref();
|
||||
}
|
||||
console.log('Waiting for 2 minutes for kubeconfig to be merged....');
|
||||
yield sleep(120000); //sleeping for 2 minutes to allow kubeconfig to be merged
|
||||
console.log(`Waiting for ${kubeconfig_timeout} seconds for kubeconfig to be merged....`);
|
||||
yield sleep(kubeconfig_timeout * 1000); //sleeping for 2 minutes to allow kubeconfig to be merged
|
||||
fs.chmodSync(kubeconfigPath, '600');
|
||||
core.exportVariable('KUBECONFIG', kubeconfigPath);
|
||||
console.log('KUBECONFIG environment variable is set');
|
||||
|
Reference in New Issue
Block a user