]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
script/build-with-container: support --build-arg arguments
authorJohn Mulligan <jmulligan@redhat.com>
Fri, 20 Jun 2025 23:46:16 +0000 (19:46 -0400)
committerDavid Galloway <david.galloway@ibm.com>
Thu, 31 Jul 2025 21:57:54 +0000 (17:57 -0400)
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 <jmulligan@redhat.com>
(cherry picked from commit 7802a61150af85ef49c666666af753cee5a14451)

src/script/build-with-container.py

index 535fda7007eb88b39046ed8520f9842c4b9093d4..47c295d046e6a5847799bb798a2ac77398f9fc00 100755 (executable)
@@ -538,6 +538,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)
@@ -920,6 +922,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",