@@ -90,8 +90,8 @@ actionsToolkit.run(
9090 ignoreReturnCode : true ,
9191 silent : true
9292 } ) . then ( res => {
93- if ( res . stderr . length > 0 && res . exitCode != 0 ) {
94- core . info ( `Cannot inspect default docker context: ${ res . stderr . trim ( ) } ` ) ;
93+ if ( res . exitCode != 0 ) {
94+ core . info ( `Cannot inspect default docker context: ${ Docker . getErrorMessage ( res . stderr ) } ` ) ;
9595 } else {
9696 try {
9797 const contextInfo = ( < Array < ContextInfo > > JSON . parse ( res . stdout . trim ( ) ) ) [ 0 ] ;
@@ -112,8 +112,8 @@ actionsToolkit.run(
112112 await Docker . getExecOutput ( [ 'context' , 'create' , tmpDockerContext ] , {
113113 ignoreReturnCode : true
114114 } ) . then ( res => {
115- if ( res . stderr . length > 0 && res . exitCode != 0 ) {
116- core . warning ( `Cannot create docker context ${ tmpDockerContext } : ${ res . stderr . match ( / ( . * ) \s * $ / ) ?. [ 0 ] ?. trim ( ) ?? 'unknown error' } ` ) ;
115+ if ( res . exitCode != 0 ) {
116+ core . warning ( `Cannot create docker context ${ tmpDockerContext } : ${ Docker . getErrorMessage ( res . stderr ) } ` ) ;
117117 } else {
118118 core . info ( `Setting builder endpoint to ${ tmpDockerContext } context` ) ;
119119 inputs . endpoint = tmpDockerContext ;
@@ -141,8 +141,8 @@ actionsToolkit.run(
141141 await Exec . getExecOutput ( createCmd . command , createCmd . args , {
142142 ignoreReturnCode : true
143143 } ) . then ( res => {
144- if ( res . stderr . length > 0 && res . exitCode != 0 ) {
145- throw new Error ( res . stderr . match ( / ( . * ) \s * $ / ) ?. [ 0 ] ?. trim ( ) ?? 'unknown error' ) ;
144+ if ( res . exitCode != 0 ) {
145+ throw new Error ( `Failed to create builder ${ inputs . name } : ${ Buildx . getErrorMessage ( res . stderr ) } ` ) ;
146146 }
147147 } ) ;
148148 }
@@ -166,8 +166,8 @@ actionsToolkit.run(
166166 await Exec . getExecOutput ( appendCmd . command , appendCmd . args , {
167167 ignoreReturnCode : true
168168 } ) . then ( res => {
169- if ( res . stderr . length > 0 && res . exitCode != 0 ) {
170- throw new Error ( `Failed to append node ${ node . name } : ${ res . stderr . match ( / ( . * ) \s * $ / ) ?. [ 0 ] ?. trim ( ) ?? 'unknown error' } ` ) ;
169+ if ( res . exitCode != 0 ) {
170+ throw new Error ( `Failed to append node ${ node . name } : ${ Buildx . getErrorMessage ( res . stderr ) } ` ) ;
171171 }
172172 } ) ;
173173 nodeIndex ++ ;
@@ -180,8 +180,8 @@ actionsToolkit.run(
180180 await Exec . getExecOutput ( inspectCmd . command , inspectCmd . args , {
181181 ignoreReturnCode : true
182182 } ) . then ( res => {
183- if ( res . stderr . length > 0 && res . exitCode != 0 ) {
184- throw new Error ( res . stderr . match ( / ( . * ) \s * $ / ) ?. [ 0 ] ?. trim ( ) ?? 'unknown error' ) ;
183+ if ( res . exitCode != 0 ) {
184+ throw new Error ( `Failed to boot builder: ${ Buildx . getErrorMessage ( res . stderr ) } ` ) ;
185185 }
186186 } ) ;
187187 } ) ;
@@ -225,8 +225,8 @@ actionsToolkit.run(
225225 await Docker . getExecOutput ( [ 'logs' , `${ stateHelper . containerName } ` ] , {
226226 ignoreReturnCode : true
227227 } ) . then ( res => {
228- if ( res . stderr . length > 0 && res . exitCode != 0 ) {
229- core . warning ( res . stderr . match ( / ( . * ) \s * $ / ) ?. [ 0 ] ?. trim ( ) ?? 'unknown error' ) ;
228+ if ( res . exitCode != 0 ) {
229+ core . warning ( `Failed to display BuildKit logs: ${ Docker . getErrorMessage ( res . stderr ) } ` ) ;
230230 }
231231 } ) ;
232232 } ) ;
@@ -245,8 +245,8 @@ actionsToolkit.run(
245245 await Exec . getExecOutput ( rmCmd . command , rmCmd . args , {
246246 ignoreReturnCode : true
247247 } ) . then ( res => {
248- if ( res . stderr . length > 0 && res . exitCode != 0 ) {
249- core . warning ( res . stderr . match ( / ( . * ) \s * $ / ) ?. [ 0 ] ?. trim ( ) ?? 'unknown error' ) ;
248+ if ( res . exitCode != 0 ) {
249+ core . warning ( `Failed to remove builder ${ stateHelper . builderName } : ${ Buildx . getErrorMessage ( res . stderr ) } ` ) ;
250250 }
251251 } ) ;
252252 } else {
@@ -260,8 +260,8 @@ actionsToolkit.run(
260260 await Exec . getExecOutput ( 'docker' , [ 'context' , 'rm' , '-f' , stateHelper . tmpDockerContext ] , {
261261 ignoreReturnCode : true
262262 } ) . then ( res => {
263- if ( res . stderr . length > 0 && res . exitCode != 0 ) {
264- core . warning ( `${ res . stderr . match ( / ( . * ) \s * $ / ) ?. [ 0 ] ?. trim ( ) ?? 'unknown error' } ` ) ;
263+ if ( res . exitCode != 0 ) {
264+ core . warning ( `Failed to remove temp docker context ${ stateHelper . tmpDockerContext } : ${ Docker . getErrorMessage ( res . stderr ) } ` ) ;
265265 }
266266 } ) ;
267267 } ) ;
0 commit comments