Merge "Add std-with-versions stable-branch-type"

This commit is contained in:
Zuul 2020-06-04 10:41:25 +00:00 committed by Gerrit Code Review
commit e97e293c66
4 changed files with 74 additions and 7 deletions

View File

@ -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 associated with the version (as identified by the deliverable
file) will be branched from that version using the name given. 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`` ``tagless``
This mode requires stable branch locations to be a mapping between This mode requires stable branch locations to be a mapping between
repository name and an existing commit, specified by the repository name and an existing commit, specified by the

View File

@ -1512,7 +1512,7 @@ def validate_stable_branches(deliv, context):
location = branch.location location = branch.location
if branch_mode == 'std': if branch_mode == 'std' or branch_mode == 'std-with-versions':
if not isinstance(location, six.string_types): if not isinstance(location, six.string_types):
context.error( context.error(
('branch location for %s is ' ('branch location for %s is '
@ -1613,11 +1613,22 @@ def validate_stable_branches(deliv, context):
else: else:
if series != deliv.series: if series != deliv.series:
context.error( if branch_mode == 'std-with-versions':
('cycle-based projects must match series names ' # Not a normal stable branch, so it must be a version
'for stable branches. %s should be stable/%s' % ( # branch (stable/3.1)
branch.name, deliv.series)) 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): def validate_feature_branches(deliv, context):

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", "none" ] enum: [ "std", "tagless", "upstream", "none", "std-with-versions" ]
cycle-highlights: cycle-highlights:
type: "array" type: "array"
items: items:

View File

@ -2221,6 +2221,54 @@ 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_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): def test_tagless_stable_branch_type_bad_location_type(self):
deliverable_data = textwrap.dedent(''' deliverable_data = textwrap.dedent('''
stable-branch-type: tagless stable-branch-type: tagless