branch = "UNKNOWN"
return f"{branch}.{self.cli.distro}"
+ 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:
"-t",
ctx.image_name,
f"--build-arg=JENKINS_HOME={ctx.cli.homedir}",
+ f"--build-arg=CEPH_BASE_BRANCH={ctx.base_branch()}",
]
if ctx.cli.distro:
cmd.append(f"--build-arg=DISTRO={ctx.from_image}")
"-t",
help="Specify a container tag",
)
+ parser.add_argument(
+ "--base-branch",
+ help="Specify a base branch name",
+ )
parser.add_argument(
"--current-branch",
help="Manually specify the current branch name",