add proper output

This commit is contained in:
Oliver King 2022-10-18 13:45:38 -04:00
parent e4d3021456
commit b307b2cde9
No known key found for this signature in database
GPG Key ID: 8C02F0B0B4671B24

View File

@ -10,7 +10,11 @@ export class PrivateKubectl extends Kubectl {
args.unshift('kubectl') args.unshift('kubectl')
let kubectlCmd = args.join(' ') let kubectlCmd = args.join(' ')
let addFileFlag = false let addFileFlag = false
let eo = <ExecOptions>{silent: true} let eo = <ExecOptions>{
silent: true,
failOnStdErr: false,
ignoreReturnCode: true
}
if (this.containsFilenames(kubectlCmd)) { if (this.containsFilenames(kubectlCmd)) {
// For private clusters, files will referenced solely by their basename // For private clusters, files will referenced solely by their basename
@ -62,16 +66,15 @@ export class PrivateKubectl extends Kubectl {
runOutput.stdout runOutput.stdout
) )
if (!silent) core.info(runObj.logs) if (!silent) core.info(runObj.logs)
if (runObj.exitCode !== 0) { if (runOutput.exitCode !== 0 && runObj.exitCode !== 0) {
throw Error(`failed private cluster Kubectl command: ${kubectlCmd}`) throw Error(`failed private cluster Kubectl command: ${kubectlCmd}`)
} }
const output: ExecOutput = { return {
exitCode: 0, exitCode: runObj.exitCode,
stdout: '', stdout: runObj.logs,
stderr: '' stderr: ''
} } as ExecOutput
return output
} }
private replaceFilnamesWithBasenames(kubectlCmd: string) { private replaceFilnamesWithBasenames(kubectlCmd: string) {