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 flag for building for rhel8 in insert release #483

Merged
merged 1 commit into from
Apr 19, 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
24 changes: 21 additions & 3 deletions komodo/insert_proposals.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ def main():
args.git_ref,
args.jobname,
args.joburl,
args.rhel8,
)


Expand Down Expand Up @@ -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(
Expand All @@ -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):
Expand Down Expand Up @@ -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"

Expand Down Expand Up @@ -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):
Expand All @@ -312,6 +323,7 @@ class InsertProposalsNamespace(argparse.Namespace):
git_fork: str
git_repo: str
git_ref: str
rhel8: bool


def parse_args() -> InsertProposalsNamespace:
Expand All @@ -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())


Expand Down