From: Thanh Ha Date: Wed, 8 Aug 2018 23:27:49 +0000 (-0400) Subject: Test with latest JJB and supported JJB X-Git-Tag: v0.24.0~20 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=775ab31f7fc1d6ce40c3057f5a51ced9cb191267;p=releng%2Fglobal-jjb.git Test with latest JJB and supported JJB Test global-jjb with both the latest version of JJB as well as the global-jjb supported version of JJB. Also include a script to ensure that jjb/lf-ci-jobs.yaml and tox.ini define the same supported versions of JJB. Change-Id: I1a181776c6d0eef1b857ede9099d3ebb8e3ba98d Signed-off-by: Thanh Ha --- diff --git a/check_jjb_version.py b/check_jjb_version.py new file mode 100644 index 00000000..5ab56a61 --- /dev/null +++ b/check_jjb_version.py @@ -0,0 +1,42 @@ +# SPDX-License-Identifier: EPL-1.0 +############################################################################## +# Copyright (c) 2018 The Linux Foundation and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +############################################################################## +"""Ensures that the jjb-version in tox and jjb/lf-ci-jobs.yaml match.""" + +__author__ = 'Thanh Ha' + + +import os +import re +import sys + + +def check_jjb_version(tox_file, releng_jobs_file): + with open(tox_file, 'r') as _file: + for num, line in enumerate(_file, 1): + if re.search('jenkins-job-builder==', line): + jjb_version_tox = line.rsplit('==', 1)[1].strip() + break + + with open(releng_jobs_file, 'r') as _file: + for num, line in enumerate(_file, 1): + if re.search('jjb-version: ', line): + jjb_version = line.rsplit(':', 1)[1].strip() + break + + print('JJB version in jjb/lf-ci-jobs.yaml: {}'.format(jjb_version)) + print('JJB version in tox.ini: {}'.format(jjb_version_tox)) + + if jjb_version != jjb_version_tox: + print('ERROR: JJB version in jjb/lf-ci-jobs.yaml and tox.ini MUST match.') + sys.exit(1) + + +if __name__ == "__main__": + check_jjb_version('tox.ini', os.path.join('jjb', 'lf-ci-jobs.yaml')) diff --git a/tox.ini b/tox.ini index e0e9c69a..1b7d8c3d 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,13 @@ [tox] minversion = 1.6 -envlist = coala,ensure-documented,jjb,jjb-compare-xml,license +envlist = + coala, + ensure-documented, + jjb, + jjb-compare-xml, + jjb-latest, + jjb-version + license skipsdist = true passenv = TOX_WORK_DIR toxworkdir = {env:TOX_WORK_DIR:/tmp/v} @@ -29,7 +36,7 @@ commands = [testenv:jjb] deps = - jenkins-job-builder>=2.0.5 + jenkins-job-builder==2.2.1 commands = jenkins-jobs -l DEBUG test --recursive -o {toxinidir}/archives/job-configs {toxinidir}/jjb:{toxinidir}/.jjb-test @@ -39,6 +46,15 @@ deps = commands = ./jjb-compare-xml.sh +[testenv:jjb-latest] +deps = + jenkins-job-builder +commands = + jenkins-jobs -l DEBUG test --recursive -o {toxinidir}/archives/job-configs {toxinidir}/jjb:{toxinidir}/.jjb-test + +[testenv:jjb-version] +commands = python {toxinidir}/check_jjb_version.py + [testenv:license] deps = lftools commands = lftools license check-dir -r '.+' shell