-
Notifications
You must be signed in to change notification settings - Fork 15k
[CI] Make CI Jobs Upload Failures to Premerge Advisor #163276
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
[CI] Make CI Jobs Upload Failures to Premerge Advisor #163276
Conversation
Created using spr 1.3.7 [skip ci]
Created using spr 1.3.7
|
@llvm/pr-subscribers-tablegen @llvm/pr-subscribers-infrastructure Author: Aiden Grossman (boomanaiden154) ChangesThis allows the premerge advisor infrastructure to start ingesting data Full diff: https://github.com/llvm/llvm-project/pull/163276.diff 2 Files Affected:
diff --git a/.ci/premerge_advisor_upload.py b/.ci/premerge_advisor_upload.py
new file mode 100644
index 0000000000000..27e45bdd7f589
--- /dev/null
+++ b/.ci/premerge_advisor_upload.py
@@ -0,0 +1,48 @@
+# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+# See https://llvm.org/LICENSE.txt for license information.
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+"""Script for uploading results to the premerge advisor."""
+
+import argparse
+import os
+
+import requests
+
+import generate_test_report_lib
+
+PREMERGE_ADVISOR_URL = "http://premerge-advisor:5000/upload"
+
+
+def main(commit_sha, workflow_run_number, build_log_files):
+ junit_objects, ninja_logs = generate_test_report_lib.load_info_from_files(
+ build_log_files
+ )
+ test_failures = generate_test_report_lib.get_failures(junit_objects)
+ source = "pull_request" if "GITHUB_ACTIONS" in os.environ else "postcommit"
+ failure_info = {
+ "source_type": source,
+ "base_commit_sha": commit_sha,
+ "source_id": workflow_run_number,
+ "failures": [],
+ }
+ if test_failures:
+ for name, failure_message in test_failures:
+ failure_info["failures"].append({"name": name, "message": failure_message})
+ else:
+ ninja_failures = generate_test_report_lib.find_failure_in_ninja_logs(ninja_logs)
+ for name, failure_message in ninja_failures:
+ failure_info["failures"].append({"name": name, "message": failure_message})
+ requests.post(PREMERGE_ADVISOR_URL, json=failure_info)
+
+
+if __name__ == "__main__":
+ parser = argparse.ArgumentParser()
+ parser.add_argument("commit_sha", help="The base commit SHA for the test.")
+ parser.add_argument("workflow_run_number", help="The run number from GHA.")
+ parser.add_argument(
+ "build_log_files", help="Paths to JUnit report files and ninja logs.", nargs="*"
+ )
+ args = parser.parse_args()
+
+ main(args.commit_sha, args.workflow_run_number, args.build_log_files)
+ main()
diff --git a/.ci/utils.sh b/.ci/utils.sh
index 5d32968babb39..9aefcf212e457 100644
--- a/.ci/utils.sh
+++ b/.ci/utils.sh
@@ -38,6 +38,12 @@ function at-exit {
$retcode "${BUILD_DIR}"/test-results.*.xml "${MONOREPO_ROOT}"/ninja*.log \
>> $GITHUB_STEP_SUMMARY
fi
+
+ if [[ "$retcode" != "0" ]]; then
+ python "${MONOREPO_ROOT}"/.ci/premerge_advisor_upload.py \
+ $(git rev-parse HEAD~1) $GITHUB_RUN_NUMBER \
+ "${BUILD_DIR}"/test-results.*.xml "${MONOREPO_ROOT}"/ninja*.log
+ fi
}
trap at-exit EXIT
|
Created using spr 1.3.7 [skip ci]
This allows the premerge advisor infrastructure to start ingesting data so we can get to work on making failure explanations work. Pull Request: llvm#163276
This allows the premerge advisor infrastructure to start ingesting data so we can get to work on making failure explanations work. Pull Request: llvm#163276
Created using spr 1.3.7 [skip ci]
|
✅ With the latest revision this PR passed the Python code formatter. |
Created using spr 1.3.7
|
Hi @boomanaiden154 , I had pre-commit CI fail in #163941 just now, and looking at the logs, it appears to be a Python issue related to this newly added script: Do you know anything about this? (Or have I totally misunderstood, and am asking in the wrong place?) |
|
Ah, I see that 38ce641 got there at about the same time and has fixed it. Sorry for the noise. (Also, this wouldn't have gone wrong in my CI run without an actual test failure to mis-unpack, so I should go and look at that 🙂) |
This allows the premerge advisor infrastructure to start ingesting data
so we can get to work on making failure explanations work.