mirror of
https://github.com/ceph/ceph
synced 2025-03-20 09:16:59 +00:00
script/build-with-container: add --current-branch cli option
Add a new --current-branch argument that lets the user supply a name for the current branch. This allows the automatic tag generation to avoid calling git - something useful if the tree is not using a git checkout (like a tarball). It also allows you to pull a temporary branch in git but ignore it and act like the temporary branch is the base branch. Signed-off-by: John Mulligan <jmulligan@redhat.com>
This commit is contained in:
parent
65f055f0d8
commit
c1713c5bc3
@ -286,10 +286,12 @@ class Context:
|
||||
def target_tag(self):
|
||||
if self.cli.tag:
|
||||
return self.cli.tag
|
||||
try:
|
||||
branch = _git_current_branch(self).replace("/", "-")
|
||||
except subprocess.CalledProcessError:
|
||||
branch = "UNKNOWN"
|
||||
branch = self.cli.current_branch
|
||||
if not branch:
|
||||
try:
|
||||
branch = _git_current_branch(self).replace("/", "-")
|
||||
except subprocess.CalledProcessError:
|
||||
branch = "UNKNOWN"
|
||||
return f"{branch}.{self.cli.distro}"
|
||||
|
||||
@property
|
||||
@ -668,6 +670,10 @@ def parse_cli(build_step_names):
|
||||
"-t",
|
||||
help="Specify a container tag",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--current-branch",
|
||||
help="Manually specify the current branch name",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--image-repo",
|
||||
help="Specify a container image repository",
|
||||
|
Loading…
Reference in New Issue
Block a user