diff --git a/jenkins/modules/jjb_afs/jjb_afs/__init__.py b/jenkins/modules/jjb_afs/jjb_afs/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/jenkins/modules/jjb_afs/jjb_afs/afs.py b/jenkins/modules/jjb_afs/jjb_afs/afs.py new file mode 100644 index 0000000000..4101c576e8 --- /dev/null +++ b/jenkins/modules/jjb_afs/jjb_afs/afs.py @@ -0,0 +1,20 @@ +# Copyright 2016 Red Hat, Inc +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from jenkins_jobs.errors import MissingAttributeError + +def afs_publisher(parser, xml_parent, data): + for attr in ['site', 'source', 'target']: + if attr not in data: + raise MissingAttributeError(attr) diff --git a/jenkins/modules/jjb_afs/setup.py b/jenkins/modules/jjb_afs/setup.py new file mode 100644 index 0000000000..c6d95c42e0 --- /dev/null +++ b/jenkins/modules/jjb_afs/setup.py @@ -0,0 +1,24 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +import setuptools + +setuptools.setup( + name='jjb_afs', + packages=['jjb_afs'], + version='1.0', + entry_points={ + 'jenkins_jobs.publishers': [ + 'afs=jjb_afs.afs:afs_publisher', + ] + }, + ) diff --git a/tools/run-layout.sh b/tools/run-layout.sh deleted file mode 100755 index 042b080d5f..0000000000 --- a/tools/run-layout.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/bash -e - -# Copyright 2013 OpenStack Foundation -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -mkdir -p .test -cd .test - -echo "Setting up .test" -if [ -d zuul ]; then - echo "Updating zuul" - cd zuul; git pull; cd .. -else - echo "Cloning zuul" - git clone https://git.openstack.org/openstack-infra/zuul --depth 1 -fi - -if [ -d jenkins-job-builder ]; then - echo "Updating jenkins-job-builder" - cd jenkins-job-builder; git pull; cd .. -else - echo "Cloning jenkins-job-builder" - git clone https://git.openstack.org/openstack-infra/jenkins-job-builder --depth 1 -fi - -cd jenkins-job-builder -# These are $WORKSPACE/.test/jenkins-job-builder/.test/... -mkdir -p .test/new/config -mkdir -p .test/new/out -cd ../.. - -cp jenkins/jobs/* .test/jenkins-job-builder/.test/new/config -cd .test/jenkins-job-builder -tox -e compare-xml-new - -# Note that the job-list.txt file is also used by -# tools/layout-checks.py, if this file gets changed, we need to adapt -# the test as well. -cd .. -find jenkins-job-builder/.test/new/out/ -printf "%f\n" > job-list.txt - - -cd zuul -tox -e venv -- zuul-server -c etc/zuul.conf-sample -l ../../zuul/layout.yaml -t ../job-list.txt diff --git a/tools/zuul.conf-sample b/tools/zuul.conf-sample new file mode 100644 index 0000000000..d7b8eaeb55 --- /dev/null +++ b/tools/zuul.conf-sample @@ -0,0 +1,45 @@ +[gearman] +server=127.0.0.1 + +[gearman_server] +start=true + +[zuul] +layout_config=/etc/zuul/layout.yaml +log_config=/etc/zuul/logging.conf +pidfile=/var/run/zuul/zuul.pid +state_dir=/var/lib/zuul +status_url=https://jenkins.example.com/zuul/status + +[merger] +git_dir=/var/lib/zuul/git +;git_user_email=zuul@example.com +;git_user_name=zuul +zuul_url=http://zuul.example.com/p + +[swift] +authurl=https://identity.api.example.org/v2.0/ +user=username +key=password + +default_container=logs +region_name=EXP +logserver_prefix=http://logs.example.org/server.app/ + +[webapp] +listen_address=0.0.0.0 +port=8001 + +[connection gerrit] +driver=gerrit +server=review.example.com +;baseurl=https://review.example.com/r +user=jenkins +sshkey=/home/jenkins/.ssh/id_rsa + +[connection smtp] +driver=smtp +server=localhost +port=25 +default_from=zuul@example.com +default_to=you@example.com diff --git a/tox.ini b/tox.ini index e0f1415de1..b6951fce27 100644 --- a/tox.ini +++ b/tox.ini @@ -60,8 +60,9 @@ whitelist_externals = rm commands = rm -rf {envdir}/tmp - mkdir -p {envdir}/tmp - jenkins-jobs -l debug test -o {envdir}/tmp jenkins/jobs + mkdir -p {envdir}/tmp/jobs + pip install -U jenkins/modules/jjb_afs + jenkins-jobs -l debug test -o {envdir}/tmp/jobs jenkins/jobs [testenv:jenkins-project] deps = @@ -72,13 +73,20 @@ commands = [testenv:zuul] basepython = python2.7 -deps = PyYAML +deps = + jenkins-job-builder==1.6.1 + zuul whitelist_externals = rm + jenkins-jobs + find commands = - rm -rf .test/jenkins-job-builder/.test/new/out - {toxinidir}/tools/run-layout.sh - {toxinidir}/tools/layout-checks.py + rm -rf {envdir}/tmp + mkdir -p {envdir}/tmp/jobs + pip install -U jenkins/modules/jjb_afs + jenkins-jobs -l debug test -o {envdir}/tmp/jobs jenkins/jobs + bash -c 'find {envdir}/tmp/jobs -printf "%f\n" > {envdir}/tmp/job-list.txt' + zuul-server -c tools/zuul.conf-sample -l zuul/layout.yaml -t {envdir}/tmp/job-list.txt [testenv:infra-docs] deps =