@@ -250,10 +250,10 @@ impl Bakefile {
250250 ///
251251 /// This will only create targets for selected entry images and their dependencies. There is no
252252 /// need to filter anything out afterwards. The filtering is done automatically internally.
253- pub fn from_args ( args : & cli:: BuildArguments , config : Config ) -> Result < Self , Error > {
253+ pub fn from_cli_args ( cli_args : & cli:: BuildArguments , config : Config ) -> Result < Self , Error > {
254254 let targets =
255- Targets :: set ( & args . images , TargetsOptions :: default ( ) ) . context ( CreateGraphSnafu ) ?;
256- Self :: from_targets ( targets, args , config)
255+ Targets :: set ( & cli_args . images , TargetsOptions :: default ( ) ) . context ( CreateGraphSnafu ) ?;
256+ Self :: from_targets ( targets, cli_args , config)
257257 }
258258
259259 /// Returns all image manifest URIs for entry images.
@@ -273,36 +273,36 @@ impl Bakefile {
273273
274274 /// Creates the common target, containing shared data, which will be inherited by other targets.
275275 fn common_target (
276- args : & cli:: BuildArguments ,
277- build_arguments : BuildArguments ,
276+ cli_args : & cli:: BuildArguments ,
277+ container_build_args : BuildArguments ,
278278 metadata : & Metadata ,
279279 ) -> Result < BakefileTarget , Error > {
280280 let revision = Self :: git_head_revision ( ) . context ( GetRevisionSnafu ) ?;
281281 let date_time = Self :: now ( ) ?;
282282
283283 // Load build arguments from a file if the user requested it
284- let mut user_build_arguments = args . build_arguments . clone ( ) ;
285- if let Some ( path) = & args . build_arguments_file {
284+ let mut user_container_build_args = cli_args . build_arguments . clone ( ) ;
285+ if let Some ( path) = & cli_args . build_arguments_file {
286286 let build_arguments_from_file =
287287 BuildArguments :: from_file ( path) . context ( ParseBuildArgumentsSnafu ) ?;
288- user_build_arguments . extend ( build_arguments_from_file) ;
288+ user_container_build_args . extend ( build_arguments_from_file) ;
289289 }
290290
291291 let target = BakefileTarget :: common (
292292 date_time,
293293 revision,
294- build_arguments,
294+ cli_args. image_version . base_prerelease ( ) ,
295+ container_build_args,
296+ user_container_build_args,
295297 metadata,
296- user_build_arguments,
297- args. image_version . base_prerelease ( ) ,
298298 ) ;
299299
300300 Ok ( target)
301301 }
302302
303303 fn from_targets (
304304 targets : Targets ,
305- args : & cli:: BuildArguments ,
305+ cli_args : & cli:: BuildArguments ,
306306 config : Config ,
307307 ) -> Result < Self , Error > {
308308 let mut bakefile_targets = BTreeMap :: new ( ) ;
@@ -315,34 +315,34 @@ impl Bakefile {
315315 } = config;
316316
317317 // Create a common target, which contains shared data, like annotations, arguments, labels, etc...
318- let common_target = Self :: common_target ( args , build_arguments, & metadata) ?;
318+ let common_target = Self :: common_target ( cli_args , build_arguments, & metadata) ?;
319319 bakefile_targets. insert ( COMMON_TARGET_NAME . to_owned ( ) , common_target) ;
320320
321321 // The image registry, eg. `oci.stackable.tech` or `localhost`
322- let image_registry = if args . use_localhost_registry {
322+ let image_registry = if cli_args . use_localhost_registry {
323323 & HostPort :: localhost ( )
324324 } else {
325- & args . registry
325+ & cli_args . registry
326326 } ;
327327
328328 for ( image_name, image_versions) in targets. into_iter ( ) {
329329 for ( image_version, ( image_options, is_entry) ) in image_versions {
330330 let image_repository_uri = utils:: format_image_repository_uri (
331331 image_registry,
332- & args . registry_namespace ,
332+ & cli_args . registry_namespace ,
333333 & image_name,
334334 ) ;
335335
336336 let image_index_manifest_tag = utils:: format_image_index_manifest_tag (
337337 & image_version,
338338 & metadata. vendor_tag_prefix ,
339- & args . image_version ,
339+ & cli_args . image_version ,
340340 ) ;
341341
342342 let image_manifest_tag = utils:: format_image_manifest_tag (
343343 & image_index_manifest_tag,
344- args . target_platform . architecture ( ) ,
345- args . strip_architecture ,
344+ cli_args . target_platform . architecture ( ) ,
345+ cli_args . strip_architecture ,
346346 ) ;
347347
348348 let image_manifest_uri =
@@ -404,13 +404,13 @@ impl Bakefile {
404404 PathBuf :: new ( ) . join ( & image_name) . join ( custom_path)
405405 } else {
406406 ensure ! (
407- image_dir. exists( & args . target_containerfile) ,
407+ image_dir. exists( & cli_args . target_containerfile) ,
408408 NoSuchContainerfileExistsSnafu { path: image_name }
409409 ) ;
410410
411411 PathBuf :: new ( )
412412 . join ( & image_name)
413- . join ( & args . target_containerfile )
413+ . join ( & cli_args . target_containerfile )
414414 } ;
415415
416416 let target_name = if is_entry {
@@ -433,13 +433,13 @@ impl Bakefile {
433433 let annotations = BakefileTarget :: image_version_annotation (
434434 & image_version,
435435 & metadata. vendor_tag_prefix ,
436- & args . image_version ,
436+ & cli_args . image_version ,
437437 ) ;
438438
439439 let target = BakefileTarget {
440440 tags : vec ! [ image_manifest_uri] ,
441441 arguments : build_arguments,
442- platforms : vec ! [ args . target_platform. clone( ) ] ,
442+ platforms : vec ! [ cli_args . target_platform. clone( ) ] ,
443443 // NOTE (@Techassi): Should this instead be scoped to the folder of the image we build
444444 context : Some ( PathBuf :: from ( "." ) ) ,
445445 dockerfile : Some ( dockerfile_path) ,
@@ -567,10 +567,10 @@ impl BakefileTarget {
567567 fn common (
568568 date_time : String ,
569569 revision : String ,
570- build_arguments : BuildArguments ,
571- metadata : & Metadata ,
572- user_build_arguments : Vec < BuildArgument > ,
573570 release_version : String ,
571+ container_build_args : BuildArguments ,
572+ user_container_build_args : Vec < BuildArgument > ,
573+ metadata : & Metadata ,
574574 ) -> Self {
575575 let config:: Metadata {
576576 documentation : docs,
@@ -609,8 +609,8 @@ impl BakefileTarget {
609609 annotations. push ( format ! ( "{ANNOTATION_VENDOR}={vendor}" ) ) ;
610610 }
611611
612- let mut arguments = build_arguments ;
613- arguments. extend ( user_build_arguments ) ;
612+ let mut arguments = container_build_args ;
613+ arguments. extend ( user_container_build_args ) ;
614614 arguments. insert ( BuildArgument :: new (
615615 "RELEASE_VERSION" . to_owned ( ) ,
616616 release_version,
0 commit comments