Add console-log validator

We want to check if console-log is used as a publisher, it is the last
publisher defined. This is for zuulv25 specifically as we also use the
console-log publisher to upload our zuul-launcher logs.

Change-Id: I1c987158be13f90e382fcaec8c7d133ed595e177
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2016-06-15 10:48:36 -04:00 committed by Andreas Jaeger
parent 2c7d3579fc
commit 35794c58ac

View File

@ -151,10 +151,30 @@ def validate_jobs():
count += 1
errors = True
# NOTE(pabelanger): Make sure console-log is our last publisher
# defined. We use the publisher to upload logs from zuul-launcher.
result = _check_console_log_publisher(schema, entry)
if result:
print job_file
count += result
errors = True
print ("%d errors found validating YAML files in jenkins/jobs/*.yaml.\n" % count)
return errors
def _check_console_log_publisher(schema, entry):
count = 0
if schema == JOB or schema == JOB_TEMPLATE:
if 'publishers' in entry:
if 'console-log' in entry['publishers'] and \
entry['publishers'][-1] != 'console-log':
print "ERROR: The console-log publisher MUST be the last " \
"publisher in '%s':" % entry['name']
count += 1
return count
def check_all():
errors = validate_jobs()
errors = check_alphabetical() or errors