only validate release-type for latest release of a deliverable

This cuts down on the number of redundant error messages when a
deliverable has many releases already.

Change-Id: I23a043a9fb45fef4148531cfea210a4437e4e4cb
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2017-10-26 11:03:21 -04:00
parent 9dbb30dce1
commit a8c3384fcd

View File

@ -374,7 +374,9 @@ def validate_release_type(deliverable_info,
workdir, workdir,
mk_warning, mk_warning,
mk_error): mk_error):
"""Apply validation rules for the deliverable based on 'release-type'. """Apply validation rules for the deliverable based on 'release-type'
to the most recent release of a deliverable.
""" """
link_mode = deliverable_info.get('artifact-link-mode', 'tarball') link_mode = deliverable_info.get('artifact-link-mode', 'tarball')
@ -386,26 +388,26 @@ def validate_release_type(deliverable_info,
print('no releases listed, skipping release-type checks') print('no releases listed, skipping release-type checks')
return return
for release in deliverable_info.get('releases', []): release = deliverable_info['releases'][-1]
for project in release['projects']: for project in release['projects']:
print('checking release-type for {}'.format(project['repo'])) print('checking release-type for {}'.format(project['repo']))
release_type, was_explicit = get_release_type( release_type, was_explicit = get_release_type(
deliverable_info, project, workdir, deliverable_info, project, workdir,
) )
if was_explicit: if was_explicit:
print('found explicit release-type {!r}'.format( print('found explicit release-type {!r}'.format(
release_type)) release_type))
else: else:
print('release-type not given, ' print('release-type not given, '
'guessing {!r}'.format(release_type)) 'guessing {!r}'.format(release_type))
project_config.require_release_jobs_for_repo( project_config.require_release_jobs_for_repo(
deliverable_info, zuul_projects, deliverable_info, zuul_projects,
project['repo'], project['repo'],
release_type, mk_warning, mk_error, release_type, mk_warning, mk_error,
) )
def validate_releases(deliverable_info, zuul_projects, def validate_releases(deliverable_info, zuul_projects,