Skip to content

Commit 46aa7ba

Browse files
committed
hack: add separate function to create common container engine args
Add a separate function to create common container engine arguments to reduce complexity in container_build function. Signed-off-by: Alexander Bachmann <[email protected]>
1 parent edee756 commit 46aa7ba

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

hack/build-image

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,21 +232,26 @@ def container_build(cli, target):
232232
# are the same, skip passing the extra argument.
233233
args.append(f"--arch={target.arch}")
234234

235+
run(cli, args + create_common_container_engine_args(cli, target), check=True)
236+
237+
def create_common_container_engine_args(cli, target):
238+
args = []
235239
pkgs_from = PACKAGES_FROM[target.pkg_source]
236240
if pkgs_from:
237241
args.append(f"--build-arg=INSTALL_PACKAGES_FROM={pkgs_from}")
238-
242+
239243
if cli.extra_build_arg:
240244
args.extend(cli.extra_build_arg)
245+
241246
for tname in target.all_names(baseless=cli.without_repo_bases):
242247
args.append("-t")
243248
args.append(tname)
249+
244250
args.append("-f")
245251
args.append(target_containerfile(target))
246252
args.append(kind_source_dir(target.name))
247253
args = [str(a) for a in args]
248-
run(cli, args, check=True)
249-
254+
return args
250255

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

0 commit comments

Comments
 (0)