Merge "Don't allow tagging em or eol with no branch"

This commit is contained in:
Zuul 2020-03-09 12:45:37 +00:00 committed by Gerrit Code Review
commit 0e9caee0f1
2 changed files with 83 additions and 1 deletions

View File

@ -413,7 +413,7 @@ def _require_tag_on_all_repos(deliv, current_release, eol_or_em, context):
@skip_existing_tags
@applies_to_released
def validate_series_eol(deliv, context):
"The EOL tag should be applied to all repositories."
"""The EOL tag should be applied to all repositories."""
current_release = deliv.releases[-1]
@ -421,6 +421,9 @@ def validate_series_eol(deliv, context):
print('this rule only applies when tagging a series as end-of-life')
return
if len(deliv.branches) == 0:
context.error('only branched deliverables can be tagged EOL')
_require_tag_on_all_repos(
deliv,
current_release,
@ -448,6 +451,9 @@ def validate_series_em(deliv, context):
'release was not actually done for the series.')
return
if len(deliv.branches) == 0:
context.error('only branched deliverables can be tagged EM')
_require_tag_on_all_repos(
deliv,
current_release,

View File

@ -3124,10 +3124,17 @@ class TestValidateSeriesEOL(base.BaseTestCase):
---
team: Release Management
releases:
- version: 1.5.2
projects:
- repo: openstack/automaton
hash: ce2885f544637e6ee6139df7dc7bf937925804dd
- version: newton-eol
projects:
- repo: openstack/automaton
hash: be2885f544637e6ee6139df7dc7bf937925804dd
branches:
- name: stable/newton
location: 1.5.2
'''))
deliv = deliverable.Deliverable(
None,
@ -3152,6 +3159,9 @@ class TestValidateSeriesEOL(base.BaseTestCase):
projects:
- repo: openstack/automaton
hash: ce2885f544637e6ee6139df7dc7bf937925804dd
branches:
- name: stable/newton
location: 1.2.3
repository-settings:
openstack/automaton: {}
openstack/release-test: {}
@ -3170,6 +3180,32 @@ class TestValidateSeriesEOL(base.BaseTestCase):
self.assertEqual(0, len(self.ctx.warnings))
self.assertEqual(1, len(self.ctx.errors))
def test_eol_branchless(self):
deliverable_data = yamlutils.loads(textwrap.dedent('''
---
team: Release Management
releases:
- version: newton-eol
projects:
- repo: openstack/automaton
hash: ce2885f544637e6ee6139df7dc7bf937925804dd
repository-settings:
openstack/automaton: {}
'''))
deliv = deliverable.Deliverable(
None,
'newton',
'test',
deliverable_data,
)
validate.validate_series_eol(
deliv,
self.ctx,
)
self.ctx.show_summary()
self.assertEqual(0, len(self.ctx.warnings))
self.assertEqual(1, len(self.ctx.errors))
class TestValidateSeriesEM(base.BaseTestCase):
@ -3266,6 +3302,9 @@ class TestValidateSeriesEM(base.BaseTestCase):
projects:
- repo: openstack/automaton
hash: be2885f544637e6ee6139df7dc7bf937925804dd
branches:
- name: stable/newton
location: 1.2.3
'''))
deliv = deliverable.Deliverable(
None,
@ -3322,6 +3361,9 @@ class TestValidateSeriesEM(base.BaseTestCase):
projects:
- repo: openstack/automaton
hash: be2885f544637e6ee6139df7dc7bf937925804dd
branches:
- name: stable/newton
location: 1.2.3
repository-settings:
openstack/automaton: {}
'''))
@ -3356,6 +3398,9 @@ class TestValidateSeriesEM(base.BaseTestCase):
projects:
- repo: openstack/automaton
hash: beef85f544637e6ee6139df7dc7bf937925804dd
branches:
- name: stable/newton
location: 1.2.3
repository-settings:
openstack/automaton: {}
'''))
@ -3386,6 +3431,9 @@ class TestValidateSeriesEM(base.BaseTestCase):
projects:
- repo: openstack/automaton
hash: be2885f544637e6ee6139df7dc7bf937925804dd
branches:
- name: stable/newton
location: 1.2.3
repository-settings:
openstack/automaton: {}
openstack/release-test: {}
@ -3404,6 +3452,34 @@ class TestValidateSeriesEM(base.BaseTestCase):
self.assertEqual(0, len(self.ctx.warnings))
self.assertEqual(1, len(self.ctx.errors))
def test_em_branchless(self):
deliverable_data = yamlutils.loads(textwrap.dedent('''
---
team: Release Management
releases:
- version: 1.2.3
projects:
- repo: openstack/automaton
hash: be2885f544637e6ee6139df7dc7bf937925804dd
- version: newton-em
projects:
- repo: openstack/automaton
hash: be2885f544637e6ee6139df7dc7bf937925804dd
'''))
deliv = deliverable.Deliverable(
None,
'newton',
'test',
deliverable_data,
)
validate.validate_series_em(
deliv,
self.ctx,
)
self.ctx.show_summary()
self.assertEqual(0, len(self.ctx.warnings))
self.assertEqual(1, len(self.ctx.errors))
class TestValidatePreReleaseProgression(base.BaseTestCase):