@@ -792,7 +792,7 @@ async function buildAndPushSelfHostedImage(
792792 let digest : string | undefined ;
793793
794794 try {
795- await new Promise < void > ( ( res , rej ) => {
795+ const processCode = await new Promise < number | null > ( ( res , rej ) => {
796796 // For some reason everything is output on stderr, not stdout
797797 buildProcess . stderr ?. on ( "data" , ( data : Buffer ) => {
798798 const text = data . toString ( ) ;
@@ -802,9 +802,17 @@ async function buildAndPushSelfHostedImage(
802802 } ) ;
803803
804804 buildProcess . on ( "error" , ( e ) => rej ( e ) ) ;
805- buildProcess . on ( "close" , ( ) => res ( ) ) ;
805+ buildProcess . on ( "close" , ( code ) => res ( code ) ) ;
806806 } ) ;
807807
808+ if ( processCode !== 0 ) {
809+ return {
810+ ok : false as const ,
811+ error : "Error building image" ,
812+ logs : extractLogs ( errors ) ,
813+ } ;
814+ }
815+
808816 digest = extractImageDigest ( errors ) ;
809817
810818 span . setAttributes ( {
@@ -835,7 +843,7 @@ async function buildAndPushSelfHostedImage(
835843 } ) ;
836844
837845 try {
838- await new Promise < void > ( ( res , rej ) => {
846+ const processCode = await new Promise < number | null > ( ( res , rej ) => {
839847 pushProcess . stdout ?. on ( "data" , ( data : Buffer ) => {
840848 const text = data . toString ( ) ;
841849
@@ -849,9 +857,17 @@ async function buildAndPushSelfHostedImage(
849857 } ) ;
850858
851859 pushProcess . on ( "error" , ( e ) => rej ( e ) ) ;
852- pushProcess . on ( "close" , ( ) => res ( ) ) ;
860+ pushProcess . on ( "close" , ( code ) => res ( code ) ) ;
853861 } ) ;
854862
863+ if ( processCode !== 0 ) {
864+ return {
865+ ok : false as const ,
866+ error : "Error pushing image" ,
867+ logs : extractLogs ( errors ) ,
868+ } ;
869+ }
870+
855871 span . end ( ) ;
856872 } catch ( e ) {
857873 recordSpanException ( span , e ) ;
0 commit comments