Skip to content

Commit 7802a61

Browse files
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 <[email protected]>
1 parent 9cbadc2 commit 7802a61

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/script/build-with-container.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,8 @@ def build_container(ctx):
539539
f"--volume={ctx.dnf_cache_dir}:/var/cache/dnf:Z",
540540
"--build-arg=CLEAN_DNF=no",
541541
]
542+
if ctx.cli.build_args:
543+
cmd.extend([f"--build-arg={v}" for v in ctx.cli.build_args])
542544
cmd += ["-f", ctx.cli.containerfile, ctx.cli.containerdir]
543545
with ctx.user_command():
544546
_run(cmd, check=True, ctx=ctx)
@@ -921,6 +923,15 @@ def parse_cli(build_step_names):
921923
" (the ceph source root)"
922924
),
923925
)
926+
parser.add_argument(
927+
"--build-arg",
928+
dest="build_args",
929+
action="append",
930+
help=(
931+
"Extra argument to pass to container image build."
932+
" Can be used to override default build image behavior."
933+
),
934+
)
924935
parser.add_argument(
925936
"--overlay-dir",
926937
"-l",

0 commit comments

Comments
 (0)