From: John Mulligan Date: Fri, 20 Jun 2025 23:46:16 +0000 (-0400) Subject: script/build-with-container: support --build-arg arguments X-Git-Tag: testing/wip-jcollin-testing-20250822.153655-tentacle~6^2~5 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=bc6afe202ac0cf0a161b5000fa375c0af5fa95e1;p=ceph-ci.git script/build-with-container: support --build-arg arguments Allow passing --build-arg arguments to build-with-container.py which are passed directly to the container build command. This allows a developer to toggle certain features of the build container, however this should not be used in CI. Signed-off-by: John Mulligan (cherry picked from commit 7802a61150af85ef49c666666af753cee5a14451) --- diff --git a/src/script/build-with-container.py b/src/script/build-with-container.py index 3b519fe63da..4dd35517f3e 100755 --- a/src/script/build-with-container.py +++ b/src/script/build-with-container.py @@ -553,6 +553,8 @@ def build_container(ctx): f"--volume={ctx.dnf_cache_dir}:/var/cache/dnf:Z", "--build-arg=CLEAN_DNF=no", ] + if ctx.cli.build_args: + cmd.extend([f"--build-arg={v}" for v in ctx.cli.build_args]) cmd += ["-f", ctx.cli.containerfile, ctx.cli.containerdir] with ctx.user_command(): _run(cmd, check=True, ctx=ctx) @@ -935,6 +937,15 @@ def parse_cli(build_step_names): " (the ceph source root)" ), ) + parser.add_argument( + "--build-arg", + dest="build_args", + action="append", + help=( + "Extra argument to pass to container image build." + " Can be used to override default build image behavior." + ), + ) parser.add_argument( "--overlay-dir", "-l",