This repo holds configs for jenkins jobs and some useful tools.
set server name to operate with
server_name="example"
Copy config and replace server address, user and password with your own
cp "./conf/jenkins_job.ini.example" "./${server_name}.ini"
test all (useful for testing changes in commons)
tox
test just configs for particular instance
tox -e "${server_name}"
Note: tox should be installed globally
To compare output of changed yaml configs you need to render xmls.
Let's say we are going to change something in ${pr_branch}
For existing branch
# activate venv used in test with right version of tools
source "./.tox/${server_name}/bin/activate"
# switch to current revision
git checkout master
git pull
# render current xmls
jenkins-jobs --conf "./${server_name}.ini" test "servers/${server_name}/:common" -o "./out-for-master"
# switch to existing pr/changed revision
git checkout "${pr_branch}"
git pull
or to create new branch
git checkout -b "${pr_branch}"
# .. and do some changes
# render new xmls
jenkins-jobs --conf "./${server_name}.ini" test "servers/${server_name}/:common" -o "./out-for-${pr_branch}"
# compare with diff tool
diff -r "./out-for-master" "./out-for-${pr_branch}"
Note:
>
sign means that change came from./out-for-${pr_branch}
<
sign means that change came from./out-for-master
# activate venv used in test with right version of tools
source "./.tox/${server_name}/bin/activate"
# update all jobs on server
# this will not delete any job if it is not presented in configs
jenkins-jobs --conf "./${server_name}.ini" update "servers/${server_name}/:common"
# update jobs by pattern (note single quotes):
jenkins-jobs --conf "./${server_name}.ini" update "servers/${server_name}/:common" 'ABC-*'
# deactivate venv when finished
deactivate
# activate venv used in test with right version of tools
source "./.tox/${server_name}/bin/activate"
# this will delete job on server
jenkins-jobs --conf "./${server_name}.ini" delete "name-of-job-to-remove"
# deactivate venv when finished
deactivate
For details, examples and contribution guides see library and samples fuel_infra/jenkins_jobs repo, and especially guidelines section.
Documentation for Jenkins Job Builder could be found on docs.openstack.org