don't allow branching for tempest plugins

Change-Id: Ic709f3ab06466e8614756fbfaee19ef1c1409b32
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2018-02-06 14:20:36 -05:00
parent 2f79956c04
commit 84dce327eb
3 changed files with 96 additions and 2 deletions

View File

@ -80,6 +80,7 @@ _VALID_TYPES = set([
'library', 'library',
'client-library', 'client-library',
'service', 'service',
'tempest-plugin',
'other', 'other',
]) ])
_VALID_BRANCH_PREFIXES = set([ _VALID_BRANCH_PREFIXES = set([
@ -748,9 +749,14 @@ def validate_stable_branches(deliverable_info, workdir,
deliverable_info['launchpad'] in _NO_STABLE_BRANCH_CHECK): deliverable_info['launchpad'] in _NO_STABLE_BRANCH_CHECK):
return return
branches = deliverable_info.get('branches', [])
if deliverable_info.get('type', 'other') == 'tempest-plugin' and branches:
mk_error('Tempest plugins do not support branching.')
return
branch_mode = deliverable_info.get('stable-branch-type', 'std') branch_mode = deliverable_info.get('stable-branch-type', 'std')
branches = deliverable_info.get('branches', [])
known_releases = { known_releases = {
r['version']: r r['version']: r
for r in deliverable_info.get('releases', []) for r in deliverable_info.get('releases', [])
@ -854,6 +860,11 @@ def validate_stable_branches(deliverable_info, workdir,
def validate_feature_branches(deliverable_info, workdir, mk_warning, mk_error): def validate_feature_branches(deliverable_info, workdir, mk_warning, mk_error):
"Apply the rules for feature branches." "Apply the rules for feature branches."
branches = deliverable_info.get('branches', []) branches = deliverable_info.get('branches', [])
if deliverable_info.get('type', 'other') == 'tempest-plugin' and branches:
mk_error('Tempest plugins do not support branching.')
return
for branch in branches: for branch in branches:
try: try:
prefix, series = branch['name'].split('/') prefix, series = branch['name'].split('/')
@ -897,6 +908,11 @@ def validate_driverfixes_branches(deliverable_info, workdir, mk_warning, mk_erro
if not d.startswith('_') if not d.startswith('_')
)) ))
branches = deliverable_info.get('branches', []) branches = deliverable_info.get('branches', [])
if deliverable_info.get('type', 'other') == 'tempest-plugin' and branches:
mk_error('Tempest plugins do not support branching.')
return
for branch in branches: for branch in branches:
try: try:
prefix, series = branch['name'].split('/') prefix, series = branch['name'].split('/')

View File

@ -26,7 +26,7 @@ properties:
enum: ["cycle-with-intermediary", "cycle-with-milestones", "cycle-trailing", "untagged"] enum: ["cycle-with-intermediary", "cycle-with-milestones", "cycle-trailing", "untagged"]
type: type:
type: "string" type: "string"
enum: ["horizon-plugin", "library", "client-library", "service", "other"] enum: ["horizon-plugin", "library", "client-library", "service", "tempest-plugin", "other"]
artifact-link-mode: artifact-link-mode:
type: "string" type: "string"
enum: ["tarball", "none"] enum: ["tarball", "none"]

View File

@ -1592,6 +1592,32 @@ class TestValidateStableBranches(base.BaseTestCase):
self.assertEqual(0, len(warnings)) self.assertEqual(0, len(warnings))
self.assertEqual(0, len(errors)) self.assertEqual(0, len(errors))
def test_tempest_plugin(self):
deliverable_data = textwrap.dedent('''
type: tempest-plugin
releases:
- version: 0.0.3
projects:
- repo: openstack/release-test
hash: 0cd17d1ee3b9284d36b2a0d370b49a6f0bbb9660
branches:
- name: stable/ocata
location:
openstack/release-test: 0.0.3
''')
warnings = []
errors = []
deliverable_info = yamlutils.loads(deliverable_data)
validate.validate_stable_branches(
deliverable_info,
self.tmpdir,
'ocata',
warnings.append,
errors.append,
)
self.assertEqual(0, len(warnings))
self.assertEqual(1, len(errors))
class TestValidateFeatureBranches(base.BaseTestCase): class TestValidateFeatureBranches(base.BaseTestCase):
@ -1724,6 +1750,32 @@ class TestValidateFeatureBranches(base.BaseTestCase):
self.assertEqual(0, len(warnings)) self.assertEqual(0, len(warnings))
self.assertEqual(1, len(errors)) self.assertEqual(1, len(errors))
def test_tempest_plugin(self):
deliverable_data = textwrap.dedent('''
type: tempest-plugin
releases:
- version: 0.0.3
projects:
- repo: openstack/release-test
hash: 0cd17d1ee3b9284d36b2a0d370b49a6f0bbb9660
branches:
- name: feature/abc
location:
openstack/release-test: 0cd17d1ee3b9284d36b2a0d370b49a6f0bbb9660
''')
warnings = []
errors = []
deliverable_info = yamlutils.loads(deliverable_data)
validate.validate_feature_branches(
deliverable_info,
self.tmpdir,
warnings.append,
errors.append,
)
print(warnings, errors)
self.assertEqual(0, len(warnings))
self.assertEqual(1, len(errors))
class TestValidateDriverfixesBranches(base.BaseTestCase): class TestValidateDriverfixesBranches(base.BaseTestCase):
@ -1881,6 +1933,32 @@ class TestValidateDriverfixesBranches(base.BaseTestCase):
self.assertEqual(0, len(warnings)) self.assertEqual(0, len(warnings))
self.assertEqual(1, len(errors)) self.assertEqual(1, len(errors))
def test_tempest_plugin(self):
deliverable_data = textwrap.dedent('''
type: tempest-plugin
releases:
- version: 1.5.0
projects:
- repo: openstack/automaton
hash: be2885f544637e6ee6139df7dc7bf937925804dd
branches:
- name: driverfixes/austin
location:
openstack/automaton: be2885f544637e6ee6139df7dc7bf937925804dd
''')
warnings = []
errors = []
deliverable_info = yamlutils.loads(deliverable_data)
validate.validate_driverfixes_branches(
deliverable_info,
self.tmpdir,
warnings.append,
errors.append,
)
print(warnings, errors)
self.assertEqual(0, len(warnings))
self.assertEqual(1, len(errors))
class TestValidateSeriesOpen(base.BaseTestCase): class TestValidateSeriesOpen(base.BaseTestCase):