Don't allow tagging em or eol with no branch

Change-Id: I2f113d8519338665606bf267084917b1fdde1a44
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
This commit is contained in:
Sean McGinnis 2020-03-07 07:13:37 -06:00
parent 05f5aed7fa
commit 7449c29ce9
No known key found for this signature in database
GPG Key ID: CE7EE4BFAF8D70C8
2 changed files with 83 additions and 1 deletions

View File

@ -411,7 +411,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]
@ -419,6 +419,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,
@ -446,6 +449,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):