Merge "drop support for driverfixes branches"

This commit is contained in:
Zuul
2018-10-11 11:50:28 +00:00
committed by Gerrit Code Review
3 changed files with 6 additions and 289 deletions

View File

@@ -78,7 +78,6 @@ _USES_PREVER = set([
_VALID_BRANCH_PREFIXES = set([
'stable',
'feature',
'driverfixes',
])
_NO_STABLE_BRANCH_CHECK = set([
@@ -1541,67 +1540,6 @@ def validate_feature_branches(deliv, context):
)
def validate_driverfixes_branches(deliv, context):
"Apply the rules for driverfixes branches."
if deliv.type == 'tempest-plugin' and deliv.branches:
context.error('Tempest plugins do not support branching.')
return
known_series = sorted(list(
d for d in os.listdir('deliverables')
if not d.startswith('_')
))
for branch in deliv.branches:
try:
prefix, series = branch.name.split('/')
except ValueError:
context.error(
('driverfixes branch name expected to be driverfixes/name '
'but got %s') % (branch.name,))
continue
if prefix != 'driverfixes':
print('{} is not a driverfixes branch, skipping'.format(
branch.name))
continue
if series not in known_series:
context.error(
('driverfixes branches must be named for known series '
'but %s was not found in %s' % (
branch.name, known_series))
)
location = branch.location
if not isinstance(location, dict):
context.error(
('branch location for %s is '
'expected to be a mapping but got a %s' % (
branch.name, type(location)))
)
# The other rules aren't going to be testable, so skip them.
continue
for repo, loc in sorted(location.items()):
if not is_a_hash(loc):
context.error(
('driverfixes branches should be created from commits by '
'SHA but location %s for branch %s of %s does not look '
'like a SHA' % (
(loc, repo, branch.name)))
)
if not gitutils.commit_exists(context.workdir, repo, loc):
context.error(
('driverfixes branches should be created from merged '
'commits but location %s for branch %s of %s does not '
'exist' % (
(loc, repo, branch.name)))
)
_require_gitreview(repo, context)
def validate_branch_points(deliv, context):
"Make sure the branch points given are on the expected branches."
@@ -1619,22 +1557,14 @@ def validate_branch_points(deliv, context):
print('could not parse the branch name, skipping')
continue
if prefix == 'feature':
if prefix != 'stable':
print('these rules do not apply to feature branches, skipping')
continue
elif prefix == 'stable':
expected = set([
'master',
branch.name,
])
else:
# driverfixes
expected = set([
branch.name,
'stable/' + series,
])
expected = set([
'master',
branch.name,
])
location = branch.get_repo_map()
@@ -1850,7 +1780,6 @@ def main():
validate_branch_prefixes,
validate_stable_branches,
validate_feature_branches,
validate_driverfixes_branches,
validate_branch_points,
]
for check in checks:

View File

@@ -2383,175 +2383,6 @@ class TestValidateFeatureBranches(base.BaseTestCase):
self.assertEqual(1, len(self.ctx.errors))
class TestValidateDriverfixesBranches(base.BaseTestCase):
def setUp(self):
super().setUp()
self.ctx = validate.ValidationContext()
gitutils.clone_repo(self.ctx.workdir, 'openstack/automaton')
def test_unknown_series(self):
deliverable_data = textwrap.dedent('''
releases:
- version: 1.5.0
projects:
- repo: openstack/automaton
hash: be2885f544637e6ee6139df7dc7bf937925804dd
branches:
- name: driverfixes/abc
location:
openstack/automaton: be2885f544637e6ee6139df7dc7bf937925804dd
''')
deliv = deliverable.Deliverable(
team='team',
series='ocata',
name='release-test',
data=yamlutils.loads(deliverable_data),
)
validate.validate_driverfixes_branches(deliv, self.ctx)
self.ctx.show_summary()
self.assertEqual(0, len(self.ctx.warnings))
self.assertEqual(1, len(self.ctx.errors))
def test_location_not_a_dict(self):
deliverable_data = textwrap.dedent('''
releases:
- version: 1.5.0
projects:
- repo: openstack/automaton
hash: be2885f544637e6ee6139df7dc7bf937925804dd
branches:
- name: driverfixes/austin
location: 1.5.0
''')
deliv = deliverable.Deliverable(
team='team',
series='ocata',
name='release-test',
data=yamlutils.loads(deliverable_data),
)
validate.validate_driverfixes_branches(deliv, self.ctx)
self.ctx.show_summary()
self.assertEqual(0, len(self.ctx.warnings))
self.assertEqual(1, len(self.ctx.errors))
def test_location_not_a_sha(self):
deliverable_data = textwrap.dedent('''
releases:
- version: 1.5.0
projects:
- repo: openstack/automaton
hash: be2885f544637e6ee6139df7dc7bf937925804dd
branches:
- name: driverfixes/austin
location:
openstack/automaton: 1.5.0
''')
deliv = deliverable.Deliverable(
team='team',
series='ocata',
name='release-test',
data=yamlutils.loads(deliverable_data),
)
validate.validate_driverfixes_branches(deliv, self.ctx)
self.ctx.show_summary()
self.assertEqual(0, len(self.ctx.warnings))
self.assertEqual(1, len(self.ctx.errors))
def test_location_a_sha(self):
deliverable_data = textwrap.dedent('''
releases:
- version: 1.5.0
projects:
- repo: openstack/automaton
hash: be2885f544637e6ee6139df7dc7bf937925804dd
branches:
- name: driverfixes/austin
location:
openstack/automaton: be2885f544637e6ee6139df7dc7bf937925804dd
''')
deliv = deliverable.Deliverable(
team='team',
series='ocata',
name='release-test',
data=yamlutils.loads(deliverable_data),
)
validate.validate_driverfixes_branches(deliv, self.ctx)
self.ctx.show_summary()
self.assertEqual(0, len(self.ctx.warnings))
self.assertEqual(0, len(self.ctx.errors))
def test_badly_formatted_name(self):
deliverable_data = textwrap.dedent('''
releases:
- version: 1.5.0
projects:
- repo: openstack/automaton
hash: be2885f544637e6ee6139df7dc7bf937925804dd
branches:
- name: austin
location:
openstack/automaton: be2885f544637e6ee6139df7dc7bf937925804dd
''')
deliv = deliverable.Deliverable(
team='team',
series='ocata',
name='release-test',
data=yamlutils.loads(deliverable_data),
)
validate.validate_driverfixes_branches(deliv, self.ctx)
self.ctx.show_summary()
self.assertEqual(0, len(self.ctx.warnings))
self.assertEqual(1, len(self.ctx.errors))
def test_location_no_such_sha(self):
deliverable_data = textwrap.dedent('''
releases:
- version: 1.5.0
projects:
- repo: openstack/automaton
hash: be2885f544637e6ee6139df7dc7bf937925804dd
branches:
- name: driverfixes/austin
location:
openstack/automaton: de2885f544637e6ee6139df7dc7bf937925804dd
''')
deliv = deliverable.Deliverable(
team='team',
series='ocata',
name='release-test',
data=yamlutils.loads(deliverable_data),
)
validate.validate_driverfixes_branches(deliv, self.ctx)
self.ctx.show_summary()
self.assertEqual(0, len(self.ctx.warnings))
self.assertEqual(1, len(self.ctx.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
''')
deliv = deliverable.Deliverable(
team='team',
series='ocata',
name='release-test',
data=yamlutils.loads(deliverable_data),
)
validate.validate_driverfixes_branches(deliv, self.ctx)
self.ctx.show_summary()
self.assertEqual(0, len(self.ctx.warnings))
self.assertEqual(1, len(self.ctx.errors))
class TestValidateSeriesOpen(base.BaseTestCase):
def setUp(self):