require stable branches be made from latest release
At the end of rocky we had a couple of cases where a forced branch was created from a release that was not the most current. This validation change should prevent that from happening again in the future. Change-Id: Ie8635b74ccbce988b5f4e53c0848daf50625b239 Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
parent
a73477f29a
commit
11bb8e04f4
@ -1365,10 +1365,8 @@ def validate_stable_branches(deliv, context):
|
|||||||
|
|
||||||
branch_mode = deliv.stable_branch_type
|
branch_mode = deliv.stable_branch_type
|
||||||
|
|
||||||
known_releases = {
|
latest_release = deliv.releases[-1]
|
||||||
r.version: r
|
|
||||||
for r in deliv.releases
|
|
||||||
}
|
|
||||||
known_series = sorted(list(
|
known_series = sorted(list(
|
||||||
d for d in os.listdir('deliverables')
|
d for d in os.listdir('deliverables')
|
||||||
if not d.startswith('_')
|
if not d.startswith('_')
|
||||||
@ -1395,12 +1393,32 @@ def validate_stable_branches(deliv, context):
|
|||||||
'expected to be a string but got a %s' % (
|
'expected to be a string but got a %s' % (
|
||||||
branch.name, type(location)))
|
branch.name, type(location)))
|
||||||
)
|
)
|
||||||
if location not in known_releases:
|
|
||||||
|
if not deliv.known_repo_names:
|
||||||
context.error(
|
context.error(
|
||||||
('stable branches must be created from existing '
|
('Unable to validate branch {} for '
|
||||||
'tagged releases, and %s for %s is not found in the '
|
'{} without repository information').format(
|
||||||
'list of releases for this deliverable' % (
|
branch.name, deliv.name,
|
||||||
location, branch.name))
|
)
|
||||||
|
)
|
||||||
|
return
|
||||||
|
branch_exists = all(
|
||||||
|
gitutils.stable_branch_exists(
|
||||||
|
context.workdir,
|
||||||
|
repo,
|
||||||
|
deliv.series
|
||||||
|
)
|
||||||
|
for repo in deliv.known_repo_names
|
||||||
|
)
|
||||||
|
if branch_exists:
|
||||||
|
print('{} branch already exists, skipping validation'.format(
|
||||||
|
branch.name))
|
||||||
|
continue
|
||||||
|
if location != latest_release.version:
|
||||||
|
context.error(
|
||||||
|
('stable branches must be created from the latest '
|
||||||
|
'tagged release, and %s for %s does not match %s' % (
|
||||||
|
location, branch.name, latest_release.version))
|
||||||
)
|
)
|
||||||
|
|
||||||
elif branch_mode == 'tagless':
|
elif branch_mode == 'tagless':
|
||||||
|
@ -1894,13 +1894,15 @@ class TestValidateStableBranches(base.BaseTestCase):
|
|||||||
def test_version_in_deliverable(self):
|
def test_version_in_deliverable(self):
|
||||||
deliverable_data = textwrap.dedent('''
|
deliverable_data = textwrap.dedent('''
|
||||||
releases:
|
releases:
|
||||||
- version: 0.0.3
|
- version: 99.0.3
|
||||||
projects:
|
projects:
|
||||||
- repo: openstack/release-test
|
- repo: openstack/release-test
|
||||||
hash: 0cd17d1ee3b9284d36b2a0d370b49a6f0bbb9660
|
hash: 0cd17d1ee3b9284d36b2a0d370b49a6f0bbb9660
|
||||||
branches:
|
branches:
|
||||||
- name: stable/ocata
|
- name: stable/ocata
|
||||||
location: 0.0.3
|
location: 99.0.3
|
||||||
|
repository-settings:
|
||||||
|
openstack/release-test: {}
|
||||||
''')
|
''')
|
||||||
deliv = deliverable.Deliverable(
|
deliv = deliverable.Deliverable(
|
||||||
team='team',
|
team='team',
|
||||||
@ -1915,13 +1917,15 @@ class TestValidateStableBranches(base.BaseTestCase):
|
|||||||
def test_badly_formatted_name(self):
|
def test_badly_formatted_name(self):
|
||||||
deliverable_data = textwrap.dedent('''
|
deliverable_data = textwrap.dedent('''
|
||||||
releases:
|
releases:
|
||||||
- version: 0.0.3
|
- version: 99.0.3
|
||||||
projects:
|
projects:
|
||||||
- repo: openstack/release-test
|
- repo: openstack/release-test
|
||||||
hash: 0cd17d1ee3b9284d36b2a0d370b49a6f0bbb9660
|
hash: 0cd17d1ee3b9284d36b2a0d370b49a6f0bbb9660
|
||||||
branches:
|
branches:
|
||||||
- name: ocata
|
- name: ocata
|
||||||
location: 0.0.3
|
location: 99.0.3
|
||||||
|
repository-settings:
|
||||||
|
openstack/release-test: {}
|
||||||
''')
|
''')
|
||||||
deliv = deliverable.Deliverable(
|
deliv = deliverable.Deliverable(
|
||||||
team='team',
|
team='team',
|
||||||
@ -1936,13 +1940,42 @@ class TestValidateStableBranches(base.BaseTestCase):
|
|||||||
def test_version_not_in_deliverable(self):
|
def test_version_not_in_deliverable(self):
|
||||||
deliverable_data = textwrap.dedent('''
|
deliverable_data = textwrap.dedent('''
|
||||||
releases:
|
releases:
|
||||||
- version: 0.0.3
|
- version: 99.0.3
|
||||||
projects:
|
projects:
|
||||||
- repo: openstack/release-test
|
- repo: openstack/release-test
|
||||||
hash: 0cd17d1ee3b9284d36b2a0d370b49a6f0bbb9660
|
hash: 0cd17d1ee3b9284d36b2a0d370b49a6f0bbb9660
|
||||||
branches:
|
branches:
|
||||||
- name: stable/ocata
|
- name: stable/ocata
|
||||||
location: 0.0.4
|
location: 99.0.4
|
||||||
|
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(1, len(self.ctx.errors))
|
||||||
|
|
||||||
|
def test_version_not_last(self):
|
||||||
|
deliverable_data = textwrap.dedent('''
|
||||||
|
releases:
|
||||||
|
- version: 99.0.3
|
||||||
|
projects:
|
||||||
|
- repo: openstack/release-test
|
||||||
|
hash: 0cd17d1ee3b9284d36b2a0d370b49a6f0bbb9660
|
||||||
|
- version: 99.0.4
|
||||||
|
projects:
|
||||||
|
- repo: openstack/release-test
|
||||||
|
hash: 0cd17d1ee3b9284d36b2a0d370b49a6f0bbb9660
|
||||||
|
branches:
|
||||||
|
- name: stable/ocata
|
||||||
|
location: 99.0.3
|
||||||
|
repository-settings:
|
||||||
|
openstack/release-test: {}
|
||||||
''')
|
''')
|
||||||
deliv = deliverable.Deliverable(
|
deliv = deliverable.Deliverable(
|
||||||
team='team',
|
team='team',
|
||||||
@ -1957,17 +1990,43 @@ class TestValidateStableBranches(base.BaseTestCase):
|
|||||||
def test_mismatched_series_cycle(self):
|
def test_mismatched_series_cycle(self):
|
||||||
deliverable_data = textwrap.dedent('''
|
deliverable_data = textwrap.dedent('''
|
||||||
releases:
|
releases:
|
||||||
- version: 0.0.3
|
- version: 99.0.3
|
||||||
projects:
|
projects:
|
||||||
- repo: openstack/release-test
|
- repo: openstack/release-test
|
||||||
hash: 0cd17d1ee3b9284d36b2a0d370b49a6f0bbb9660
|
hash: 0cd17d1ee3b9284d36b2a0d370b49a6f0bbb9660
|
||||||
branches:
|
branches:
|
||||||
- name: stable/def
|
- name: stable/does-not-exist
|
||||||
location: 0.0.3
|
location: 99.0.3
|
||||||
|
repository-settings:
|
||||||
|
openstack/release-test: {}
|
||||||
''')
|
''')
|
||||||
deliv = deliverable.Deliverable(
|
deliv = deliverable.Deliverable(
|
||||||
team='team',
|
team='team',
|
||||||
series='abc',
|
series='series-name-does-not-match',
|
||||||
|
name='release-test',
|
||||||
|
data=yamlutils.loads(deliverable_data),
|
||||||
|
)
|
||||||
|
validate.validate_stable_branches(deliv, self.ctx)
|
||||||
|
self.ctx.show_summary()
|
||||||
|
self.assertEqual(0, len(self.ctx.warnings))
|
||||||
|
self.assertEqual(1, len(self.ctx.errors))
|
||||||
|
|
||||||
|
def test_without_repository_settings(self):
|
||||||
|
deliverable_data = textwrap.dedent('''
|
||||||
|
releases:
|
||||||
|
- version: 99.0.3
|
||||||
|
projects:
|
||||||
|
- repo: openstack/release-test
|
||||||
|
hash: 0cd17d1ee3b9284d36b2a0d370b49a6f0bbb9660
|
||||||
|
branches:
|
||||||
|
- name: stable/does-not-exist
|
||||||
|
location: 99.0.3
|
||||||
|
repository-settings:
|
||||||
|
openstack/release-test: {}
|
||||||
|
''')
|
||||||
|
deliv = deliverable.Deliverable(
|
||||||
|
team='team',
|
||||||
|
series='series-name-does-not-match',
|
||||||
name='release-test',
|
name='release-test',
|
||||||
data=yamlutils.loads(deliverable_data),
|
data=yamlutils.loads(deliverable_data),
|
||||||
)
|
)
|
||||||
@ -1979,13 +2038,15 @@ class TestValidateStableBranches(base.BaseTestCase):
|
|||||||
def test_unknown_series_independent(self):
|
def test_unknown_series_independent(self):
|
||||||
deliverable_data = textwrap.dedent('''
|
deliverable_data = textwrap.dedent('''
|
||||||
releases:
|
releases:
|
||||||
- version: 0.0.3
|
- version: 99.0.3
|
||||||
projects:
|
projects:
|
||||||
- repo: openstack/release-test
|
- repo: openstack/release-test
|
||||||
hash: 0cd17d1ee3b9284d36b2a0d370b49a6f0bbb9660
|
hash: 0cd17d1ee3b9284d36b2a0d370b49a6f0bbb9660
|
||||||
branches:
|
branches:
|
||||||
- name: stable/abc
|
- name: stable/abc
|
||||||
location: 0.0.3
|
location: 99.0.3
|
||||||
|
repository-settings:
|
||||||
|
openstack/release-test: {}
|
||||||
''')
|
''')
|
||||||
deliv = deliverable.Deliverable(
|
deliv = deliverable.Deliverable(
|
||||||
team='team',
|
team='team',
|
||||||
@ -2004,13 +2065,15 @@ class TestValidateStableBranches(base.BaseTestCase):
|
|||||||
# See validate._NO_STABLE_BRANCH_CHECK.
|
# See validate._NO_STABLE_BRANCH_CHECK.
|
||||||
launchpad: gnocchi
|
launchpad: gnocchi
|
||||||
releases:
|
releases:
|
||||||
- version: 0.0.3
|
- version: 99.0.3
|
||||||
projects:
|
projects:
|
||||||
- repo: openstack/release-test
|
- repo: openstack/release-test
|
||||||
hash: 0cd17d1ee3b9284d36b2a0d370b49a6f0bbb9660
|
hash: 0cd17d1ee3b9284d36b2a0d370b49a6f0bbb9660
|
||||||
branches:
|
branches:
|
||||||
- name: stable/abc
|
- name: stable/abc
|
||||||
location: 0.0.3
|
location: 99.0.3
|
||||||
|
repository-settings:
|
||||||
|
openstack/release-test: {}
|
||||||
''')
|
''')
|
||||||
deliv = deliverable.Deliverable(
|
deliv = deliverable.Deliverable(
|
||||||
team='team',
|
team='team',
|
||||||
@ -2027,13 +2090,15 @@ class TestValidateStableBranches(base.BaseTestCase):
|
|||||||
deliverable_data = textwrap.dedent('''
|
deliverable_data = textwrap.dedent('''
|
||||||
stable-branch-type: std
|
stable-branch-type: std
|
||||||
releases:
|
releases:
|
||||||
- version: 0.0.3
|
- version: 99.0.3
|
||||||
projects:
|
projects:
|
||||||
- repo: openstack/release-test
|
- repo: openstack/release-test
|
||||||
hash: 0cd17d1ee3b9284d36b2a0d370b49a6f0bbb9660
|
hash: 0cd17d1ee3b9284d36b2a0d370b49a6f0bbb9660
|
||||||
branches:
|
branches:
|
||||||
- name: stable/ocata
|
- name: stable/ocata
|
||||||
location: 0.0.3
|
location: 99.0.3
|
||||||
|
repository-settings:
|
||||||
|
openstack/release-test: {}
|
||||||
''')
|
''')
|
||||||
deliv = deliverable.Deliverable(
|
deliv = deliverable.Deliverable(
|
||||||
team='team',
|
team='team',
|
||||||
@ -2049,13 +2114,15 @@ class TestValidateStableBranches(base.BaseTestCase):
|
|||||||
deliverable_data = textwrap.dedent('''
|
deliverable_data = textwrap.dedent('''
|
||||||
stable-branch-type: unknown
|
stable-branch-type: unknown
|
||||||
releases:
|
releases:
|
||||||
- version: 0.0.3
|
- version: 99.0.3
|
||||||
projects:
|
projects:
|
||||||
- repo: openstack/release-test
|
- repo: openstack/release-test
|
||||||
hash: 0cd17d1ee3b9284d36b2a0d370b49a6f0bbb9660
|
hash: 0cd17d1ee3b9284d36b2a0d370b49a6f0bbb9660
|
||||||
branches:
|
branches:
|
||||||
- name: stable/ocata
|
- name: stable/ocata
|
||||||
location: 0.0.3
|
location: 99.0.3
|
||||||
|
repository-settings:
|
||||||
|
openstack/release-test: {}
|
||||||
''')
|
''')
|
||||||
deliv = deliverable.Deliverable(
|
deliv = deliverable.Deliverable(
|
||||||
team='team',
|
team='team',
|
||||||
@ -2071,13 +2138,15 @@ class TestValidateStableBranches(base.BaseTestCase):
|
|||||||
deliverable_data = textwrap.dedent('''
|
deliverable_data = textwrap.dedent('''
|
||||||
stable-branch-type: tagless
|
stable-branch-type: tagless
|
||||||
releases:
|
releases:
|
||||||
- version: 0.0.3
|
- version: 99.0.3
|
||||||
projects:
|
projects:
|
||||||
- repo: openstack/release-test
|
- repo: openstack/release-test
|
||||||
hash: 0cd17d1ee3b9284d36b2a0d370b49a6f0bbb9660
|
hash: 0cd17d1ee3b9284d36b2a0d370b49a6f0bbb9660
|
||||||
branches:
|
branches:
|
||||||
- name: stable/ocata
|
- name: stable/ocata
|
||||||
location: 0.0.3
|
location: 99.0.3
|
||||||
|
repository-settings:
|
||||||
|
openstack/release-test: {}
|
||||||
''')
|
''')
|
||||||
deliv = deliverable.Deliverable(
|
deliv = deliverable.Deliverable(
|
||||||
team='team',
|
team='team',
|
||||||
@ -2093,14 +2162,16 @@ class TestValidateStableBranches(base.BaseTestCase):
|
|||||||
deliverable_data = textwrap.dedent('''
|
deliverable_data = textwrap.dedent('''
|
||||||
stable-branch-type: tagless
|
stable-branch-type: tagless
|
||||||
releases:
|
releases:
|
||||||
- version: 0.0.3
|
- version: 99.0.3
|
||||||
projects:
|
projects:
|
||||||
- repo: openstack/release-test
|
- repo: openstack/release-test
|
||||||
hash: 0cd17d1ee3b9284d36b2a0d370b49a6f0bbb9660
|
hash: 0cd17d1ee3b9284d36b2a0d370b49a6f0bbb9660
|
||||||
branches:
|
branches:
|
||||||
- name: stable/ocata
|
- name: stable/ocata
|
||||||
location:
|
location:
|
||||||
openstack/release-test: 0.0.3
|
openstack/release-test: 99.0.3
|
||||||
|
repository-settings:
|
||||||
|
openstack/release-test: {}
|
||||||
''')
|
''')
|
||||||
deliv = deliverable.Deliverable(
|
deliv = deliverable.Deliverable(
|
||||||
team='team',
|
team='team',
|
||||||
@ -2116,7 +2187,7 @@ class TestValidateStableBranches(base.BaseTestCase):
|
|||||||
deliverable_data = textwrap.dedent('''
|
deliverable_data = textwrap.dedent('''
|
||||||
stable-branch-type: tagless
|
stable-branch-type: tagless
|
||||||
releases:
|
releases:
|
||||||
- version: 0.0.3
|
- version: 99.0.3
|
||||||
projects:
|
projects:
|
||||||
- repo: openstack/release-test
|
- repo: openstack/release-test
|
||||||
hash: 0cd17d1ee3b9284d36b2a0d370b49a6f0bbb9660
|
hash: 0cd17d1ee3b9284d36b2a0d370b49a6f0bbb9660
|
||||||
@ -2124,6 +2195,8 @@ class TestValidateStableBranches(base.BaseTestCase):
|
|||||||
- name: stable/ocata
|
- name: stable/ocata
|
||||||
location:
|
location:
|
||||||
openstack/release-test: 0cd17d1ee3b9284d36b2a0d370b49a6f0bbb9660
|
openstack/release-test: 0cd17d1ee3b9284d36b2a0d370b49a6f0bbb9660
|
||||||
|
repository-settings:
|
||||||
|
openstack/release-test: {}
|
||||||
''')
|
''')
|
||||||
deliv = deliverable.Deliverable(
|
deliv = deliverable.Deliverable(
|
||||||
team='team',
|
team='team',
|
||||||
@ -2139,14 +2212,16 @@ class TestValidateStableBranches(base.BaseTestCase):
|
|||||||
deliverable_data = textwrap.dedent('''
|
deliverable_data = textwrap.dedent('''
|
||||||
type: tempest-plugin
|
type: tempest-plugin
|
||||||
releases:
|
releases:
|
||||||
- version: 0.0.3
|
- version: 99.0.3
|
||||||
projects:
|
projects:
|
||||||
- repo: openstack/release-test
|
- repo: openstack/release-test
|
||||||
hash: 0cd17d1ee3b9284d36b2a0d370b49a6f0bbb9660
|
hash: 0cd17d1ee3b9284d36b2a0d370b49a6f0bbb9660
|
||||||
branches:
|
branches:
|
||||||
- name: stable/ocata
|
- name: stable/ocata
|
||||||
location:
|
location:
|
||||||
openstack/release-test: 0.0.3
|
openstack/release-test: 99.0.3
|
||||||
|
repository-settings:
|
||||||
|
openstack/release-test: {}
|
||||||
''')
|
''')
|
||||||
deliv = deliverable.Deliverable(
|
deliv = deliverable.Deliverable(
|
||||||
team='team',
|
team='team',
|
||||||
|
Loading…
Reference in New Issue
Block a user