add branch_name option to kibana-commit command

This commit is contained in:
Justin Ibarra
2021-04-14 21:16:09 -08:00
committed by GitHub
parent dbd2874b4f
commit b0f449339d
+3 -2
View File
@@ -132,11 +132,12 @@ def kibana_diff(rule_id, repo, branch, threads):
@click.option("--kibana-directory", "-d", help="Directory to overwrite in Kibana",
default="x-pack/plugins/security_solution/server/lib/detection_engine/rules/prepackaged_rules")
@click.option("--base-branch", "-b", help="Base branch in Kibana", default="master")
@click.option("--branch-name", "-n", help="Head branch for rules (default: package name)")
@click.option("--ssh/--http", is_flag=True, help="Method to use for cloning")
@click.option("--github-repo", "-r", help="Repository to use for the branch", default="elastic/kibana")
@click.option("--message", "-m", help="Override default commit message")
@click.pass_context
def kibana_commit(ctx, local_repo, github_repo, ssh, kibana_directory, base_branch, message):
def kibana_commit(ctx, local_repo, github_repo, ssh, kibana_directory, base_branch, branch_name, message):
"""Prep a commit and push to Kibana."""
git_exe = shutil.which("git")
@@ -167,7 +168,7 @@ def kibana_commit(ctx, local_repo, github_repo, ssh, kibana_directory, base_bran
git("checkout", base_branch)
git("pull")
git("checkout", "-b", f"rules/{package_name}", show_output=True)
git("checkout", "-b", f"rules/{branch_name or package_name}", show_output=True)
git("rm", "-r", kibana_directory)
source_dir = os.path.join(release_dir, "rules")