summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/utils
diff options
context:
space:
mode:
authorAlexis Lothoré <alexis.lothore@bootlin.com>2023-08-11 14:55:32 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-08-15 08:15:25 +0100
commit788f6a0e16f0869c9da47b193a667d904afa3fc2 (patch)
treee8b3f24f039203c54c28737abeb833d437217ddf /meta/lib/oeqa/utils
parentd151ba95f69d7224241fb8c76c90bbe4b2fd9563 (diff)
downloadpoky-788f6a0e16f0869c9da47b193a667d904afa3fc2.tar.gz
oeqa/utils/gitarchive: fix tag computation when creating archive
Sporadic errors have been observed in autobuilder when trying to store new tests results: error: failed to push some refs to 'push.yoctoproject.org:yocto-testresults' hint: Updates were rejected because the tag already exists in the remote. The new tag name is generated by gitarchive based on known tags from the repository (learnt with git tag). In autobuilder case, this repository is a shallow clone, so git tag only returns most recent tags, which mean we could miss some older tags which exist in remote but not locally. In this case, gitarchive will likely create a tag which already exists in remote, and so will fail to push Fix this tag duplication by using git ls-remote to learn about existing tags instead of git tag. Two places which wrongly read only local tags has been identified in gitarchive: expand_tag_strings and get_test_runs Fixes [YOCTO #15140] (From OE-Core rev: 5a0a7da85a3acfd4a20a07478eabefdab60f313a) Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oeqa/utils')
-rw-r--r--meta/lib/oeqa/utils/gitarchive.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/meta/lib/oeqa/utils/gitarchive.py b/meta/lib/oeqa/utils/gitarchive.py
index 6e8040eb5c..73beafecb5 100644
--- a/meta/lib/oeqa/utils/gitarchive.py
+++ b/meta/lib/oeqa/utils/gitarchive.py
@@ -116,7 +116,8 @@ def expand_tag_strings(repo, name_pattern, msg_subj_pattern, msg_body_pattern,
116 tag_re = tag_re.format(tag_number='(?P<tag_number>[0-9]{1,5})') 116 tag_re = tag_re.format(tag_number='(?P<tag_number>[0-9]{1,5})')
117 117
118 keyws['tag_number'] = 0 118 keyws['tag_number'] = 0
119 for existing_tag in repo.run_cmd('tag').splitlines(): 119 tags_refs = repo.run_cmd(['ls-remote', '--refs', '--tags', '-q'])
120 for existing_tag in ["".join(d.split()[1].split('/', 2)[2:]) for d in tags_refs.splitlines()]:
120 match = re.match(tag_re, existing_tag) 121 match = re.match(tag_re, existing_tag)
121 122
122 if match and int(match.group('tag_number')) >= keyws['tag_number']: 123 if match and int(match.group('tag_number')) >= keyws['tag_number']:
@@ -181,7 +182,8 @@ def get_test_runs(log, repo, tag_name, **kwargs):
181 182
182 # Get a list of all matching tags 183 # Get a list of all matching tags
183 tag_pattern = tag_name.format(**str_fields) 184 tag_pattern = tag_name.format(**str_fields)
184 tags = repo.run_cmd(['tag', '-l', tag_pattern]).splitlines() 185 revs = repo.run_cmd(['ls-remote', '--refs', '--tags', 'origin', '-q', tag_pattern]).splitlines()
186 tags = ["".join(d.split()[1].split('/', 2)[2:]) for d in revs]
185 log.debug("Found %d tags matching pattern '%s'", len(tags), tag_pattern) 187 log.debug("Found %d tags matching pattern '%s'", len(tags), tag_pattern)
186 188
187 # Parse undefined fields from tag names 189 # Parse undefined fields from tag names