From 317e8b3d1d40277a723df60a65ccf86577328f38 Mon Sep 17 00:00:00 2001 From: Thomas Carmet <8408330+tcarmet@users.noreply.github.com> Date: Tue, 14 Nov 2023 19:49:49 +0000 Subject: [PATCH] BERTE-582 support of tags created with v prefix --- CHANGELOG | 4 ++++ bert_e/tests/test_bert_e.py | 20 ++++++++++++++++++++ bert_e/workflow/gitwaterflow/branches.py | 2 +- 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 7be00ca8..d053a89b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,10 @@ # Change Log All notable changes to this project will be documented in this file. +## [3.10.0] - 2023-11-14 +# Added +- Support of tags created with `v` prefix. + ## [3.9.0] - 2023-07-20 # Added - Introducing a new option that prevent the creation of diff --git a/bert_e/tests/test_bert_e.py b/bert_e/tests/test_bert_e.py index cac58da8..c01dd2b7 100644 --- a/bert_e/tests/test_bert_e.py +++ b/bert_e/tests/test_bert_e.py @@ -670,6 +670,26 @@ def test_tags_with_stabilization(self): with self.assertRaises(exns.DeprecatedStabilizationBranch): self.finalize_cascade(branches, tags, destination, fixver) + + def test_with_v_prefix(self): + destination = 'development/4.3' + branches = OrderedDict({ + 1: {'name': 'stabilization/4.3.18', 'ignore': True}, + 2: {'name': 'development/4.3', 'ignore': False}, + 3: {'name': 'stabilization/5.1.4', 'ignore': True}, + 4: {'name': 'development/5.1', 'ignore': False}, + 5: {'name': 'development/10.0', 'ignore': False} + }) + # mix and match tags with v prefix and without + tags = ['4.3.16', '4.3.17', '4.3.18_rc1', 'v5.1.3', 'v5.1.4_rc1', 'v10.0.1'] + fixver = ['4.3.19', '5.1.5', '10.0.2'] + self.finalize_cascade(branches, tags, destination, fixver) + # only tags with v prefix + v_tags = ['v4.3.16', 'v4.3.17', 'v4.3.18_rc1', 'v5.1.3', 'v5.1.4_rc1', 'v10.0.1'] + # expect the same result + self.finalize_cascade(branches, v_tags, destination, fixver) + + def test_retry_handler(self): class DummyError(Exception): pass diff --git a/bert_e/workflow/gitwaterflow/branches.py b/bert_e/workflow/gitwaterflow/branches.py index 6d6c3cac..c3587bb3 100644 --- a/bert_e/workflow/gitwaterflow/branches.py +++ b/bert_e/workflow/gitwaterflow/branches.py @@ -843,7 +843,7 @@ def add_branch(self, branch, dst_branch=None): def update_micro(self, tag): """Update development branch latest micro based on tag.""" - pattern = r"^(?P\d+)\.(?P\d+)\.(?P\d+)" \ + pattern = r"^v?(?P\d+)\.(?P\d+)\.(?P\d+)" \ r"(\.(?P\d+)|)$" match = re.match(pattern, tag) if not match: