diff --git a/doc/source/reference/using.rst b/doc/source/reference/using.rst index 7decc64689..9e4bffd170 100644 --- a/doc/source/reference/using.rst +++ b/doc/source/reference/using.rst @@ -403,6 +403,14 @@ The top level of a deliverable file is a mapping with keys: associated with the version (as identified by the deliverable file) will be branched from that version using the name given. + ``std-with-versions`` + This mode has the same meaning as the ``std`` branch type, with the + addition that version-based branches can be created as well. + + These version-based branches are shorter term stable branches that + are named for the major and minor version number (e.g. stable/3.1). + This is primarily used for Ironic releases. + ``tagless`` This mode requires stable branch locations to be a mapping between repository name and an existing commit, specified by the diff --git a/openstack_releases/cmds/validate.py b/openstack_releases/cmds/validate.py index 84b0b4c67f..1b66bfceac 100644 --- a/openstack_releases/cmds/validate.py +++ b/openstack_releases/cmds/validate.py @@ -1512,7 +1512,7 @@ def validate_stable_branches(deliv, context): location = branch.location - if branch_mode == 'std': + if branch_mode == 'std' or branch_mode == 'std-with-versions': if not isinstance(location, six.string_types): context.error( ('branch location for %s is ' @@ -1613,11 +1613,22 @@ def validate_stable_branches(deliv, context): else: if series != deliv.series: - context.error( - ('cycle-based projects must match series names ' - 'for stable branches. %s should be stable/%s' % ( - branch.name, deliv.series)) - ) + if branch_mode == 'std-with-versions': + # Not a normal stable branch, so it must be a version + # branch (stable/3.1) + expected_version = '.'.join(location.split('.')[0:2]) + if series != expected_version: + context.error( + 'cycle-based projects must match series names ' + 'for stable branches, or branch based on version ' + 'for short term support. %s should be stable/%s ' + 'or stable/%s' % ( + branch.name, deliv.series, expected_version)) + else: + context.error( + 'cycle-based projects must match series names ' + 'for stable branches. %s should be stable/%s' % ( + branch.name, deliv.series)) def validate_feature_branches(deliv, context): diff --git a/openstack_releases/schema.yaml b/openstack_releases/schema.yaml index 90600ecc14..e02ca20dc2 100644 --- a/openstack_releases/schema.yaml +++ b/openstack_releases/schema.yaml @@ -57,7 +57,7 @@ properties: "manila-image-elements", "generic" ] stable-branch-type: type: "string" - enum: [ "std", "tagless", "upstream", "none" ] + enum: [ "std", "tagless", "upstream", "none", "std-with-versions" ] cycle-highlights: type: "array" items: diff --git a/openstack_releases/tests/test_validate.py b/openstack_releases/tests/test_validate.py index b7b0bff984..6c646df67f 100644 --- a/openstack_releases/tests/test_validate.py +++ b/openstack_releases/tests/test_validate.py @@ -2221,6 +2221,54 @@ class TestValidateStableBranches(base.BaseTestCase): self.assertEqual(0, len(self.ctx.warnings)) self.assertEqual(1, len(self.ctx.errors)) + def test_std_with_versions_stable_branch_type(self): + deliverable_data = textwrap.dedent(''' + stable-branch-type: std-with-versions + releases: + - version: 99.0.3 + projects: + - repo: openstack/release-test + hash: 0cd17d1ee3b9284d36b2a0d370b49a6f0bbb9660 + branches: + - name: stable/99.0 + location: 99.0.3 + repository-settings: + openstack/release-test: {} + ''') + deliv = deliverable.Deliverable( + team='team', + series='ocata', + name='release-test', + data=yamlutils.loads(deliverable_data), + ) + validate.validate_stable_branches(deliv, self.ctx) + self.assertEqual(0, len(self.ctx.warnings)) + self.assertEqual(0, len(self.ctx.errors)) + + def test_std_with_versions_normal_stable_branch_type(self): + deliverable_data = textwrap.dedent(''' + stable-branch-type: std-with-versions + releases: + - version: 99.0.3 + projects: + - repo: openstack/release-test + hash: 0cd17d1ee3b9284d36b2a0d370b49a6f0bbb9660 + branches: + - name: stable/ocata + location: 99.0.3 + repository-settings: + openstack/release-test: {} + ''') + deliv = deliverable.Deliverable( + team='team', + series='ocata', + name='release-test', + data=yamlutils.loads(deliverable_data), + ) + validate.validate_stable_branches(deliv, self.ctx) + self.assertEqual(0, len(self.ctx.warnings)) + self.assertEqual(0, len(self.ctx.errors)) + def test_tagless_stable_branch_type_bad_location_type(self): deliverable_data = textwrap.dedent(''' stable-branch-type: tagless