trying a fix for logs

This commit is contained in:
Atharva Mulmuley 2021-04-29 16:55:13 +05:30
parent dd342fb40d
commit 8ff551ad06
2 changed files with 16 additions and 12 deletions

View File

@ -82,25 +82,27 @@ 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);
let out = fs.openSync('./out.log', 'a');
let err = fs.openSync('./err.log', 'a');
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) {
throw Error("'saToken' is not passed for 'service-account' method.");
}
console.log('using service account method for authenticating to arc cluster.');
child_process_1.spawn(azPath, ['connectedk8s', 'proxy', '-n', clusterName, '-g', resourceGroupName, '-f', kubeconfigPath, '--token', saToken], {
const proc = child_process_1.spawn(azPath, ['connectedk8s', 'proxy', '-n', clusterName, '-g', resourceGroupName, '-f', kubeconfigPath, '--token', saToken], {
detached: true,
stdio: ['ignore', out, err]
}).unref();
});
proc.unref();
}
else {
console.log('using spn method for authenticating to arc cluster.');
child_process_1.spawn(azPath, ['connectedk8s', 'proxy', '-n', clusterName, '-g', resourceGroupName, '-f', kubeconfigPath], {
const proc = child_process_1.spawn(azPath, ['connectedk8s', 'proxy', '-n', clusterName, '-g', resourceGroupName, '-f', kubeconfigPath], {
detached: true,
stdio: ['ignore', out, err]
}).unref();
});
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

View File

@ -78,24 +78,26 @@ export async function getArcKubeconfig(): Promise<string> {
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 = await io.which("az", true);
let out = fs.openSync('./out.log', 'a');
let err = fs.openSync('./err.log', 'a');
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){
throw Error("'saToken' is not passed for 'service-account' method.")
}
console.log('using service account method for authenticating to arc cluster.')
spawn(azPath,['connectedk8s','proxy','-n',clusterName,'-g',resourceGroupName,'-f',kubeconfigPath,'--token',saToken], {
const proc=spawn(azPath,['connectedk8s','proxy','-n',clusterName,'-g',resourceGroupName,'-f',kubeconfigPath,'--token',saToken], {
detached: true,
stdio: [ 'ignore', out, err ]
}).unref();
});
proc.unref();
} else{
console.log('using spn method for authenticating to arc cluster.')
spawn(azPath,['connectedk8s','proxy','-n',clusterName,'-g',resourceGroupName,'-f',kubeconfigPath], {
const proc=spawn(azPath,['connectedk8s','proxy','-n',clusterName,'-g',resourceGroupName,'-f',kubeconfigPath], {
detached: true,
stdio: [ 'ignore', out, err ]
}).unref();
});
proc.unref();
}
console.log('Waiting for 2 minutes for kubeconfig to be merged....')
await sleep(120000) //sleeping for 2 minutes to allow kubeconfig to be merged