-
Notifications
You must be signed in to change notification settings - Fork 264
New bot command: please build #2525
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
4f1278a
6e95e6e
a72781b
e58983d
80cdbd7
d587e40
e5ef4f7
cc662b5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -124,7 +124,7 @@ def format(s, **kwds): | |
| cmsorgs="|".join(EXTERNAL_REPOS), | ||
| ) | ||
| TEST_REGEXP = format( | ||
| r"^\s*((@|)cmsbuild\s*[,]*\s+|)(please\s*[,]*\s+|)test(\s+workflow(s|)\s+(%(workflow)s(\s*,\s*%(workflow)s|)*)|)(\s+with\s+(%(cms_pr)s(\s*,\s*%(cms_pr)s)*)|)(\s+for\s+%(release_queue)s|)(\s+using\s+full\s+cmssw|\s+using\s+(cms-|)addpkg\s+(%(pkg)s(,%(pkg)s)*)|)\s*$", | ||
| r"^\s*((@|)cmsbuild\s*[,]*\s+|)(please\s*[,]*\s+|)(test|build)(\s+workflow(s|)\s+(%(workflow)s(\s*,\s*%(workflow)s|)*)|)(\s+with\s+(%(cms_pr)s(\s*,\s*%(cms_pr)s)*)|)(\s+for\s+%(release_queue)s|)(\s+using\s+full\s+cmssw|\s+using\s+(cms-|)addpkg\s+(%(pkg)s(,%(pkg)s)*)|)\s*$", | ||
| workflow=WF_PATTERN, | ||
| cms_pr=CMS_PR_PATTERN, | ||
| pkg=CMSSW_PACKAGE_PATTERN, | ||
|
|
@@ -358,6 +358,8 @@ def extract_bot_cache(comment_msgs): | |
|
|
||
| data = "" | ||
| for comment_msg in comment_msgs: | ||
| if not comment_msg.body: | ||
| continue | ||
| seen_commits_match = REGEX_COMMITS_CACHE.search(comment_msg.body) | ||
| if seen_commits_match: | ||
| data += seen_commits_match[1] | ||
|
|
@@ -565,9 +567,9 @@ def has_user_emoji(bot_cache, comment, repository, emoji, user): | |
| # github_utils.get_comment_emojis -> https://github.com/PyGithub/PyGithub/blob/v1.56/github/IssueComment.py#L135 | ||
| emojis = comment.get_reactions() | ||
| for x in emojis: | ||
| if x["user"]["login"].encode("ascii", "ignore").decode() == user: | ||
| e = x["content"] | ||
| bot_cache["emoji"][comment_id] = x | ||
| if x.user.login.encode("ascii", "ignore").decode() == user: | ||
| e = x.content | ||
| bot_cache["emoji"][comment_id] = e | ||
| break | ||
| return e and e == emoji | ||
|
|
||
|
|
@@ -745,19 +747,20 @@ def check_test_cmd(first_line, repo, params): | |
| prs = [] | ||
| cmssw_que = "" | ||
| logger.debug("check_test_cmd: %s", m.groups()) | ||
| if m.group(6): | ||
| wfs = ",".join(set(m.group(6).replace(" ", "").split(","))) | ||
| if m.group(11): | ||
| prs = get_prs_list_from_string(m.group(11), repo) | ||
| if m.group(20): | ||
| cmssw_que = m.group(20) | ||
| if m.group(25): | ||
| if "addpkg" in m.group(25): | ||
| params["EXTRA_CMSSW_PACKAGES"] = m.group(27).strip() | ||
| build_only = m.group(4) == "build" | ||
| if m.group(7): | ||
| wfs = ",".join(set(m.group(7).replace(" ", "").split(","))) | ||
| if m.group(12): | ||
| prs = get_prs_list_from_string(m.group(12), repo) | ||
| if m.group(21): | ||
| cmssw_que = m.group(21) | ||
| if m.group(26): | ||
| if "addpkg" in m.group(26): | ||
| params["EXTRA_CMSSW_PACKAGES"] = m.group(28).strip() | ||
| else: | ||
| params["BUILD_FULL_CMSSW"] = "true" | ||
| return (True, " ".join(prs), wfs, cmssw_que) | ||
| return (False, "", "", "") | ||
| return (True, " ".join(prs), wfs, cmssw_que, build_only) | ||
| return (False, "", "", "", "") | ||
iarspider marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
|
|
||
| def get_prs_list_from_string(pr_string="", repo_string=""): | ||
|
|
@@ -1078,6 +1081,7 @@ def process_pr( | |
| ok_too_many_files = False | ||
| warned_too_many_files = False | ||
| is_draft_pr = False | ||
| build_only = False | ||
|
|
||
| if issue.pull_request: | ||
| pr = repo.get_pull(prId) | ||
|
|
@@ -1665,9 +1669,8 @@ def process_pr( | |
|
|
||
| # Check if the someone asked to trigger the tests | ||
| if valid_commenter: | ||
| ok, v2, v3, v4 = check_test_cmd(first_line, repository, global_test_params) | ||
| ok, v2, v3, v4, v5 = check_test_cmd(first_line, repository, global_test_params) | ||
| if ok: | ||
| test_comment = comment | ||
| abort_test = None | ||
| cmssw_prs = v2 | ||
| extra_wfs = ",".join(sorted(v3.split(","))) | ||
|
|
@@ -1678,16 +1681,24 @@ def process_pr( | |
| elif re.match("^" + ARCH_PATTERN + "$", release_queue): | ||
| release_arch = release_queue | ||
| release_queue = "" | ||
|
|
||
| if v5 and has_user_emoji(bot_cache, comment, repository, "+1", cmsbuild_user): | ||
| continue | ||
|
|
||
| build_only = v5 | ||
| test_comment = comment | ||
| signatures["tests"] = "pending" | ||
|
|
||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @iarspider , I do not think this is what we discussed :-)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Really? Then I misunderstood your suggestion. |
||
| logger.info( | ||
| "Tests requested: %s asked to test this PR with cmssw_prs=%s, release_queue=%s, arch=%s and workflows=%s", | ||
| "Tests requested: %s asked to test this PR with cmssw_prs=%s, release_queue=%s, arch=%s and workflows=%s; build_only=%s", | ||
| commenter, | ||
| cmssw_prs, | ||
| release_queue, | ||
| release_arch, | ||
| extra_wfs, | ||
| build_only, | ||
| ) | ||
| logger.debug("Comment message: %s", first_line) | ||
| signatures["tests"] = "pending" | ||
| continue | ||
| elif REGEX_TEST_ABORT.match(first_line) and (signatures["tests"] == "pending"): | ||
| abort_test = comment | ||
|
|
@@ -2096,15 +2107,20 @@ def process_pr( | |
| if bot_status or (signatures["tests"] == "pending"): | ||
| new_bot_tests = True | ||
| trigger_test = True | ||
| signatures["tests"] = "started" | ||
| if not build_only: | ||
| signatures["tests"] = "started" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @iarspider , may be this change is not needed? we override the test labels for
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. |
||
| desc = "requested by %s at %s UTC." % ( | ||
| ensure_ascii(test_comment.user.login), | ||
| test_comment.created_at, | ||
| ) | ||
| if not new_bot_tests: | ||
| desc = "Old style tests %s" % desc | ||
| else: | ||
| desc = "Tests %s" % desc | ||
| if not build_only: | ||
| desc = "Tests %s" % desc | ||
| else: | ||
| desc = "Build %s" % desc | ||
|
|
||
| logger.debug('Create status "%s"', desc) | ||
| if not dryRun: | ||
| last_commit_obj.create_status( | ||
|
|
@@ -2124,6 +2140,7 @@ def process_pr( | |
| and bot_status.target_url == turl | ||
| and signatures["tests"] == "pending" | ||
| and (" requested by " in bot_status.description) | ||
| and not build_only | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @iarspider , may be this is also not needed?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. |
||
| ): | ||
| signatures["tests"] = "started" | ||
| if ( | ||
|
|
@@ -2355,7 +2372,7 @@ def process_pr( | |
| labels.append("requires-external") | ||
|
|
||
| # Keep old tests state for closed PRs (workaround for missing commit statuses in old PRs) | ||
| if not create_status: | ||
| if not create_status or build_only: | ||
| labels = [l for l in labels if not l.startswith("tests-")] | ||
| labels.extend(l for l in old_labels if l.startswith("tests-")) | ||
|
|
||
|
|
@@ -2470,6 +2487,7 @@ def process_pr( | |
| global_test_params["EXTRA_RELVALS_TESTS"] = " ".join( | ||
| [t.upper().replace("-", "_") for t in EXTRA_RELVALS_TESTS] | ||
| ) | ||
| global_test_params["BUILD_ONLY"] = build_only | ||
|
|
||
| logger.debug("All Parameters: %s", global_test_params) | ||
| # For now, only trigger tests for cms-sw/cmssw and cms-sw/cmsdist | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| [ | ||
| { | ||
| "type": "load-bot-cache", | ||
| "data": { | ||
| "commits": { | ||
| "06336c8884bcfbc516cc69fd99b0a161bb3a14d5": { | ||
| "files": [ | ||
| "RecoLocalCalo/EcalRecProducers/plugins/alpaka/EcalUncalibRecHitPhase2WeightsAlgoPortable.dev.cc" | ||
| ], | ||
| "squashed": false, | ||
| "time": 1747049040 | ||
| } | ||
| }, | ||
| "emoji": {}, | ||
| "last_seen_sha": "06336c8884bcfbc516cc69fd99b0a161bb3a14d5", | ||
| "signatures": {} | ||
| } | ||
| }, | ||
| { | ||
| "type": "add-label", | ||
| "data": [] | ||
| }, | ||
| { | ||
| "type": "remove-label", | ||
| "data": [] | ||
| }, | ||
| { | ||
| "type": "edit-comment", | ||
| "data": "cms-bot internal usage<!-- bot cache: {\"commits\":{\"06336c8884bcfbc516cc69fd99b0a161bb3a14d5\":{\"files\":[\"RecoLocalCalo/EcalRecProducers/plugins/alpaka/EcalUncalibRecHitPhase2WeightsAlgoPortable.dev.cc\"],\"squashed\":false,\"time\":1747049040}},\"emoji\":{\"2872583904\":\"+1\"},\"last_seen_sha\":\"06336c8884bcfbc516cc69fd99b0a161bb3a14d5\",\"signatures\":{}} -->" | ||
| }, | ||
| { | ||
| "type": "save-bot-cache", | ||
| "data": { | ||
| "commits": { | ||
| "06336c8884bcfbc516cc69fd99b0a161bb3a14d5": { | ||
| "files": [ | ||
| "RecoLocalCalo/EcalRecProducers/plugins/alpaka/EcalUncalibRecHitPhase2WeightsAlgoPortable.dev.cc" | ||
| ], | ||
| "squashed": false, | ||
| "time": 1747049040 | ||
| } | ||
| }, | ||
| "emoji": { | ||
| "2872583904": "+1" | ||
| }, | ||
| "last_seen_sha": "06336c8884bcfbc516cc69fd99b0a161bb3a14d5", | ||
| "signatures": {} | ||
| } | ||
| } | ||
| ] |
Uh oh!
There was an error while loading. Please reload this page.