Jenkin Gerrit JJB
Материал из noname.com.ua
Integration
Before start development, we need to configure Jenkins.
Jenkins Job Builder (JJB) takes simple descriptions of Jenkins jobs in YAML or JSON
format and uses them to configure Jenkins. You can keep your job descriptions in human readable text
format in a version control system to make changes and auditing easier.
It also has a flexible template system, so creating many similarly configured jobs is easy.
For our Jenkins jobs we will provide the following workflow:
- User creates JenkinsJob (yaml format)
- User commit job into gerrit cicd-jenkins-job repo and send it to review
- Jenkins trigger detects "review-created" event in gerrit and run syntax check job wich check yaml syntax
- If job success: Voite +1
- If job fails: Voite -1
- In case of "+1" human can review and add +1
- Merge
- Jenkins trigger detects "merge" event in gerrit and run update job
As result, job defined in yaml and commited to repo will be tested and created in Jenkins.
Create repo in gerrit
Create project, which inherits all permission:
Install, configure and test JJB
Install
- Install pip and libs:
apt-get install python-pip python-yaml
pip install PyYAML python-jenkins
- Install JJB
git clone https://git.openstack.org/openstack-infra/jenkins-job-builder cd jenkins-job-builder/ python setup.py install
- Now JJB is installed
# jenkins-jobs usage: jenkins-jobs [-h] [--conf CONF] [-l LOG_LEVEL] [--ignore-cache] [--flush-cache] [--version] [--allow-empty-variables] {update,test,delete,delete-all} ... jenkins-jobs: error: too few arguments