Skip to contentSkip to conversation

Fix regression reporting for master-next

PATCH New Alexis Lothoré 1 participant 3 messages Oct 10, 2023

lore
Share & tools
lore
#0 lore raw

cover Fix regression reporting for master-next

There are still issues in Autobuilder when trying to generate regression reports on master-next branch, as visible in [1]. This issue makes build status as failed

After being finally able to replicate the issue locally (which is quite difficult since master-next is a force-pushed branch), I observed that the issue lies within tag searching/management in tests results repository: we execute a "two-step" search, first with git ls-remote + glob patterns, and then filtered with a regex. The second step may fail because some additional tags retrieved from first step do not match exactly what is expected by the regex. For example, tag abelloni/master-next/69846-g01903ca0b1f7e120abd5135fb8554216ae7059c6/0 will be returned when searching for master-next tags

The two small patches in this series aim to:
1. restrict list of returned tags
2. make sure that once regex is used, the tag has matched before trying to parse its fields

With those two patches, I have been able to properly generate the regression report from [1] with the following command:

[1] https://autobuilder.yoctoproject.org/typhoon/#/builders/83/builds/6025/steps/29/logs/stdio

Alexis Lothoré (2):
oeqa/utils/gitarchive: fix tag pattern searching oeqa/utils/gitarchive: ensure tag matches regex before getting its
fields

 meta/lib/oeqa/utils/gitarchive.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Signature · 1 line
2.42.0
#1 lore raw

PATCH 1/2 oeqa/utils/gitarchive: fix tag pattern searching

From: Alexis Lothoré <[email protected]>

Whenever we ask gitarchive to search for tags, we can provide it with a pattern (containing glob patterns). However, when searching for example for tags matching branch master-next, it can find more tags which does not correspond exactly to branch master-next (e.g. abelloni/master-next tags will match).

Prevent those additional tags from being fetched by gitarchive by using a more specific pattern: prefix user-provided pattern with "refs/tags"

---
 meta/lib/oeqa/utils/gitarchive.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/lib/oeqa/utils/gitarchive.py +1 -1
index f9c152681db7..2fe48cdcac7f 100644
@@ -113,7 +113,7 @@ def get_tags(repo, log, pattern=None, url=None):
     # First try to fetch tags from repository configured remote
     cmd.append('origin')
     if pattern:
-        cmd.append(pattern)
+        cmd.append("refs/tags/"+pattern)
     try:
         tags_refs = repo.run_cmd(cmd)
         tags = ["".join(d.split()[1].split('/', 2)[2:]) for d in tags_refs.splitlines()]
Signature · 1 line
2.42.0
#2 lore raw

PATCH 2/2 oeqa/utils/gitarchive: ensure tag matches regex before getting its fields

In reply to Alexis Lothoré

From: Alexis Lothoré <[email protected]>

Whenever we ask gitarchive to retrieve test results for specific revisions, we first do a "large" search in get_tags, which uses glob patterns with git ls-remote, and then we filter received tags with a regex to parse the tags fields.
Currently gitarchive assumes that all tags returned by get_tags will match the regex. This assumption is wrong (for example searching "master-next" in get_tags may return some tags like "abelloni/master-next), and leads then
to exception when we try to retrieve tags fields:
Traceback (most recent call last):
File "/home/pokybuild/yocto-worker/a-full/build/scripts/resulttool", line 78, in <module>

    sys.exit(main())
             ^^^^^^

File "/home/pokybuild/yocto-worker/a-full/build/scripts/resulttool", line 72, in main
ret = args.func(args, logger)
^^^^^^^^^^^^^^^^^^^^^^^
File "/home/pokybuild/yocto-worker/a-full/build/scripts/lib/resulttool/regression.py", line 315, in regression_git
revs2 = gitarchive.get_test_revs(logger, repo, tag_name, branch=args.branch2)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/pokybuild/yocto-worker/a-full/build/meta/lib/oeqa/utils/gitarchive.py", line 246, in get_test_revs
fields, runs = get_test_runs(log, repo, tag_name, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/pokybuild/yocto-worker/a-full/build/meta/lib/oeqa/utils/gitarchive.py", line 238, in get_test_runs
groups = m.groupdict()

Fix this exception by merely skipping those additionals tags which won't match the regex

---
 meta/lib/oeqa/utils/gitarchive.py | 2 ++
 1 file changed, 2 insertions(+)
meta/lib/oeqa/utils/gitarchive.py +2 -0
index 2fe48cdcac7f..10cb267dfa92 100644
@@ -235,6 +235,8 @@ def get_test_runs(log, repo, tag_name, **kwargs):
     revs = []
     for tag in tags:
         m = tag_re.match(tag)
+        if not m:
+            continue
         groups = m.groupdict()
         revs.append([groups[f] for f in undef_fields] + [tag])
 
Signature · 1 line
2.42.0