Skip to content

Commit

Permalink
hack: add separate function to create common container engine args
Browse files Browse the repository at this point in the history
Add a separate function to create common container engine arguments
to reduce complexity in container_build function.

Signed-off-by: Alexander Bachmann <[email protected]>
  • Loading branch information
abachmann committed Oct 24, 2024
1 parent edee756 commit 46aa7ba
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions hack/build-image
Original file line number Diff line number Diff line change
Expand Up @@ -232,21 +232,26 @@ def container_build(cli, target):
# are the same, skip passing the extra argument.
args.append(f"--arch={target.arch}")

run(cli, args + create_common_container_engine_args(cli, target), check=True)

def create_common_container_engine_args(cli, target):
args = []
pkgs_from = PACKAGES_FROM[target.pkg_source]
if pkgs_from:
args.append(f"--build-arg=INSTALL_PACKAGES_FROM={pkgs_from}")

if cli.extra_build_arg:
args.extend(cli.extra_build_arg)

for tname in target.all_names(baseless=cli.without_repo_bases):
args.append("-t")
args.append(tname)

args.append("-f")
args.append(target_containerfile(target))
args.append(kind_source_dir(target.name))
args = [str(a) for a in args]
run(cli, args, check=True)

return args

def container_push(cli, push_name):
"""Construct and execute a command to push a container image."""
Expand Down

0 comments on commit 46aa7ba

Please sign in to comment.