@@ -9,38 +9,48 @@ export async function tagDocker(opts: {
99 version : string ;
1010 commit : string ;
1111 latest : boolean ;
12+ reuseEngineVersion ?: string ;
1213} ) {
14+ // Determine which commit to use for source images
15+ let sourceCommit = opts . commit ;
16+ if ( opts . reuseEngineVersion ) {
17+ console . log ( `==> Reusing artifacts from version ${ opts . reuseEngineVersion } ` ) ;
18+ const result = await $ `git rev-parse v${ opts . reuseEngineVersion } ` ;
19+ sourceCommit = result . stdout . trim ( ) . slice ( 0 , 7 ) ;
20+ console . log ( `==> Source commit: ${ sourceCommit } ` ) ;
21+ }
22+
1323 for ( const { name, prefix, main } of REPOS ) {
1424 // Check both architecture images exist using manifest inspect
15- console . log ( `==> Checking images exist: ${ name } :${ prefix } -${ opts . commit } -{amd64,arm64}` ) ;
25+ console . log ( `==> Checking images exist: ${ name } :${ prefix } -${ sourceCommit } -{amd64,arm64}` ) ;
1626 try {
17- console . log ( `==> Inspecting ${ name } :${ prefix } -${ opts . commit } -amd64` ) ;
18- await $ `docker manifest inspect ${ name } :${ prefix } -${ opts . commit } -amd64` ;
19- console . log ( `==> Inspecting ${ name } :${ prefix } -${ opts . commit } -arm64` ) ;
20- await $ `docker manifest inspect ${ name } :${ prefix } -${ opts . commit } -arm64` ;
27+ console . log ( `==> Inspecting ${ name } :${ prefix } -${ sourceCommit } -amd64` ) ;
28+ await $ ( { stdio : "inherit" } ) `docker manifest inspect ${ name } :${ prefix } -${ sourceCommit } -amd64` ;
29+ console . log ( `==> Inspecting ${ name } :${ prefix } -${ sourceCommit } -arm64` ) ;
30+ await $ ( { stdio : "inherit" } ) `docker manifest inspect ${ name } :${ prefix } -${ sourceCommit } -arm64` ;
2131 console . log ( `==> Both images exist` ) ;
2232 } catch ( error ) {
2333 console . error ( `==> Error inspecting images:` , error ) ;
2434 throw new Error (
25- `Images ${ name } :${ prefix } -${ opts . commit } -{amd64,arm64} do not exist on Docker Hub. Error: ${ error } ` ,
35+ `Images ${ name } :${ prefix } -${ sourceCommit } -{amd64,arm64} do not exist on Docker Hub. Error: ${ error } ` ,
2636 ) ;
2737 }
2838
2939 // Create and push manifest with version
3040 await createManifest (
3141 name ,
32- `${ prefix } -${ opts . commit } ` ,
42+ `${ prefix } -${ sourceCommit } ` ,
3343 `${ prefix } -${ opts . version } ` ,
3444 ) ;
3545 if ( main ) {
36- await createManifest ( name , `${ prefix } -${ opts . commit } ` , opts . version ) ;
46+ await createManifest ( name , `${ prefix } -${ sourceCommit } ` , opts . version ) ;
3747 }
3848
3949 // Create and push manifest with latest
4050 if ( opts . latest ) {
41- await createManifest ( name , `${ prefix } -${ opts . commit } ` , `${ prefix } -latest` ) ;
51+ await createManifest ( name , `${ prefix } -${ sourceCommit } ` , `${ prefix } -latest` ) ;
4252 if ( main ) {
43- await createManifest ( name , `${ prefix } -${ opts . commit } ` , "latest" ) ;
53+ await createManifest ( name , `${ prefix } -${ sourceCommit } ` , "latest" ) ;
4454 }
4555 }
4656 }
@@ -51,5 +61,5 @@ async function createManifest(image: string, from: string, to: string) {
5161
5262 // Use buildx imagetools to create and push multi-arch manifest
5363 // This works with manifest lists as inputs (unlike docker manifest create)
54- await $ `docker buildx imagetools create --tag ${ image } :${ to } ${ image } :${ from } -amd64 ${ image } :${ from } -arm64` ;
64+ await $ ( { stdio : "inherit" } ) `docker buildx imagetools create --tag ${ image } :${ to } ${ image } :${ from } -amd64 ${ image } :${ from } -arm64` ;
5565}
0 commit comments