Jenkin Gerrit JJB: различия между версиями
Материал из noname.com.ua
Перейти к навигацииПерейти к поискуSirmax (обсуждение | вклад) (Новая страница: «Категория:Linux Категория:CICD Категория:Jenkins Категория:Gerrit») |
Sirmax (обсуждение | вклад) |
||
Строка 3: | Строка 3: | ||
[[Категория:Jenkins]] |
[[Категория:Jenkins]] |
||
[[Категория:Gerrit]] |
[[Категория:Gerrit]] |
||
+ | =Integration= |
||
+ | |||
+ | |||
+ | Before start development, we need to configure Jenkins.<BR> |
||
+ | |||
+ | <BR> |
||
+ | 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. |
||
+ | <BR> |
||
+ | It also has a flexible template system, so creating many similarly configured jobs is easy. |
||
+ | |||
+ | <BR> |
||
+ | |||
+ | 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= |
||
+ | |||
+ | =Install, configure and test JJB= |
||
+ | ==Install== |
||
+ | * Install pip and libs: |
||
+ | <PRE> |
||
+ | apt-get install python-pip python-yaml |
||
+ | </PRE> |
||
+ | <PRE> |
||
+ | pip install PyYAML python-jenkins |
||
+ | </PRE> |
||
+ | * Install JJB |
||
+ | <PRE> |
||
+ | git clone https://git.openstack.org/openstack-infra/jenkins-job-builder |
||
+ | cd jenkins-job-builder/ |
||
+ | python setup.py install |
||
+ | </PRE> |
||
+ | |||
+ | * Now JJB is installed |
||
+ | <PRE> |
||
+ | # 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 |
||
+ | </PRE> |
Версия 14:03, 25 марта 2016
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
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