From 6809036bb2bff75b5c741aecec9f2ea2c266be0d Mon Sep 17 00:00:00 2001 From: Ryan Ahearn Date: Wed, 11 Sep 2024 13:36:11 -0400 Subject: [PATCH] Add a cli argument for overriding the locker branch --- plant/cli.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/plant/cli.py b/plant/cli.py index 8949556..9f38bff 100644 --- a/plant/cli.py +++ b/plant/cli.py @@ -21,6 +21,7 @@ from compliance.evidence import ExternalEvidence, YEAR from compliance.utils.credentials import Config +from compliance.config import get_config from ilcli import Command @@ -37,6 +38,11 @@ def _init_arguments(self): "as an example https://github.com/my-org/my-repo" ), ) + self.add_argument( + '--branch', + help="Branch name for locker repository", + default=False + ) self.add_argument( "--creds", metavar="~/path/creds", @@ -106,6 +112,10 @@ def _run(self, args): gitconfig = None if args.git_config or args.git_config_file: gitconfig = args.git_config or json.loads(open(args.git_config_file).read()) + if args.branch: + c = get_config() + c.load() + c.raw_config["locker"]["default_branch"] = args.branch # self.name drives the Locker push mode. # - dry-run translates to locker no-push mode # - push-remote translates to locker full-remote mode