made changes to redirect csp logs to file

This commit is contained in:
Atharva Mulmuley 2021-04-29 15:43:08 +05:30
parent dd44a570b3
commit 73a2562285
3 changed files with 10 additions and 6 deletions

View File

@ -16,8 +16,8 @@ jobs:
# This workflow contains a single job called "build" # This workflow contains a single job called "build"
build: build:
# The type of runner that the job will run on # The type of runner that the job will run on
#runs-on: ubuntu-latest runs-on: ubuntu-latest
runs-on: self-hosted #runs-on: self-hosted
# Steps represent a sequence of tasks that will be executed as part of the job # Steps represent a sequence of tasks that will be executed as part of the job
steps: steps:

View File

@ -82,6 +82,8 @@ function getArcKubeconfig() {
const runnerTempDirectory = process.env['RUNNER_TEMP']; // Using process.env until the core libs are updated const runnerTempDirectory = process.env['RUNNER_TEMP']; // Using process.env until the core libs are updated
const kubeconfigPath = path.join(runnerTempDirectory, `kubeconfig_${Date.now()}`); const kubeconfigPath = path.join(runnerTempDirectory, `kubeconfig_${Date.now()}`);
let azPath = yield io.which("az", true); let azPath = yield io.which("az", true);
let out = fs.openSync('./out.log', 'a');
let err = fs.openSync('./out.log', 'a');
if (method == 'service-account') { if (method == 'service-account') {
let saToken = core.getInput('token'); let saToken = core.getInput('token');
if (!saToken) { if (!saToken) {
@ -90,14 +92,14 @@ function getArcKubeconfig() {
console.log('using service account method for authenticating to arc cluster.'); 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], { child_process_1.spawn(azPath, ['connectedk8s', 'proxy', '-n', clusterName, '-g', resourceGroupName, '-f', kubeconfigPath, '--token', saToken], {
detached: true, detached: true,
stdio: 'ignore' stdio: ['ignore', out, err]
}).unref(); }).unref();
} }
else { else {
console.log('using spn method for authenticating to arc cluster.'); console.log('using spn method for authenticating to arc cluster.');
child_process_1.spawn(azPath, ['connectedk8s', 'proxy', '-n', clusterName, '-g', resourceGroupName, '-f', kubeconfigPath], { child_process_1.spawn(azPath, ['connectedk8s', 'proxy', '-n', clusterName, '-g', resourceGroupName, '-f', kubeconfigPath], {
detached: true, detached: true,
stdio: 'ignore' stdio: ['ignore', out, err]
}).unref(); }).unref();
} }
console.log('Waiting for 2 minutes for kubeconfig to be merged....'); console.log('Waiting for 2 minutes for kubeconfig to be merged....');

View File

@ -78,6 +78,8 @@ export async function getArcKubeconfig(): Promise<string> {
const runnerTempDirectory = process.env['RUNNER_TEMP']; // Using process.env until the core libs are updated const runnerTempDirectory = process.env['RUNNER_TEMP']; // Using process.env until the core libs are updated
const kubeconfigPath = path.join(runnerTempDirectory, `kubeconfig_${Date.now()}`); const kubeconfigPath = path.join(runnerTempDirectory, `kubeconfig_${Date.now()}`);
let azPath = await io.which("az", true); let azPath = await io.which("az", true);
let out = fs.openSync('./out.log', 'a');
let err = fs.openSync('./out.log', 'a');
if (method == 'service-account'){ if (method == 'service-account'){
let saToken = core.getInput('token'); let saToken = core.getInput('token');
if(!saToken){ if(!saToken){
@ -86,13 +88,13 @@ export async function getArcKubeconfig(): Promise<string> {
console.log('using service account method for authenticating to arc cluster.') console.log('using service account method for authenticating to arc cluster.')
spawn(azPath,['connectedk8s','proxy','-n',clusterName,'-g',resourceGroupName,'-f',kubeconfigPath,'--token',saToken], { spawn(azPath,['connectedk8s','proxy','-n',clusterName,'-g',resourceGroupName,'-f',kubeconfigPath,'--token',saToken], {
detached: true, detached: true,
stdio: 'ignore' stdio: [ 'ignore', out, err ]
}).unref(); }).unref();
} else{ } else{
console.log('using spn method for authenticating to arc cluster.') console.log('using spn method for authenticating to arc cluster.')
spawn(azPath,['connectedk8s','proxy','-n',clusterName,'-g',resourceGroupName,'-f',kubeconfigPath], { spawn(azPath,['connectedk8s','proxy','-n',clusterName,'-g',resourceGroupName,'-f',kubeconfigPath], {
detached: true, detached: true,
stdio: 'ignore' stdio: [ 'ignore', out, err ]
}).unref(); }).unref();
} }
console.log('Waiting for 2 minutes for kubeconfig to be merged....') console.log('Waiting for 2 minutes for kubeconfig to be merged....')