diff --git a/src/types/privatekubectl.ts b/src/types/privatekubectl.ts index f7e8c047..4c12524a 100644 --- a/src/types/privatekubectl.ts +++ b/src/types/privatekubectl.ts @@ -10,7 +10,7 @@ export class PrivateKubectl extends Kubectl { args.unshift('kubectl') let kubectlCmd = args.join(' ') let addFileFlag = false - let eo = {silent} + let eo = {silent: true} if (this.containsFilenames(kubectlCmd)) { // For private clusters, files will referenced solely by their basename @@ -52,7 +52,26 @@ export class PrivateKubectl extends Kubectl { core.debug( `private cluster Kubectl run with invoke command: ${kubectlCmd}` ) - return await getExecOutput('az', privateClusterArgs, eo) + + const runOutput = await getExecOutput( + 'az', + [...privateClusterArgs, '-o', 'json'], + eo + ) + const runObj: {logs: string; exitCode: number} = JSON.parse( + runOutput.stdout + ) + if (!silent) core.info(runObj.logs) + if (runObj.exitCode !== 0) { + throw Error(`failed private cluster Kubectl command: ${kubectlCmd}`) + } + + const output: ExecOutput = { + exitCode: 0, + stdout: '', + stderr: '' + } + return output } private replaceFilnamesWithBasenames(kubectlCmd: string) {