only validate releases that have not yet been tagged

Change validate_releases() so that most of the rules are only applied
to a repository if it has not been tagged with the new tag value,
yet. This significantly speeds up the job.

Change-Id: I5f2ded1b2788d55d787027e0cc0bc93714ebfafc
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2018-02-05 16:12:53 -05:00
parent 1951c5d727
commit f570dec981

View File

@ -504,6 +504,31 @@ def validate_releases(deliverable_info, zuul_projects,
project['hash'], mk_error):
continue
# Report if the version has already been
# tagged. We expect it to not exist, but neither
# case is an error because sometimes we want to
# import history and sometimes we want to make new
# releases.
version_exists = gitutils.commit_exists(
workdir, project['repo'], release['version'],
)
if version_exists:
actual_sha = gitutils.sha_for_tag(
workdir,
project['repo'],
release['version'],
)
if actual_sha != project['hash']:
mk_error(
('Version %s in %s is on '
'commit %s instead of %s') %
(release['version'],
project['repo'],
actual_sha,
project['hash']))
print('tag exists, skipping further validation')
continue
# Report if the SHA exists or not (an error if it
# does not).
sha_exists = gitutils.commit_exists(
@ -516,11 +541,6 @@ def validate_releases(deliverable_info, zuul_projects,
# doesn't exist.
continue
# Check the presence of tag in the references
version_exists = gitutils.commit_exists(
workdir, project['repo'], release['version'],
)
# Check that the sdist name and tarball-base name match.
if link_mode == 'tarball':
try:
@ -554,26 +574,6 @@ def validate_releases(deliverable_info, zuul_projects,
% (project['repo'], release['version'],
action, expected, sdist))
# Report if the version has already been
# tagged. We expect it to not exist, but neither
# case is an error because sometimes we want to
# import history and sometimes we want to make new
# releases.
if version_exists:
actual_sha = gitutils.sha_for_tag(
workdir,
project['repo'],
release['version'],
)
if actual_sha != project['hash']:
mk_error(
('Version %s in %s is on '
'commit %s instead of %s') %
(release['version'],
project['repo'],
actual_sha,
project['hash']))
else:
print('Found new version {} for {}'.format(
release['version'], project['repo']))
new_releases[release['version']] = release