make release job validation based on project type
Require puppet repositories to have the puppet jobs and node repositories to have the node jobs. Update the allowed values for release-type to include "puppet" and "nodejs" for folks who want to be explicit, but also use the module type-detection code to default properly. Report any jobs that are valid release jobs but for the wrong release type as errors instead of warnings. Change-Id: I9330cc62834f42ae0cd4d1cc48ed963846d72944 Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
parent
5fd00baa37
commit
9a49ded73f
10
README.rst
10
README.rst
@ -409,6 +409,16 @@ The top level of a deliverable file is a mapping with keys:
|
|||||||
``fuel``
|
``fuel``
|
||||||
The Fuel project manages its own packages.
|
The Fuel project manages its own packages.
|
||||||
|
|
||||||
|
``puppet``
|
||||||
|
All puppet modules should use this. If no release-type is
|
||||||
|
specified and the validation job can determine that a module is a
|
||||||
|
puppet module, it assumes a release-type of ``puppet``.
|
||||||
|
|
||||||
|
``nodejs``
|
||||||
|
All nodejs modules should use this. If no release-type is
|
||||||
|
specified and the validation job can determine that a module is a
|
||||||
|
nodejs module, it assumes a release-type of ``nodejs``.
|
||||||
|
|
||||||
``releases``
|
``releases``
|
||||||
A list of the releases for the deliverable.
|
A list of the releases for the deliverable.
|
||||||
|
|
||||||
|
@ -363,7 +363,6 @@ def validate_releases(deliverable_info, zuul_projects,
|
|||||||
# appear at the end of the file.
|
# appear at the end of the file.
|
||||||
new_releases = {}
|
new_releases = {}
|
||||||
|
|
||||||
release_type = deliverable_info.get('release-type', 'std')
|
|
||||||
link_mode = deliverable_info.get('artifact-link-mode', 'tarball')
|
link_mode = deliverable_info.get('artifact-link-mode', 'tarball')
|
||||||
|
|
||||||
if release_model == 'untagged' and 'releases' in deliverable_info:
|
if release_model == 'untagged' and 'releases' in deliverable_info:
|
||||||
@ -378,13 +377,6 @@ def validate_releases(deliverable_info, zuul_projects,
|
|||||||
|
|
||||||
for project in release['projects']:
|
for project in release['projects']:
|
||||||
|
|
||||||
# Check for release jobs (if we ship a tarball)
|
|
||||||
if link_mode != 'none':
|
|
||||||
project_config.require_release_jobs_for_repo(
|
|
||||||
deliverable_info, zuul_projects, project['repo'],
|
|
||||||
release_type, mk_warning, mk_error,
|
|
||||||
)
|
|
||||||
|
|
||||||
# Check the SHA specified for the tag.
|
# Check the SHA specified for the tag.
|
||||||
print('%s SHA %s ' % (project['repo'], project['hash']))
|
print('%s SHA %s ' % (project['repo'], project['hash']))
|
||||||
|
|
||||||
@ -489,19 +481,17 @@ def validate_releases(deliverable_info, zuul_projects,
|
|||||||
(prev_version, ', '.join(sorted(prev_projects))))
|
(prev_version, ', '.join(sorted(prev_projects))))
|
||||||
else:
|
else:
|
||||||
|
|
||||||
for e in versionutils.validate_version(
|
# We change this default to be more
|
||||||
release['version'],
|
# language-specific before testing the release
|
||||||
release_type=release_type,
|
# jobs.
|
||||||
pre_ok=(release_model in _USES_PREVER)):
|
default_release_type = 'std'
|
||||||
msg = ('could not validate version %r: %s' %
|
|
||||||
(release['version'], e))
|
|
||||||
mk_error(msg)
|
|
||||||
|
|
||||||
# If this is a puppet module, ensure
|
# If this is a puppet module, ensure
|
||||||
# that the tag and metadata file
|
# that the tag and metadata file
|
||||||
# match.
|
# match.
|
||||||
if puppetutils.looks_like_a_module(workdir,
|
if puppetutils.looks_like_a_module(workdir,
|
||||||
project['repo']):
|
project['repo']):
|
||||||
|
default_release_type = 'puppet'
|
||||||
puppet_ver = puppetutils.get_version(
|
puppet_ver = puppetutils.get_version(
|
||||||
workdir, project['repo'])
|
workdir, project['repo'])
|
||||||
if puppet_ver != release['version']:
|
if puppet_ver != release['version']:
|
||||||
@ -519,6 +509,7 @@ def validate_releases(deliverable_info, zuul_projects,
|
|||||||
# match.
|
# match.
|
||||||
if npmutils.looks_like_a_module(workdir,
|
if npmutils.looks_like_a_module(workdir,
|
||||||
project['repo']):
|
project['repo']):
|
||||||
|
default_release_type = 'nodejs'
|
||||||
npm_ver = npmutils.get_version(
|
npm_ver = npmutils.get_version(
|
||||||
workdir, project['repo'])
|
workdir, project['repo'])
|
||||||
if npm_ver != release['version']:
|
if npm_ver != release['version']:
|
||||||
@ -531,6 +522,26 @@ def validate_releases(deliverable_info, zuul_projects,
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Check for release jobs (if we ship a tarball)
|
||||||
|
release_type = deliverable_info.get(
|
||||||
|
'release-type',
|
||||||
|
default_release_type,
|
||||||
|
)
|
||||||
|
if link_mode != 'none':
|
||||||
|
project_config.require_release_jobs_for_repo(
|
||||||
|
deliverable_info, zuul_projects,
|
||||||
|
project['repo'],
|
||||||
|
release_type, mk_warning, mk_error,
|
||||||
|
)
|
||||||
|
|
||||||
|
for e in versionutils.validate_version(
|
||||||
|
release['version'],
|
||||||
|
release_type=release_type,
|
||||||
|
pre_ok=(release_model in _USES_PREVER)):
|
||||||
|
msg = ('could not validate version %r: %s' %
|
||||||
|
(release['version'], e))
|
||||||
|
mk_error(msg)
|
||||||
|
|
||||||
if is_independent:
|
if is_independent:
|
||||||
mk_warning('skipping descendant test for '
|
mk_warning('skipping descendant test for '
|
||||||
'independent project, verify '
|
'independent project, verify '
|
||||||
|
@ -82,10 +82,14 @@ def get_zuul_project_data(url=ZUUL_PROJECTS_URL):
|
|||||||
# Which jobs are needed for which release types.
|
# Which jobs are needed for which release types.
|
||||||
_RELEASE_JOBS_FOR_TYPE = {
|
_RELEASE_JOBS_FOR_TYPE = {
|
||||||
'std': [
|
'std': [
|
||||||
'nodejs4-publish-to-npm',
|
|
||||||
'nodejs6-publish-to-npm',
|
|
||||||
'openstack-server-release-jobs',
|
'openstack-server-release-jobs',
|
||||||
'publish-to-pypi',
|
'publish-to-pypi',
|
||||||
|
],
|
||||||
|
'nodejs': [
|
||||||
|
'nodejs4-publish-to-npm',
|
||||||
|
'nodejs6-publish-to-npm',
|
||||||
|
],
|
||||||
|
'puppet': [
|
||||||
'puppet-tarball-jobs',
|
'puppet-tarball-jobs',
|
||||||
'puppet-release-jobs',
|
'puppet-release-jobs',
|
||||||
],
|
],
|
||||||
@ -162,4 +166,24 @@ def require_release_jobs_for_repo(deliverable_info, zuul_projects, repo,
|
|||||||
found=found_jobs,
|
found=found_jobs,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
# Check to see if we found jobs we did not expect to find.
|
||||||
|
for wrong_type, wrong_jobs in _RELEASE_JOBS_FOR_TYPE.items():
|
||||||
|
if wrong_type == release_type:
|
||||||
|
continue
|
||||||
|
bad_jobs = [
|
||||||
|
j for j in wrong_jobs
|
||||||
|
if j in templates
|
||||||
|
]
|
||||||
|
if bad_jobs:
|
||||||
|
mk_error(
|
||||||
|
'{filename} has unexpected release jobs '
|
||||||
|
'{bad_jobs!r} for release-type {wrong_type} '
|
||||||
|
'but {repo} uses release-type {release_type}'.format(
|
||||||
|
filename=ZUUL_PROJECTS_FILENAME,
|
||||||
|
repo=repo,
|
||||||
|
bad_jobs=bad_jobs,
|
||||||
|
wrong_type=wrong_type,
|
||||||
|
release_type=release_type,
|
||||||
|
)
|
||||||
|
)
|
||||||
return
|
return
|
||||||
|
@ -35,7 +35,7 @@ properties:
|
|||||||
type: "object"
|
type: "object"
|
||||||
release-type:
|
release-type:
|
||||||
type: "string"
|
type: "string"
|
||||||
enum: [ "std", "xstatic", "fuel" ]
|
enum: [ "std", "xstatic", "fuel", "nodejs", "puppet" ]
|
||||||
stable-branch-type:
|
stable-branch-type:
|
||||||
type: "string"
|
type: "string"
|
||||||
enum: [ "std", "tagless", "upstream" ]
|
enum: [ "std", "tagless", "upstream" ]
|
||||||
|
@ -132,5 +132,5 @@ class TestReleaseJobsStandard(base.BaseTestCase):
|
|||||||
warnings.append,
|
warnings.append,
|
||||||
errors.append,
|
errors.append,
|
||||||
)
|
)
|
||||||
self.assertEqual(1, len(warnings))
|
self.assertEqual(0, len(warnings))
|
||||||
self.assertEqual(0, len(errors))
|
self.assertEqual(1, len(errors))
|
||||||
|
@ -422,7 +422,7 @@ class TestValidateReleases(base.BaseTestCase):
|
|||||||
def test_check_release_jobs(self, check_jobs):
|
def test_check_release_jobs(self, check_jobs):
|
||||||
deliverable_info = {
|
deliverable_info = {
|
||||||
'releases': [
|
'releases': [
|
||||||
{'version': '1.5.0',
|
{'version': '99.5.0',
|
||||||
'projects': [
|
'projects': [
|
||||||
{'repo': 'openstack/automaton',
|
{'repo': 'openstack/automaton',
|
||||||
'hash': 'be2885f544637e6ee6139df7dc7bf937925804dd'},
|
'hash': 'be2885f544637e6ee6139df7dc7bf937925804dd'},
|
||||||
|
@ -35,6 +35,8 @@ _VALIDATORS = {'std': (pbr.version.SemanticVersion.from_pip_string,
|
|||||||
}
|
}
|
||||||
_VALIDATORS['fuel'] = _VALIDATORS['std']
|
_VALIDATORS['fuel'] = _VALIDATORS['std']
|
||||||
_VALIDATORS['openstack-manuals'] = _VALIDATORS['std']
|
_VALIDATORS['openstack-manuals'] = _VALIDATORS['std']
|
||||||
|
_VALIDATORS['puppet'] = _VALIDATORS['std']
|
||||||
|
_VALIDATORS['nodejs'] = _VALIDATORS['std']
|
||||||
|
|
||||||
|
|
||||||
def validate_version(versionstr, release_type='std', pre_ok=True):
|
def validate_version(versionstr, release_type='std', pre_ok=True):
|
||||||
|
Loading…
Reference in New Issue
Block a user