@@ -792,7 +792,7 @@ async function buildAndPushSelfHostedImage(
792
792
let digest : string | undefined ;
793
793
794
794
try {
795
- await new Promise < void > ( ( res , rej ) => {
795
+ const processCode = await new Promise < number | null > ( ( res , rej ) => {
796
796
// For some reason everything is output on stderr, not stdout
797
797
buildProcess . stderr ?. on ( "data" , ( data : Buffer ) => {
798
798
const text = data . toString ( ) ;
@@ -802,9 +802,17 @@ async function buildAndPushSelfHostedImage(
802
802
} ) ;
803
803
804
804
buildProcess . on ( "error" , ( e ) => rej ( e ) ) ;
805
- buildProcess . on ( "close" , ( ) => res ( ) ) ;
805
+ buildProcess . on ( "close" , ( code ) => res ( code ) ) ;
806
806
} ) ;
807
807
808
+ if ( processCode !== 0 ) {
809
+ return {
810
+ ok : false as const ,
811
+ error : "Error building image" ,
812
+ logs : extractLogs ( errors ) ,
813
+ } ;
814
+ }
815
+
808
816
digest = extractImageDigest ( errors ) ;
809
817
810
818
span . setAttributes ( {
@@ -835,7 +843,7 @@ async function buildAndPushSelfHostedImage(
835
843
} ) ;
836
844
837
845
try {
838
- await new Promise < void > ( ( res , rej ) => {
846
+ const processCode = await new Promise < number | null > ( ( res , rej ) => {
839
847
pushProcess . stdout ?. on ( "data" , ( data : Buffer ) => {
840
848
const text = data . toString ( ) ;
841
849
@@ -849,9 +857,17 @@ async function buildAndPushSelfHostedImage(
849
857
} ) ;
850
858
851
859
pushProcess . on ( "error" , ( e ) => rej ( e ) ) ;
852
- pushProcess . on ( "close" , ( ) => res ( ) ) ;
860
+ pushProcess . on ( "close" , ( code ) => res ( code ) ) ;
853
861
} ) ;
854
862
863
+ if ( processCode !== 0 ) {
864
+ return {
865
+ ok : false as const ,
866
+ error : "Error pushing image" ,
867
+ logs : extractLogs ( errors ) ,
868
+ } ;
869
+ }
870
+
855
871
span . end ( ) ;
856
872
} catch ( e ) {
857
873
recordSpanException ( span , e ) ;
0 commit comments