gaogaotiantian commented on code in PR #60261:
URL: https://github.com/apache/spark/pull/60261#discussion_r4543565469


##########
dev/merge_spark_pr.py:
##########
@@ -879,15 +889,23 @@ def clean_up():
             git.run("git branch -D %s" % branch)
 
 
-def should_skip_post_merge_ci(target_ref):
+def should_skip_post_merge_ci(target_ref, force_post_merge_ci=False):
     """Return whether the next commit on ``target_ref`` should skip post-merge 
CI.
 
     The branch history count matches the check formerly performed in 
``build_main.yml``.
+    ``force_post_merge_ci`` is set when the PR carries 
``POST_MERGE_CI_FORCE_LABEL``.
     """
     interval = POST_MERGE_CI_INTERVALS.get(target_ref)
     if interval is None:
         return False
 
+    if force_post_merge_ci:
+        print(
+            "Post-merge CI will run on %s: the PR has the %r label."

Review Comment:
   Thanks, that's right. The label only decides whether the script adds the 
`skip-checks: true` trailer. It can't override a skip string that comes in with 
the PR body.
   
   This gap isn't specific to the label path, though. The existing on-interval 
message, `Post-merge CI will run on master: commit count N is divisible by 
10.`, has the same issue. `should_skip_post_merge_ci` never sees the commit 
message, so a PR body with `[skip ci]` also stops CI on an on-interval commit 
while the script says CI will run.
   
   It's also very rare for us. In `master`'s entire history, only one commit 
message (4b736dbab3e, from 2014) contains any of `[skip ci]`, `[ci skip]`, `[no 
ci]`, `[skip actions]` or `[actions skip]`, matched case-insensitively.
   
   I see three options and would like your opinion:
   
   1. Keep it as is, so the label message stays consistent with the existing 
on-interval message.
   2. Rephrase the label message and the comment at L120 to describe what the 
script actually decides, e.g. that the PR is exempt from sampling and the 
trailer isn't added, instead of promising that CI will run.
   3. Check for GitHub's skip strings in `should_skip_post_merge_ci` and print 
a matching message, e.g. a warning that CI won't run, for both the label and 
the on-interval case. That means passing the commit message into it on both the 
merge and cherry-pick paths.
   
   Which would you prefer?
   



##########
dev/merge_spark_pr.py:
##########
@@ -538,6 +540,10 @@ def red(text):
     return "\033[91m%s\033[0m" % text
 
 
+def yellow(text):
+    return "\033[93m%s\033[0m" % text

Review Comment:
   Done in eaed909, it now uses `\033[33m`.
   



##########
dev/merge_spark_pr.py:
##########
@@ -1034,7 +1068,7 @@ def merge_pr(pr_num, target_ref, title, body, 
pr_repo_desc, pr_author, co_author
     return merge_hash
 
 
-def _do_cherry_pick(pr_num, merge_hash, pick_ref):
+def _do_cherry_pick(pr_num, merge_hash, pick_ref, force_post_merge_ci=False):

Review Comment:
   Done in eaed909. `force_post_merge_ci` no longer has a default on any layer, 
so a call that leaves it out raises `TypeError`. On `cherry_pick` it is 
keyword-only, since `already_picked` before it has a default.
   



##########
dev/merge_spark_pr.py:
##########
@@ -117,6 +117,8 @@
 # See 
https://docs.github.com/en/actions/how-tos/manage-workflow-runs/skip-workflow-runs
 POST_MERGE_CI_INTERVALS = {"master": 10, "branch-4.x": 10}
 POST_MERGE_CI_SKIP_TRAILER = "skip-checks: true"
+# A PR carrying this GitHub label always runs post-merge CI, regardless of the 
interval.

Review Comment:
   Done in eaed909.
   



##########
dev/merge_spark_pr.py:
##########
@@ -546,6 +552,10 @@ def print_error(msg):
     print(red(msg))
 
 
+def print_warning(msg):
+    print(yellow(msg))

Review Comment:
   I'd like to keep those red. They point at something the committer may need 
to fix: a fix version that couldn't be found, or a JIRA that is already closed 
or may be the wrong ticket. The skip warning is expected and needs no action, 
so the different color keeps that distinction visible.
   



##########
dev/merge_spark_pr.py:
##########
@@ -3203,6 +3245,9 @@ def main():
 
     url = pr["url"]
     title = pr["title"]
+    force_post_merge_ci = POST_MERGE_CI_FORCE_LABEL in [

Review Comment:
   Done in eaed909, and the `main_titles` fixture now has `"labels": []`.
   



##########
dev/merge_spark_pr.py:
##########
@@ -1034,7 +1068,7 @@ def merge_pr(pr_num, target_ref, title, body, 
pr_repo_desc, pr_author, co_author
     return merge_hash

Review Comment:
   Agreed, I'll fix this in a follow-up PR.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to