This is an automated email from the ASF dual-hosted git repository.

ivank pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git


The following commit(s) were added to refs/heads/master by this push:
     new 21a89a7  Require green CI before merge
21a89a7 is described below

commit 21a89a7c486b842846ba9c15d6ec52d4486dd74c
Author: Ivan Kelly <iv...@apache.org>
AuthorDate: Tue Feb 13 17:50:36 2018 +0100

    Require green CI before merge
    
    CI has been broken since the 2018-02-06, due to a non-green patch
    being merged. With the recent flake fixes, CI should only go green if
    there's a good reason. More over, any remaining problems will get
    fixed faster, if people non-green builds start being a pain for
    people.
    
    So, this patch blocks merging with the merge script, if all checks are
    not green. It can be overriden by adding a comment with the text
    "Ignore CI" (case insensitive), on the PR.
    
    Author: Ivan Kelly <iv...@apache.org>
    
    Reviewers: Dave Rusek <dave.ru...@gmail.com>, Jia Zhai <None>, Enrico 
Olivelli <eolive...@gmail.com>, Sijie Guo <si...@apache.org>
    
    This closes #1145 from ivankelly/require-green
---
 dev/bk-merge-pr.py | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/dev/bk-merge-pr.py b/dev/bk-merge-pr.py
index 8c3415e..c5dffe7 100755
--- a/dev/bk-merge-pr.py
+++ b/dev/bk-merge-pr.py
@@ -476,6 +476,19 @@ def get_reviewers(pr_num):
         reviewers_emails.append('{0} <{1}>'.format(username.encode('utf8'), 
useremail))
     return ', '.join(reviewers_emails)
 
+def check_ci_status(pr):
+    status_url = get_json("%s/commits/%s/status" % (GITHUB_API_BASE, 
pr["head"]["sha"]))
+    state = status_url["state"]
+    if state != "success":
+        comments = get_json(pr["comments_url"])
+        ignore_ci_comments = [c for c in comments if c["body"].upper() == 
"IGNORE CI"]
+        if len(ignore_ci_comments) > 0:
+            print "\n\nWARNING: The PR has not passed CI (state is %s)" % 
(state) \
+                + ", but this has been overridden by %s. \n" % 
(ignore_ci_comments[0]["user"]["login"]) \
+                + "Proceed at your own peril!\n\n"
+        else:
+            fail("The PR has not passed CI (state is %s)" % (state))
+
 def ask_release_for_github_issues(branch, labels):
     print "=== Add release to github issues ==="
     while True:
@@ -643,9 +656,11 @@ def main():
     pr = get_json("%s/pulls/%s" % (GITHUB_API_BASE, pr_num))
     pr_events = get_json("%s/issues/%s/events" % (GITHUB_API_BASE, pr_num))
     pr_reviewers = get_reviewers(pr_num)
+    check_ci_status(pr)
+
     url = pr["url"]
 
-    # 3. repare the title for commit message
+    # 3. repair the title for commit message
     pr_title = pr["title"]
     commit_title = raw_input("Commit title [%s]: " % 
pr_title.encode("utf-8")).decode("utf-8")
     if commit_title == "":

-- 
To stop receiving notification emails like this one, please contact
iv...@apache.org.

Reply via email to