mirror of
https://github.com/Azure/k8s-deploy.git
synced 2026-06-24 21:50:00 +08:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0b282a825d |
@@ -10,11 +10,7 @@ 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>{
|
let eo = <ExecOptions>{silent}
|
||||||
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
|
||||||
@@ -56,25 +52,7 @@ export class PrivateKubectl extends Kubectl {
|
|||||||
core.debug(
|
core.debug(
|
||||||
`private cluster Kubectl run with invoke command: ${kubectlCmd}`
|
`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 (runOutput.exitCode !== 0 && runObj.exitCode !== 0) {
|
|
||||||
throw Error(`failed private cluster Kubectl command: ${kubectlCmd}`)
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
exitCode: runObj.exitCode,
|
|
||||||
stdout: runObj.logs,
|
|
||||||
stderr: ''
|
|
||||||
} as ExecOutput
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private replaceFilnamesWithBasenames(kubectlCmd: string) {
|
private replaceFilnamesWithBasenames(kubectlCmd: string) {
|
||||||
|
|||||||
Reference in New Issue
Block a user