Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 65CD8C001B0 for ; Wed, 16 Aug 2023 06:36:07 +0000 (UTC) Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) by mx.groups.io with SMTP id smtpd.web10.155436.1692167761108464292 for ; Tue, 15 Aug 2023 23:36:02 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=T8qUzILP; spf=pass (domain: bootlin.com, ip: 217.70.183.199, mailfrom: alexis.lothore@bootlin.com) Received: by mail.gandi.net (Postfix) with ESMTPSA id C906CFF804; Wed, 16 Aug 2023 06:35:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1692167759; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9VPZuHZBBY5DF/NfH7pleEik+p706fFfMeSjxsm4uPg=; b=T8qUzILP5AT5bLyd1em+tnPPwU5nOxqGTpyOKYEpdpmJNl+81fURvqGy4fmR/yw6TpMODD 33UWI5jwUssdGA6xOtQgtdV1aFswG1EmopFpvarzAbVIMiCnh3OYAIAC+QsRUAVbw3eBcp tTAzRIDJlgUJxXwOSZLd1KTZ9vSWQNgFJfUM3k77eccGIW+Fu9ZXEXB4TxhgoGAO5EMSDJ YjBEBcYM/+nO/zRuMh2SHSUFSk9dwfjSLSQ2aN2EvMOt+EhMG7iDL9rsBn0eGTEVpDWXDJ ca8FgaPY6cyBGYbVLS+fHZxWsXOKt8lBjZLs4GZ5mfugItILh2VaAK/FFIj/0g== Message-ID: Date: Wed, 16 Aug 2023 08:36:40 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [OE-Core][PATCH 2/2] oeqa/utils/gitarchive: fix tag computation when creating archive To: Richard Purdie , Openembedded-core@lists.openembedded.org Cc: Thomas Petazzoni , Alexandre Belloni References: <20230811125532.9427-1-alexis.lothore@bootlin.com> <20230811125532.9427-3-alexis.lothore@bootlin.com> <16b82ce9979d4a09ad3dc42ebef2cbb85c1729c3.camel@linuxfoundation.org> Content-Language: en-US From: =?UTF-8?Q?Alexis_Lothor=C3=A9?= In-Reply-To: <16b82ce9979d4a09ad3dc42ebef2cbb85c1729c3.camel@linuxfoundation.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-GND-Sasl: alexis.lothore@bootlin.com List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Wed, 16 Aug 2023 06:36:07 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/186114 Hello Richard, On 8/15/23 23:13, Richard Purdie wrote: > On Fri, 2023-08-11 at 14:55 +0200, Alexis Lothoré via > lists.openembedded.org wrote: >> From: Alexis Lothoré >> >> 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] >> >> Signed-off-by: Alexis Lothoré >> --- >> meta/lib/oeqa/utils/gitarchive.py | 6 ++++-- >> 1 file changed, 4 insertions(+), 2 deletions(-) >> >> diff --git a/meta/lib/oeqa/utils/gitarchive.py b/meta/lib/oeqa/utils/gitarchive.py >> index 6e8040eb5c96..73beafecb5fb 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, >> tag_re = tag_re.format(tag_number='(?P[0-9]{1,5})') >> >> keyws['tag_number'] = 0 >> - for existing_tag in repo.run_cmd('tag').splitlines(): >> + tags_refs = repo.run_cmd(['ls-remote', '--refs', '--tags', '-q']) >> + for existing_tag in ["".join(d.split()[1].split('/', 2)[2:]) for d in tags_refs.splitlines()]: >> match = re.match(tag_re, existing_tag) >> >> if match and int(match.group('tag_number')) >= keyws['tag_number']: >> @@ -181,7 +182,8 @@ def get_test_runs(log, repo, tag_name, **kwargs): >> >> # Get a list of all matching tags >> tag_pattern = tag_name.format(**str_fields) >> - tags = repo.run_cmd(['tag', '-l', tag_pattern]).splitlines() >> + revs = repo.run_cmd(['ls-remote', '--refs', '--tags', 'origin', '-q', tag_pattern]).splitlines() >> + tags = ["".join(d.split()[1].split('/', 2)[2:]) for d in revs] >> log.debug("Found %d tags matching pattern '%s'", len(tags), tag_pattern) >> >> # Parse undefined fields from tag names > > > I'm worrying a little that this change which recently merged might have > resulted in: > > https://autobuilder.yoctoproject.org/typhoon/#/builders/133/builds/2099 I may have taken the wrong assumption that directories manipulated with gitarchive would always have at least one valid remote configured, but this log tends to prove me wrong :/ Since the patch aimed to fix a sporadic issue but now leads to another systematic issue, please feel free to revert it while I ensure about the scenario and find a proper fix Kind regards, Alexis > > ? > > I didn't take the test yet since that is causing other issues on the > autobuilder unrelated to the patch which I'm resolving first. > > Cheers, > > Richard > -- Alexis Lothoré, Bootlin Embedded Linux and Kernel engineering https://bootlin.com