Add stable-branch-mode:none option

Some "other" deliverables like tempest and patrole never
create stable branches. This allows to clearly mark such
deliverables and add a corner case in validation tests.

Change-Id: I2f6414d0f71baad58335702743f2180f8da3273f
This commit is contained in:
Thierry Carrez 2019-07-15 12:14:40 +02:00
parent d9df97d7aa
commit 3f7c9e782f
4 changed files with 37 additions and 1 deletions

View File

@ -408,6 +408,11 @@ The top level of a deliverable file is a mapping with keys:
Stable branch names track upstream release names, rather than Stable branch names track upstream release names, rather than
OpenStack series names. OpenStack series names.
``none``
This mode indicates that the deliverable should never have stable
branches. This is used for specific deliverables like tempest
or patrole.
``cycle-highlights`` ``cycle-highlights``
A list of plain-text bullet points describing some of the top new A list of plain-text bullet points describing some of the top new
features or changes you would like to point out for this release features or changes you would like to point out for this release

View File

@ -1437,6 +1437,11 @@ def validate_stable_branches(deliv, context):
branch_mode = deliv.stable_branch_type branch_mode = deliv.stable_branch_type
if branch_mode == 'none' and deliv.branches:
context.error('Deliverables with stable-branch-mode:none '
'do not support stable branching.')
return
if deliv.releases and deliv.releases[-1].is_eol: if deliv.releases and deliv.releases[-1].is_eol:
print('rule does not apply to end-of-life repos, skipping') print('rule does not apply to end-of-life repos, skipping')
return return

View File

@ -57,7 +57,7 @@ properties:
"manila-image-elements", "generic" ] "manila-image-elements", "generic" ]
stable-branch-type: stable-branch-type:
type: "string" type: "string"
enum: [ "std", "tagless", "upstream" ] enum: [ "std", "tagless", "upstream", "none" ]
cycle-highlights: cycle-highlights:
type: "array" type: "array"
items: items:

View File

@ -2264,6 +2264,32 @@ class TestValidateStableBranches(base.BaseTestCase):
self.assertEqual(0, len(self.ctx.warnings)) self.assertEqual(0, len(self.ctx.warnings))
self.assertEqual(1, len(self.ctx.errors)) self.assertEqual(1, len(self.ctx.errors))
def test_none_stable_branch_type(self):
deliverable_data = textwrap.dedent('''
type: other
stable-branch-type: none
releases:
- version: 99.0.3
projects:
- repo: openstack/release-test
hash: 0cd17d1ee3b9284d36b2a0d370b49a6f0bbb9660
branches:
- name: stable/ocata
location:
openstack/release-test: 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(1, len(self.ctx.errors))
class TestValidateFeatureBranches(base.BaseTestCase): class TestValidateFeatureBranches(base.BaseTestCase):