Respect EOM tag for branches in unmaintained status

With the new unmaintained process [1], branches are being tagged with
EOM before being removed.

This behaviour breaks reno, making it struggle to find respective origin
and leads to releasenotes job failure.

In order to overcome the issue we add eom tag to the list of expected ones
when we can not find the refferenced branch.

With that, EOL tag will have prescedence over EOM one.

[1] https://governance.openstack.org/tc/resolutions/20230724-unmaintained-branches.html

Change-Id: Ic641af5aa65add9751b49fb47691a98f80a7c5a8
This commit is contained in:
Dmitriy Rabotyagov 2024-02-28 20:54:10 +01:00 committed by Dmitriy Rabotyagov
parent 270c97d738
commit 47651ec906
3 changed files with 11 additions and 1 deletions

View File

@ -167,7 +167,7 @@ _OPTIONS = [
"base" of a branch. Other branches are ignored.
""")),
Opt('closed_branch_tag_re', '(.+)-eol',
Opt('closed_branch_tag_re', '(.+)-eo[lm]',
textwrap.dedent("""\
The pattern for names for tags that replace closed
branches that are relevant when scanning history to

View File

@ -555,6 +555,9 @@ class Scanner(object):
'refs/tags/' + name,
# If a stable branch was removed, look for its EOL tag.
'refs/tags/' + (name.rpartition('/')[-1] + '-eol'),
# If a stable branch was moved to unmaintained, look
# for its EOM tag. EOL will have precedence if exists.
'refs/tags/' + (name.rpartition('/')[-1] + '-eom'),
# If someone is using the "short" name for a branch
# without a local tracking branch, look to see if the
# name exists on the 'origin' remote.

View File

@ -1874,6 +1874,8 @@ class GetRefTest(Base):
self.repo.git('tag', '-s', '-m', 'first tag', '1.0.0')
self.repo.git('branch', 'stable/foo')
self.repo.git('tag', 'bar-eol')
self.repo.git('tag', 'bar-eom')
self.repo.git('tag', 'baz-eom')
self.scanner = scanner.Scanner(self.c)
def tearDown(self):
@ -1895,6 +1897,11 @@ class GetRefTest(Base):
expected = self.scanner._repo.head()
self.assertEqual(expected, ref)
def test_eom_tag_from_branch(self):
ref = self.scanner._get_ref('stable/baz')
expected = self.scanner._repo.head()
self.assertEqual(expected, ref)
def test_head(self):
ref = self.scanner._get_ref(None)
expected = self.scanner._repo.head()