in sync/upstream.py [0:0]
def commit_check_changed(git_gecko, git_wpt, sync):
landed = False
if sync.status != "open":
return True
check_status, checks = get_check_status(sync.pr)
if not checks:
logger.error("No checks found for pr %s" % sync.pr)
return
# Record the overall status and commit so we only notify once per commit
this_pr_check = {"state": check_status.value,
"sha": next(iter(checks.values()))["head_sha"]}
last_pr_check = sync.last_pr_check
sync.last_pr_check = this_pr_check
if check_status == CheckStatus.SUCCESS:
sync.error = None
if sync.gecko_landed():
landed = sync.try_land_pr()
elif this_pr_check != last_pr_check:
env.bz.comment(sync.bug,
"Upstream web-platform-tests status checks passed, "
"PR will merge once commit reaches central.")
elif check_status == CheckStatus.FAILURE and last_pr_check != this_pr_check:
details = ["Github PR %s" % env.gh_wpt.pr_url(sync.pr)]
for name, check_run in checks.items():
if check_run["conclusion"] not in ("success", "neutral"):
details.append("* {} ({})".format(name, check_run["url"]))
details = "\n".join(details)
msg = ("Can't merge web-platform-tests PR due to failing upstream checks:\n%s" %
details)
try:
with env.bz.bug_ctx(sync.bug) as bug:
bug["comment"] = msg
# Do this as a seperate operation
with env.bz.bug_ctx(sync.bug) as bug:
commit_author = sync.gecko_commits[0].email
if commit_author:
bug.needinfo(commit_author)
except BugsyException:
msg = traceback.format_exc()
logger.warning("Failed to update bug:\n%s" % msg)
# Sometimes needinfos fail because emails addresses in bugzilla don't
# match the commits. That's non-fatal, but record the exception here in
# case something more unexpected happens
newrelic.agent.record_exception()
sync.error = "Checks failed"
else:
logger.info("Some upstream web-platform-tests status checks still pending.")
return landed