@@ -66,6 +66,11 @@ pub enum Error {
6666 source : std:: io:: Error ,
6767 path : String ,
6868 } ,
69+
70+ #[ snafu( display( "failed to parse floating vendor version" ) ) ]
71+ ParseFloatingVendorVersion {
72+ source : utils:: ParseFloatingVendorVersionError ,
73+ } ,
6974}
7075
7176#[ derive( Debug , Snafu ) ]
@@ -318,7 +323,7 @@ impl Bakefile {
318323 let target = BakefileTarget :: common (
319324 date_time,
320325 revision,
321- cli_args. image_version . clone ( ) ,
326+ cli_args. vendor_version . clone ( ) ,
322327 container_build_args,
323328 user_container_build_args,
324329 metadata,
@@ -332,6 +337,10 @@ impl Bakefile {
332337 cli_args : & cli:: BuildArguments ,
333338 config : Config ,
334339 ) -> Result < Self , Error > {
340+ let floating_vendor_version =
341+ utils:: parse_floating_vendor_version ( & cli_args. vendor_version , cli_args. floating_tag )
342+ . context ( ParseFloatingVendorVersionSnafu ) ?;
343+
335344 let mut bakefile_targets = BTreeMap :: new ( ) ;
336345 let mut groups: BTreeMap < String , BakefileGroup > = BTreeMap :: new ( ) ;
337346
@@ -364,7 +373,7 @@ impl Bakefile {
364373 let image_index_manifest_tag = utils:: format_image_index_manifest_tag (
365374 & image_version,
366375 & metadata. vendor_tag_prefix ,
367- & cli_args. image_version ,
376+ & cli_args. vendor_version ,
368377 ) ;
369378
370379 let image_manifest_tag = utils:: format_image_manifest_tag (
@@ -400,7 +409,7 @@ impl Bakefile {
400409 ) ) ;
401410 build_arguments. insert ( docker:: BuildArgument :: new (
402411 "IMAGE_REPOSITORY_URI" . to_owned ( ) ,
403- image_repository_uri,
412+ image_repository_uri. clone ( ) ,
404413 ) ) ;
405414 build_arguments. insert ( docker:: BuildArgument :: new (
406415 "IMAGE_INDEX_MANIFEST_TAG" . to_owned ( ) ,
@@ -415,6 +424,30 @@ impl Bakefile {
415424 image_manifest_uri. clone ( ) ,
416425 ) ) ;
417426
427+ let tags = if let Some ( floating_vendor_version) = floating_vendor_version. as_deref ( )
428+ {
429+ let image_index_manifest_floating_tag = utils:: format_image_index_manifest_tag (
430+ & image_version,
431+ & metadata. vendor_tag_prefix ,
432+ floating_vendor_version,
433+ ) ;
434+
435+ let image_manifest_floating_tag = utils:: format_image_manifest_tag (
436+ & image_index_manifest_floating_tag,
437+ cli_args. target_platform . architecture ( ) ,
438+ cli_args. strip_architecture ,
439+ ) ;
440+
441+ let floating_image_manifest_uri = utils:: format_image_manifest_uri (
442+ & image_repository_uri,
443+ & image_manifest_floating_tag,
444+ ) ;
445+
446+ vec ! [ image_manifest_uri, floating_image_manifest_uri]
447+ } else {
448+ vec ! [ image_manifest_uri]
449+ } ;
450+
418451 // By using a cap-std Dir, we can ensure that the paths provided must be relative to
419452 // the appropriate image folder and wont escape it by providing absolute or relative
420453 // paths with traversals (..).
@@ -461,11 +494,11 @@ impl Bakefile {
461494 let annotations = BakefileTarget :: image_version_annotation (
462495 & image_version,
463496 & metadata. vendor_tag_prefix ,
464- & cli_args. image_version ,
497+ & cli_args. vendor_version ,
465498 ) ;
466499
467500 let target = BakefileTarget {
468- tags : vec ! [ image_manifest_uri ] ,
501+ tags,
469502 arguments : build_arguments,
470503 platforms : vec ! [ cli_args. target_platform. clone( ) ] ,
471504 // NOTE (@Techassi): Should this instead be scoped to the folder of the image we build
0 commit comments