Jenkin Gerrit JJB: различия между версиями

Материал из noname.com.ua
Перейти к навигацииПерейти к поиску
Строка 32: Строка 32:
   
 
=Create repo in gerrit=
 
=Create repo in gerrit=
  +
Create project, which inherits all permission:
  +
<BR>
  +
[[Изображение:Jjb1.png|600px]]
  +
<BR>
   
 
=Install, configure and test JJB=
 
=Install, configure and test JJB=

Версия 15:09, 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

Create project, which inherits all permission:
Jjb1.png

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