summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/utils/gitarchive.py
Commit message (Collapse)AuthorAgeFilesLines
* oeqa/utils/gitarchive: ensure tag matches regex before getting its fieldsAlexis Lothoré2023-10-111-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 (From OE-Core rev: 8b5ace47372e958db9e4abb23378947fb02f6fc2) Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* oeqa/utils/gitarchive: fix tag pattern searchingAlexis Lothoré2023-10-111-1/+1
| | | | | | | | | | | | | | | | 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" (From OE-Core rev: c24b7ea28021da48aa8f3498a9b899f595efde56) Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* oeqa/utils/gitarchive: Handle broken commit counts in results repoRichard Purdie2023-09-281-1/+9
| | | | | | | | | | | | | | | | | | | | | The test results repository contains tags like: master/64501-g65c94ca3196e5ef3344a469fea8e30444f2e967a/0 master/1-g65c94ca3196e5ef3344a469fea8e30444f2e967a/3 master/1-g65c94ca3196e5ef3344a469fea8e30444f2e967a/2 master/1-g65c94ca3196e5ef3344a469fea8e30444f2e967a/1 master/1-g65c94ca3196e5ef3344a469fea8e30444f2e967a/0 where the commit count is correct in one case and not in the others. This causes assertion errors in the current code. Add in some code to work around these historical issues where the commit counts are low. (From OE-Core rev: d51fc5c8c469730885af7bbde7122032de411d89) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* oeqa/utils/gitarchive: replace warning with info when reading local tagsAlexis Lothoré2023-08-241-1/+1
| | | | | | | | | | | | Whenever a script needs to list tags, if it falls back to the third method (reading local tags only), it emits a warning. While this warning is useful for future diagnostic if some tagging issues re-appear, it makes buildperf autobuilds status as "Passed with warnings", which is not desirable (From OE-Core rev: b2c1d8a83a3b2134a8f9a445cbf00103e63ed0b3) Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* oeqa/utils/gitarchive: fall back to local tags when listing existing tagsAlexis Lothoré2023-08-231-9/+16
| | | | | | | | | | | | | | | | | | | e9cff55e73cc has switched tag listing from bare "git tag" to "git ls-remote" to make sure not to miss remote tags which are not fetched locally. This mechanism first checks for configured remote repository, next for possibly passed url, and then fails if none worked. However there are still cases where no remote repository is configured and no url is provided (for instance: buildperf tests use an empty git directory to store tests). Fix those cases by putting back the old behavior (local tags check) as last resort, with at least a warning for future diagnostics if we still encounter tagging issues Fixes: e9cff55e73cc ("oeqa/utils/gitarchive: fix tag computation when creating archive") (From OE-Core rev: 34e1f845687d2f7169f5d6c1bb54e1a7ab5412c4) Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* oeqa/utils/gitarchive: allow to pass a logger to get_tagsAlexis Lothoré2023-08-231-5/+6
| | | | | | | | | | Propagate a "log" parameter to get_tags in order to know what method is used to retrieve existing tags (From OE-Core rev: f8212eda45444dfb330e4d930eeceefde936adeb) Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* oeqa/utils/gitarchive: fix tag computation when creating archiveAlexis Lothoré2023-08-211-4/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. To do so, create a helper ("get_tags") which manages both nominal case (target directory is a git repository with a proper remote) and fallback case (target directory is not from a clone, no remote has been configured) Fixes [YOCTO #15140] (From OE-Core rev: 9cbbe9689866158825a7ae774b7965b41ff5c461) Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* Revert "oeqa/utils/gitarchive: fix tag computation when creating archive"Richard Purdie2023-08-161-4/+2
| | | | | | | | This reverts commit 5a0a7da85a3acfd4a20a07478eabefdab60f313a. This caused failres on the build performance tests on the autobuilder. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* oeqa/utils/gitarchive: fix tag computation when creating archiveAlexis Lothoré2023-08-151-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* meta/lib+scripts: Convert to SPDX license headersRichard Purdie2019-05-091-8/+1
| | | | | | | | | | | | | | | | | | | | | | | This adds SPDX license headers in place of the wide assortment of things currently in our script headers. We default to GPL-2.0-only except for the oeqa code where it was clearly submitted and marked as MIT on the most part or some scripts which had the "or later" GPL versioning. The patch also drops other obsolete bits of file headers where they were encoountered such as editor modelines, obsolete maintainer information or the phrase "All rights reserved" which is now obsolete and not required in copyright headers (in this case its actually confusing for licensing as all rights were not reserved). More work is needed for OE-Core but this takes care of the bulk of the scripts and meta/lib directories. The top level LICENSE files are tweaked to match the new structure and the SPDX naming. (From OE-Core rev: f8c9c511b5f1b7dbd45b77f345cb6c048ae6763e) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* oeqa/utils/gitarchive: Handle case where parent is only on originRichard Purdie2019-02-251-2/+2
| | | | | | | | | | | | | | | The parent code currently assumed that any parent branch is locally checked out which may not be the case. Use the local branch by default but fall back to the origin. This also means removing the later saftey check as the branch may not exist locally. This fixes the autobuilder resulttool test pushing code. (From OE-Core rev: 0ee636bc89d93282cb3d3cd747b3dd046f6e5a9c) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* oe-build-perf-report/gitarchive: Move common useful functions to libraryRichard Purdie2019-02-211-0/+71
| | | | | | | | | These functions can be reused by the resulttool code so move to the common function library for this purpose. (From OE-Core rev: c66f848938c04e133259c5b6903dc592866ab385) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
* scripts/oe-git-archive: Separate out functionality to library functionRichard Purdie2019-02-181-0/+173
This turns the core of the script into a library function. Ultimately this will let us call that code with custom 'keywords' rather than relying on the data parsed from bitbake metadata which can't be used when archiving historical results. (From OE-Core rev: 4820ca2b0850e29b04a4fd5659a6e9837d6714d0) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>