]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
script/build-with-container: add --base-branch cli option
authorJohn Mulligan <jmulligan@redhat.com>
Fri, 14 Feb 2025 16:37:04 +0000 (11:37 -0500)
committerDavid Galloway <david.galloway@ibm.com>
Thu, 31 Jul 2025 21:14:52 +0000 (17:14 -0400)
Add a command line option --base-branch that allows the user to supply a
custom base branch name. git doesn't make determining this easy so we
always assume a base branch of 'main' by default - but this option lets
one change that.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
(cherry picked from commit ff34bf7241f1a1072f74494cc8f50156e0076019)

src/script/build-with-container.py

index dfbf967b5f8c623a76e671b6ca5f742b8e9342cd..8742827d8a97abceecd8b8d5c23669a4b020887c 100755 (executable)
@@ -319,6 +319,15 @@ class Context:
         # customizations (that don't yet exist) or invalidate image caching.
         return self.cli.base_branch or "main"
 
+    def base_branch(self):
+        # because git truly is the *stupid* content tracker there's not a
+        # simple way to detect base branch. In BWC the base branch is really
+        # only here for an optional 2nd level of customization in the build
+        # container bootstrap we default to `main` even when that's not true.
+        # One can explicltly set the base branch on the command line to invoke
+        # customizations (that don't yet exist) or invalidate image caching.
+        return self.cli.base_branch or 'main'
+
     @property
     def from_image(self):
         if self.cli.base_image:
@@ -745,6 +754,10 @@ def parse_cli(build_step_names):
         "--base-branch",
         help="Specify a base branch name",
     )
+    parser.add_argument(
+        "--base-branch",
+        help="Specify a base branch name",
+    )
     parser.add_argument(
         "--current-branch",
         help="Manually specify the current branch name",