Skip to content

Commit

Permalink
Merge pull request #369 from iriusrisk/bugfix/OPT-1125
Browse files Browse the repository at this point in the history
[bugfix/OPT-1125] to release/1.24.0
  • Loading branch information
dfernandezvigo authored Apr 15, 2024
2 parents a4db1ca + ac8f3d6 commit 6270954
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 2 deletions.
2 changes: 1 addition & 1 deletion startleft/startleft/_version/local_scheme.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def choose_strategy_by_branch(branch_name: str) -> callable:
:param branch_name: The name of the branch for which the version is being calculated
:return: The callable for the version strategy calculation
"""
if branch_name == 'main' or 'release/' in branch_name:
if branch_name == 'main' or 'release/' in branch_name or 'support/' in branch_name:
return _no_local_version_strategy
else:
return _node_strategy
Expand Down
4 changes: 3 additions & 1 deletion startleft/startleft/_version/version_scheme.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ def choose_strategy_by_branch(branch_name: str, exact: bool) -> callable:
:param branch_name: The name of the branch for which the version is being calculated
:return: The callable for the version strategy calculation
"""
if branch_name == 'main' or 'release/' in branch_name or __is_tag_commit(branch_name, exact):
if branch_name == 'main' or 'release/' in branch_name or 'support/' in branch_name or __is_tag_commit(branch_name, exact):
return _tag_version_strategy
elif 'hotfix/' in branch_name:
return _patch_version_dev_commit_strategy
elif 'supfix/' in branch_name:
return _patch_version_dev_commit_strategy
elif 'bugfix' in branch_name:
return _tag_version_dev_commit_strategy
else:
Expand Down
4 changes: 4 additions & 0 deletions startleft/tests/unit/_version/test_local_scheme.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ class TestLocalScheme:
('hotfix/XXX-000', '_node_strategy'),
('release/1.5.0', '_no_local_version_strategy'),
('bugfix/XXX-000', '_node_strategy'),
('support/1.19', '_no_local_version_strategy'),
('supfix/XXX-000', '_node_strategy'),
('dev', '_node_strategy'),
('feature/XXX-000', '_node_strategy'),
('UNKNOWN_BRANCH_PATTERN', '_node_strategy'),
Expand All @@ -38,6 +40,8 @@ def test_strategy_by_branch(self, branch, expected_strategy):
param(RELEASE_VERSION_BUGFIX, '', id='test_release_version_bugfix'),
# BUGFIX
param(BUGFIX_VERSION, '+g6cda015', id='test_bugfix_version'),
# SUPFIX
param(SUPFIX_VERSION, '+g6cda015', id='test_supfix_version'),
# DEV
param(DEV_RTP_VERSION, '+g17d9f68', id='test_dev_rtp_version'),
param(DEV_RP_VERSION, '+g3e49113', id='test_dev_rp_version'),
Expand Down
7 changes: 7 additions & 0 deletions startleft/tests/unit/_version/test_version_scheme.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ class TestVersionScheme:
('main', '_tag_version_strategy'),
('hotfix/XXX-000', '_patch_version_dev_commit_strategy'),
('release/1.5.0', '_tag_version_strategy'),
('support/1.19', '_tag_version_strategy'),
('supfix/XXX-000', '_patch_version_dev_commit_strategy'),
('bugfix/XXX-000', '_tag_version_dev_commit_strategy'),
('dev', '_minor_version_dev_commit_strategy'),
('feature/XXX-000', '_minor_version_dev_commit_strategy'),
Expand Down Expand Up @@ -60,6 +62,11 @@ def test_detached_head(self, exact: bool, expected_strategy):
param(RELEASE_VERSION_BUGFIX, '1.6.0rc1', id='test_release_version_bugfix'),
# BUGFIX
param(BUGFIX_VERSION, '1.6.0rc1.dev1', id='test_bugfix_version'),
# SUPPORT
param(SUPPORT_VERSION_NO_SUPFIX, '1.19.0', id='test_support_version_no_supfix'),
param(SUPPORT_VERSION_SUPFIX, '1.19.1', id='test_support_version_supfix'),
# SUPFIX
param(SUPFIX_VERSION, '1.19.1.dev1', id='test_supfix_version'),
# DEV
param(DEV_RTP_VERSION, '1.7.0.dev19', id='test_dev_rtp_version'),
param(DEV_RTP_NO_DISTANCE_VERSION, '1.7.0', id='test_dev_rtp_no_distance_version'),
Expand Down
19 changes: 19 additions & 0 deletions startleft/tests/unit/_version/version_mocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,25 @@
BUGFIX_VERSION = Mock(
branch='bugfix/XXX-000', tag='1.6.0rc1', distance=1, exact=False, node='g6cda015')


###########
# SUPPORT #
###########

SUPPORT_VERSION_NO_SUPFIX = Mock(
branch='support/1.19', tag='1.19.0', distance=None, exact=True, node='g05febfb'
)

SUPPORT_VERSION_SUPFIX = Mock(
branch='support/1.19', tag='1.19.1', distance=3, exact=False, node='ga1d748e'
)

##########
# SUPFIX #
##########
SUPFIX_VERSION = Mock(
branch='supfix/XXX-000', tag='1.19.0', distance=1, exact=False, node='g6cda015')

#######
# DEV #
#######
Expand Down

0 comments on commit 6270954

Please sign in to comment.