mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
Merge pull request #65010 from ClickHouse/ci_backport_fixes
CI: Fix backports
This commit is contained in:
commit
a0f3d233d7
@ -127,13 +127,11 @@ close it.
|
||||
to_pop.append(i)
|
||||
elif pr.head.ref.startswith(f"backport/{self.name}"):
|
||||
self.backport_pr = pr
|
||||
self._backported = True
|
||||
to_pop.append(i)
|
||||
else:
|
||||
assert False, f"BUG! Invalid PR's branch [{pr.head.ref}]"
|
||||
|
||||
# Cherry-pick or backport PR found, set @backported flag for current release branch
|
||||
self._backported = True
|
||||
|
||||
for i in reversed(to_pop):
|
||||
# Going from the tail to keep the order and pop greater index first
|
||||
prs.pop(i)
|
||||
@ -218,6 +216,7 @@ close it.
|
||||
self.name,
|
||||
self.pr.number,
|
||||
)
|
||||
self._backported = True
|
||||
return
|
||||
except CalledProcessError:
|
||||
# There are most probably conflicts, they'll be resolved in PR
|
||||
@ -247,7 +246,6 @@ close it.
|
||||
self.cherrypick_pr.add_to_labels(Labels.PR_CRITICAL_BUGFIX)
|
||||
elif Labels.PR_BUGFIX in [label.name for label in self.pr.labels]:
|
||||
self.cherrypick_pr.add_to_labels(Labels.PR_BUGFIX)
|
||||
self._backported = True
|
||||
self._assign_new_pr(self.cherrypick_pr)
|
||||
# update cherrypick PR to get the state for PR.mergable
|
||||
self.cherrypick_pr.update()
|
||||
@ -359,10 +357,10 @@ class Backport:
|
||||
self._fetch_from = fetch_from
|
||||
self.dry_run = dry_run
|
||||
|
||||
self.must_create_backport_label = (
|
||||
Labels.MUST_BACKPORT
|
||||
self.must_create_backport_labels = (
|
||||
[Labels.MUST_BACKPORT]
|
||||
if self._repo_name == self._fetch_from
|
||||
else Labels.MUST_BACKPORT_CLOUD
|
||||
else [Labels.MUST_BACKPORT_CLOUD, Labels.MUST_BACKPORT]
|
||||
)
|
||||
self.backport_created_label = (
|
||||
Labels.PR_BACKPORTS_CREATED
|
||||
@ -468,7 +466,7 @@ class Backport:
|
||||
query_args = {
|
||||
"query": f"type:pr repo:{self._fetch_from} -label:{self.backport_created_label}",
|
||||
"label": ",".join(
|
||||
self.labels_to_backport + [self.must_create_backport_label]
|
||||
self.labels_to_backport + self.must_create_backport_labels
|
||||
),
|
||||
"merged": [since_date, tomorrow],
|
||||
}
|
||||
@ -492,7 +490,10 @@ class Backport:
|
||||
def process_pr(self, pr: PullRequest) -> None:
|
||||
pr_labels = [label.name for label in pr.labels]
|
||||
|
||||
if self.must_create_backport_label in pr_labels:
|
||||
if (
|
||||
any(label in pr_labels for label in self.must_create_backport_labels)
|
||||
or self._repo_name != self._fetch_from
|
||||
):
|
||||
branches = [
|
||||
ReleaseBranch(br, pr, self.repo, self.backport_created_label)
|
||||
for br in self.release_branches
|
||||
@ -532,8 +533,8 @@ class Backport:
|
||||
br.process(self.dry_run)
|
||||
|
||||
for br in branches:
|
||||
assert br.backported, f"BUG! backport to branch [{br}] failed"
|
||||
self.mark_pr_backported(pr)
|
||||
if br.backported:
|
||||
self.mark_pr_backported(pr)
|
||||
|
||||
def mark_pr_backported(self, pr: PullRequest) -> None:
|
||||
if self.dry_run:
|
||||
|
Loading…
Reference in New Issue
Block a user