@@ -28,11 +28,14 @@ export class FinalizeDeploymentV2Service extends BaseService {
2828 friendlyId : id ,
2929 environmentId : authenticatedEnv . id ,
3030 } ,
31- include : {
31+ select : {
32+ status : true ,
33+ id : true ,
34+ version : true ,
35+ externalBuildData : true ,
3236 environment : true ,
3337 worker : {
34- include : {
35- tasks : true ,
38+ select : {
3639 project : true ,
3740 } ,
3841 } ,
@@ -84,6 +87,14 @@ export class FinalizeDeploymentV2Service extends BaseService {
8487 throw new ServiceValidationError ( "Missing depot token" ) ;
8588 }
8689
90+ const digest = extractImageDigest ( body . imageReference ) ;
91+
92+ logger . debug ( "Pushing image to registry" , {
93+ id,
94+ deployment,
95+ digest,
96+ } ) ;
97+
8798 const pushResult = await executePushToRegistry (
8899 {
89100 depot : {
@@ -110,17 +121,39 @@ export class FinalizeDeploymentV2Service extends BaseService {
110121 throw new ServiceValidationError ( pushResult . error ) ;
111122 }
112123
124+ const fullImage = digest ? `${ pushResult . image } @${ digest } ` : pushResult . image ;
125+
126+ logger . debug ( "Image pushed to registry" , {
127+ id,
128+ deployment,
129+ body,
130+ fullImage,
131+ } ) ;
132+
113133 const finalizeService = new FinalizeDeploymentService ( ) ;
114134
115135 const finalizedDeployment = await finalizeService . call ( authenticatedEnv , id , {
116- imageReference : pushResult . image ,
136+ imageReference : fullImage ,
117137 skipRegistryProxy : true ,
118138 } ) ;
119139
120140 return finalizedDeployment ;
121141 }
122142}
123143
144+ // Extracts the sha256 digest from an image reference
145+ // For example the image ref "registry.depot.dev/gn57tl6chn:8qfjm8w83w@sha256:aa6fd2bdcbbd611556747e72d0b57797f03aa9b39dc910befc83eea2b08a5b85"
146+ // would return "sha256:aa6fd2bdcbbd611556747e72d0b57797f03aa9b39dc910befc83eea2b08a5b85"
147+ function extractImageDigest ( image : string ) {
148+ const digestIndex = image . lastIndexOf ( "@" ) ;
149+
150+ if ( digestIndex === - 1 ) {
151+ return ;
152+ }
153+
154+ return image . substring ( digestIndex + 1 ) ;
155+ }
156+
124157type ExecutePushToRegistryOptions = {
125158 depot : {
126159 buildId : string ;
0 commit comments