mirror of
https://github.com/Azure/k8s-deploy.git
synced 2026-04-08 06:12:15 +08:00
add private cluster exitCode check
This commit is contained in:
parent
57d0489e1f
commit
e4d3021456
@ -10,7 +10,7 @@ export class PrivateKubectl extends Kubectl {
|
||||
args.unshift('kubectl')
|
||||
let kubectlCmd = args.join(' ')
|
||||
let addFileFlag = false
|
||||
let eo = <ExecOptions>{silent}
|
||||
let eo = <ExecOptions>{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) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user