Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a cli argument for overriding the locker branch #13

Merged
merged 2 commits into from
Sep 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions plant/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -37,6 +38,9 @@ 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",
Expand Down Expand Up @@ -106,6 +110,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
Expand Down
Loading