Add JJB AFS module

This adds a JJB module that validates the parameters we use for
the afs publisher.  This publisher is not an actual Jenkins
publisher and only exists in Zuul v2.5's ansible launcher.  Thus,
it has no XML output and is defined locally in this repo.

This also removes the run-layout script (which used to clone HEAD
of both jjb and zuul) in favor of installing these dependencies
via pip in the tox testenv.  We are no longer tracking JJB master,
so pinning to the version of JJB we are using makes more sense.

Similary, it is not expected that we will need cutting edge
versions of zuul for this test in the immediate future (we may
want to revisit this when we approach zuulv3).

Change-Id: I4acd70c868cb6965d39f968b7582257b4ab21778
This commit is contained in:
James E. Blair 2016-09-27 14:26:49 -07:00
parent 5c48f3af4a
commit a9c6b6f020
6 changed files with 103 additions and 61 deletions

View File

@ -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)

View File

@ -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',
]
},
)

View File

@ -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

45
tools/zuul.conf-sample Normal file
View File

@ -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

20
tox.ini
View File

@ -59,8 +59,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 =
@ -71,13 +72,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 =