Repository navigation
Retry the renames of the developer store on Windows and steady three intermittent tests (#542) #549
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
130e56a
Retry the renames of the developer store on Windows and steady three …
ambroise-leclerc ed819c9
Wait for the agent's own exit bound in the automation client and boun…
ambroise-leclerc 4f8fbed
Read every attempt in the flake report, log the requests of the devel…
ambroise-leclerc d85f76c
Try a GitHub read again when it answers a 502 in the flake report (#542)
ambroise-leclerc 2870313
Merge remote-tracking branch 'origin/develop' into 542-ci-flaky-tests
ambroise-leclerc c88d66d
Accept a pending removal while waiting for the endpoint to be withdra…
ambroise-leclerc 807cae8
Read workflow logs from the requested run attempt (#542)
ambroise-leclerc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| #!/usr/bin/env python3 | ||
| """Counts the CTest cases that failed in the recent runs of a workflow, per platform job. | ||
|
|
||
| Read-only: it lists runs and reads the logs of their failed jobs through the GitHub CLI (`gh`), which must be | ||
| authenticated. A case that fails on one platform of a run whose other platforms pass is the usual sign of an | ||
| intermittent failure; one that fails everywhere on a branch is more likely a regression of that branch. Every attempt | ||
| of a run is read: a job that failed and passed once run again is exactly an intermittent failure. | ||
|
|
||
| python3 test/tools/FlakeReport.py --limit 60 | ||
| """ | ||
| import argparse | ||
| import collections | ||
| import json | ||
| import re | ||
| import subprocess | ||
| import sys | ||
| import time | ||
|
|
||
| # "644/687 Test #615: DeveloperBrowserIntegration-jasmine .....***Failed 18.97 sec", after the log's own prefix. | ||
| # A repeated case (`--repeat until-fail:5`) has no "644/687" before its first attempts. | ||
| FAILED_CASE = re.compile(r"(?:\d+/\d+ )?Test +#\d+: (?P<name>.+?) \.*\*\*\*(?P<kind>Failed|Timeout|Exception[^ ]*|Not Run)") | ||
|
|
||
|
|
||
| def failed_cases(log): | ||
| """The (case, kind) pairs of a CTest log; cases that did not run because a dependency failed are left out.""" | ||
| found = [] | ||
| for line in log.splitlines(): | ||
| match = FAILED_CASE.search(line) | ||
| if match and match["kind"] != "Not Run": | ||
| found.append((match["name"].strip(), match["kind"])) | ||
| return found | ||
|
|
||
|
|
||
| def gh(*arguments): | ||
| # GitHub answers a read with a 502 now and then: three tries, ten seconds apart. | ||
| for attempt in range(3): | ||
| result = subprocess.run(["gh", *arguments], capture_output=True, text=True, encoding="utf-8", errors="replace") | ||
| if result.returncode == 0 or "HTTP 50" not in result.stderr: | ||
| break | ||
| if attempt < 2: | ||
| time.sleep(10) | ||
| if result.returncode != 0: | ||
| raise RuntimeError(f"gh {' '.join(arguments)}: {result.stderr.strip()}") | ||
| return result.stdout | ||
|
|
||
|
|
||
| def attempts_to_read(run): | ||
| """The attempts of a run that can hold a failed job: all the earlier ones, and the last one when it failed.""" | ||
| last = run.get("attempt") or 1 | ||
| return [attempt for attempt in range(1, last + 1) if attempt < last or run["conclusion"] == "failure"] | ||
|
|
||
|
|
||
| def failed_jobs(run, attempt): | ||
| path = f"repos/{{owner}}/{{repo}}/actions/runs/{run['databaseId']}/attempts/{attempt}/jobs?per_page=100" | ||
| return [job for job in json.loads(gh("api", path))["jobs"] if job["conclusion"] == "failure"] | ||
|
|
||
|
|
||
| def main(): | ||
| parser = argparse.ArgumentParser(description=__doc__.splitlines()[0]) | ||
| parser.add_argument("--workflow", default="BuildAndTest.yml") | ||
| parser.add_argument("--limit", type=int, default=60, help="how many of the latest runs to read") | ||
| parser.add_argument("--branch", help="only the runs of this branch") | ||
| arguments = parser.parse_args() | ||
|
|
||
| listing = ["run", "list", "--workflow", arguments.workflow, "--limit", str(arguments.limit), | ||
| "--json", "databaseId,conclusion,headBranch,event,attempt"] | ||
| if arguments.branch: | ||
| listing += ["--branch", arguments.branch] | ||
| runs = json.loads(gh(*listing)) | ||
| completed = [run for run in runs if run["conclusion"] in ("success", "failure")] | ||
|
coderabbitai[bot] marked this conversation as resolved.
Resolved
|
||
| cases = collections.defaultdict(list) | ||
| other = collections.Counter() | ||
| rerun = 0 | ||
| for run in completed: | ||
| last = run.get("attempt") or 1 | ||
| rerun += last > 1 and run["conclusion"] == "success" | ||
| for attempt in attempts_to_read(run): | ||
| where = f"{run['headBranch']}, run {run['databaseId']}" + (f", attempt {attempt} of {last}" if last > 1 else "") | ||
| for job in failed_jobs(run, attempt): | ||
| found = failed_cases(gh("run", "view", "--job", str(job["id"]), "--attempt", str(attempt), "--log")) | ||
| if not found: | ||
| steps = ", ".join(step["name"] for step in job.get("steps", []) if step["conclusion"] == "failure") | ||
| other[f"{job['name']}: {steps}"] += 1 | ||
| for name, kind in found: | ||
| cases[name].append(f"{job['name']} {kind} ({where})") | ||
|
|
||
| failures = sum(1 for run in completed if run["conclusion"] == "failure") | ||
| print(f"{len(completed)} completed runs of {arguments.workflow}, {failures} failed, {rerun} passed once run again") | ||
| for name, occurrences in sorted(cases.items(), key=lambda item: (-len(item[1]), item[0])): | ||
| print(f"\n{len(occurrences):3d} {name}") | ||
| for occurrence in occurrences: | ||
| print(f" {occurrence}") | ||
| if other: | ||
| print("\nFailed jobs without a failed CTest case:") | ||
| for description, count in other.most_common(): | ||
| print(f"{count:3d} {description}") | ||
| return 0 | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| sys.exit(main()) | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.