Merge "Add JJB AFS module"

This commit is contained in:
Jenkins 2016-09-28 16:09:58 +00:00 committed by Gerrit Code Review
commit b0274dc63d
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

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