mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-12-18 02:50:30 +00:00
ci: retest only one pr at a time & rebase if necessary
This commit improves retest action by rebasing the pr if it behind devel branch and adding retests to only one pr at a time. refer: https://docs.github.com/en/graphql/reference/enums#mergestatestatus Signed-off-by: Rakshith R <rar@redhat.com>
This commit is contained in:
parent
d3650ae863
commit
bf9e14d2c9
@ -147,6 +147,19 @@ func main() {
|
|||||||
log.Printf("found context %s with status %s\n", r.GetContext(), r.GetState())
|
log.Printf("found context %s with status %s\n", r.GetContext(), r.GetState())
|
||||||
if contains([]string{"failed", "failure"}, r.GetState()) {
|
if contains([]string{"failed", "failure"}, r.GetState()) {
|
||||||
log.Printf("found failed test %s\n", r.GetContext())
|
log.Printf("found failed test %s\n", r.GetContext())
|
||||||
|
failedTestFound = true
|
||||||
|
// rebase the pr if it is behind the devel branch.
|
||||||
|
if *re.MergeableState == "BEHIND" {
|
||||||
|
comment := &github.IssueComment{
|
||||||
|
Body: github.String("@mergifyio rebase"),
|
||||||
|
}
|
||||||
|
_, _, err := c.client.Issues.CreateComment(context.TODO(), c.owner, c.repo, prNumber, comment)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("failed to create comment %v\n", err)
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
// check if retest limit is reached
|
// check if retest limit is reached
|
||||||
msg := fmt.Sprintf("/retest %s", r.GetContext())
|
msg := fmt.Sprintf("/retest %s", r.GetContext())
|
||||||
ok, err := c.checkRetestLimitReached(prNumber, msg)
|
ok, err := c.checkRetestLimitReached(prNumber, msg)
|
||||||
@ -175,7 +188,6 @@ func main() {
|
|||||||
log.Printf("failed to create comment %v\n", err)
|
log.Printf("failed to create comment %v\n", err)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
failedTestFound = true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,8 +200,10 @@ func main() {
|
|||||||
_, _, err = c.client.Issues.CreateComment(context.TODO(), c.owner, c.repo, prNumber, comment)
|
_, _, err = c.client.Issues.CreateComment(context.TODO(), c.owner, c.repo, prNumber, comment)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Printf("failed to create comment %q: %v\n", msg, err)
|
log.Printf("failed to create comment %q: %v\n", msg, err)
|
||||||
continue
|
|
||||||
}
|
}
|
||||||
|
// exit after adding retests to a pr once to avoid retesting multiple prs
|
||||||
|
// at the same time.
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user