mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-03 13:02:00 +00:00
add automerge prs step
This commit is contained in:
parent
30e0c1a1b8
commit
e034558f74
4
.github/workflows/create_release.yml
vendored
4
.github/workflows/create_release.yml
vendored
@ -171,6 +171,10 @@ jobs:
|
||||
export CHECK_NAME="Docker keeper image"
|
||||
python3 docker_server.py --release-type auto --version ${{ env.RELEASE_TAG }} --check-name "$CHECK_NAME" --sha ${{ env.COMMIT_SHA }} ${{ ! inputs.dry-run && '--push' || '' }}
|
||||
python3 ./create_release.py --set-progress-completed
|
||||
- name: Update release info. Merge created PRs
|
||||
shell: bash
|
||||
run: |
|
||||
python3 ./tests/ci/create_release.py --merge-prs ${{ inputs.dry-run == true && '--dry-run' || '' }}
|
||||
- name: Set current Release progress to Completed with OK
|
||||
shell: bash
|
||||
run: |
|
||||
|
@ -40,6 +40,7 @@ disable = '''
|
||||
global-statement,
|
||||
f-string-without-interpolation,
|
||||
consider-using-with,
|
||||
use-maxsplit-arg,
|
||||
'''
|
||||
|
||||
[tool.pylint.SIMILARITIES]
|
||||
|
@ -228,7 +228,7 @@ class Shell:
|
||||
):
|
||||
if dry_run:
|
||||
print(f"Dry-ryn. Would run command [{command}]")
|
||||
return 0
|
||||
return True
|
||||
if verbose:
|
||||
print(f"Run command [{command}]")
|
||||
proc = subprocess.Popen(
|
||||
|
@ -43,6 +43,7 @@ class ReleaseProgress:
|
||||
TEST_TGZ = "test TGZ packages"
|
||||
TEST_RPM = "test RPM packages"
|
||||
TEST_DEB = "test DEB packages"
|
||||
MERGE_CREATED_PRS = "merge created PRs"
|
||||
COMPLETED = "completed"
|
||||
|
||||
|
||||
@ -101,6 +102,7 @@ class ReleaseInfo:
|
||||
previous_release_sha: str
|
||||
changelog_pr: str = ""
|
||||
version_bump_pr: str = ""
|
||||
prs_merged: bool = False
|
||||
release_url: str = ""
|
||||
debian_command: str = ""
|
||||
rpm_command: str = ""
|
||||
@ -380,6 +382,38 @@ class ReleaseInfo:
|
||||
self.release_url = f"dry-run"
|
||||
self.dump()
|
||||
|
||||
def merge_prs(self, dry_run: bool) -> None:
|
||||
repo = CI.Envs.GITHUB_REPOSITORY
|
||||
assert self.version_bump_pr
|
||||
if dry_run:
|
||||
version_bump_pr_num = 12345
|
||||
else:
|
||||
version_bump_pr_num = int(self.version_bump_pr.split("/")[-1])
|
||||
print("Merging Version bump PR")
|
||||
res_1 = Shell.check(
|
||||
f"gh pr merge {version_bump_pr_num} --repo {repo} --merge --auto",
|
||||
verbose=True,
|
||||
dry_run=dry_run,
|
||||
)
|
||||
|
||||
res_2 = True
|
||||
if not self.release_tag.endswith("-new"):
|
||||
assert self.changelog_pr
|
||||
print("Merging ChangeLog PR")
|
||||
if dry_run:
|
||||
changelog_pr_num = 23456
|
||||
else:
|
||||
changelog_pr_num = int(self.changelog_pr.split("/")[-1])
|
||||
res_2 = Shell.check(
|
||||
f"gh pr merge {changelog_pr_num} --repo {repo} --merge --auto",
|
||||
verbose=True,
|
||||
dry_run=dry_run,
|
||||
)
|
||||
else:
|
||||
assert not self.changelog_pr
|
||||
|
||||
self.prs_merged = res_1 and res_2
|
||||
|
||||
|
||||
class RepoTypes:
|
||||
RPM = "rpm"
|
||||
@ -627,6 +661,11 @@ def parse_args() -> argparse.Namespace:
|
||||
action="store_true",
|
||||
help="Create GH Release object and attach all packages",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--merge-prs",
|
||||
action="store_true",
|
||||
help="Merge PRs with version, changelog updates",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--post-status",
|
||||
action="store_true",
|
||||
@ -732,7 +771,6 @@ if __name__ == "__main__":
|
||||
|
||||
if args.post_status:
|
||||
release_info = ReleaseInfo.from_file()
|
||||
release_info.update_release_info(dry_run=args.dry_run)
|
||||
if release_info.is_new_release_branch():
|
||||
title = "New release branch"
|
||||
else:
|
||||
@ -766,6 +804,13 @@ if __name__ == "__main__":
|
||||
ri.progress_description = ReleaseProgressDescription.OK
|
||||
ri.dump()
|
||||
|
||||
if args.merge_prs:
|
||||
with ReleaseContextManager(
|
||||
release_progress=ReleaseProgress.MERGE_CREATED_PRS
|
||||
) as release_info:
|
||||
release_info.update_release_info(dry_run=args.dry_run)
|
||||
release_info.merge_prs(dry_run=args.dry_run)
|
||||
|
||||
# tear down ssh
|
||||
if _ssh_agent and _key_pub:
|
||||
_ssh_agent.remove(_key_pub)
|
||||
|
@ -689,4 +689,5 @@ def main():
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
assert False, "Script Deprecated, ask ci team for help"
|
||||
main()
|
||||
|
Loading…
Reference in New Issue
Block a user