From da34123eb81c9c741bf7c35902abe2f624137025 Mon Sep 17 00:00:00 2001 From: larsevj Date: Wed, 13 Mar 2024 13:51:30 +0100 Subject: [PATCH] Add flag for building for rhel8 in insert release --- komodo/insert_proposals.py | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/komodo/insert_proposals.py b/komodo/insert_proposals.py index 27776b9f4..bf9d83d22 100644 --- a/komodo/insert_proposals.py +++ b/komodo/insert_proposals.py @@ -94,6 +94,7 @@ def main(): args.git_ref, args.jobname, args.joburl, + args.rhel8, ) @@ -206,7 +207,9 @@ def create_pr_with_changes( tmp_target: str, tmp_ref: GitRef, pr_msg: str, + rhel8: Optional[bool] = False, ): + commit_title = f"Add release {target}+rhel8" if rhel8 else f"Add release {target}" repo.create_git_ref(ref="refs/heads/" + target, sha=from_sha) # making a temporary PR in order to squash the commits into one tmp_pr = repo.create_pull( @@ -217,7 +220,7 @@ def create_pr_with_changes( ) tmp_pr.merge( commit_message=pr_msg, - commit_title=f"Add release {target}", + commit_title=commit_title, merge_method="squash", ) with contextlib.suppress(github.GithubException): @@ -247,7 +250,13 @@ def create_new_release_file( def insert_proposals( - repo: Repository, base: str, target: str, git_ref: str, jobname: str, joburl: str + repo: Repository, + base: str, + target: str, + git_ref: str, + jobname: str, + joburl: str, + rhel8: Optional[bool] = False, ) -> None: tmp_target = target + ".tmp" @@ -297,7 +306,9 @@ def insert_proposals( jobname=jobname, joburl=joburl, ) - create_pr_with_changes(repo, git_ref, target, from_sha, tmp_target, tmp_ref, pr_msg) + create_pr_with_changes( + repo, git_ref, target, from_sha, tmp_target, tmp_ref, pr_msg, rhel8 + ) class InsertProposalsNamespace(argparse.Namespace): @@ -312,6 +323,7 @@ class InsertProposalsNamespace(argparse.Namespace): git_fork: str git_repo: str git_ref: str + rhel8: bool def parse_args() -> InsertProposalsNamespace: @@ -337,6 +349,12 @@ def parse_args() -> InsertProposalsNamespace: parser.add_argument("--git-fork", help="git fork", default="equinor") parser.add_argument("--git-repo", help="git repo", default="komodo-releases") parser.add_argument("--git-ref", help="git ref", default="main") + parser.add_argument( + "--rhel8", + action="store_true", + help="Flag to indicate if one should add release for RHEL8.", + default=False, + ) return parser.parse_args(namespace=InsertProposalsNamespace())