From 47651ec90664943f7f346cfea8de2e43e9b3c779 Mon Sep 17 00:00:00 2001 From: Dmitriy Rabotyagov Date: Wed, 28 Feb 2024 20:54:10 +0100 Subject: [PATCH] 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 --- reno/config.py | 2 +- reno/scanner.py | 3 +++ reno/tests/test_scanner.py | 7 +++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/reno/config.py b/reno/config.py index 7174726..db8eca4 100644 --- a/reno/config.py +++ b/reno/config.py @@ -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 diff --git a/reno/scanner.py b/reno/scanner.py index 0891e7b..d8b0d6c 100644 --- a/reno/scanner.py +++ b/reno/scanner.py @@ -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. diff --git a/reno/tests/test_scanner.py b/reno/tests/test_scanner.py index ded425d..4cc5e83 100644 --- a/reno/tests/test_scanner.py +++ b/reno/tests/test_scanner.py @@ -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()