File tree Expand file tree Collapse file tree 1 file changed +24
-2
lines changed Expand file tree Collapse file tree 1 file changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,11 @@ export class PrivateKubectl extends Kubectl {
10
10
args . unshift ( 'kubectl' )
11
11
let kubectlCmd = args . join ( ' ' )
12
12
let addFileFlag = false
13
- let eo = < ExecOptions > { silent}
13
+ let eo = < ExecOptions > {
14
+ silent : true ,
15
+ failOnStdErr : false ,
16
+ ignoreReturnCode : true
17
+ }
14
18
15
19
if ( this . containsFilenames ( kubectlCmd ) ) {
16
20
// For private clusters, files will referenced solely by their basename
@@ -52,7 +56,25 @@ export class PrivateKubectl extends Kubectl {
52
56
core . debug (
53
57
`private cluster Kubectl run with invoke command: ${ kubectlCmd } `
54
58
)
55
- return await getExecOutput ( 'az' , privateClusterArgs , eo )
59
+
60
+ const runOutput = await getExecOutput (
61
+ 'az' ,
62
+ [ ...privateClusterArgs , '-o' , 'json' ] ,
63
+ eo
64
+ )
65
+ const runObj : { logs : string ; exitCode : number } = JSON . parse (
66
+ runOutput . stdout
67
+ )
68
+ if ( ! silent ) core . info ( runObj . logs )
69
+ if ( runOutput . exitCode !== 0 && runObj . exitCode !== 0 ) {
70
+ throw Error ( `failed private cluster Kubectl command: ${ kubectlCmd } ` )
71
+ }
72
+
73
+ return {
74
+ exitCode : runObj . exitCode ,
75
+ stdout : runObj . logs ,
76
+ stderr : ''
77
+ } as ExecOutput
56
78
}
57
79
58
80
private replaceFilnamesWithBasenames ( kubectlCmd : string ) {
You can’t perform that action at this time.
0 commit comments