Adding initial docs, script and logic for releng project
[releng.git] / docs / jenkins-job-builder / opnfv-jjb-usage.rst
1 Creating/Configuring/Verifying Jenkins Jobs
2 ============================================
3
4 Clone the repo::
5
6  git clone ssh://YOU@gerrit.opnfv.org:29418/releng
7
8 make changes::
9
10  git commit -sv
11  git review
12  remote: Resolving deltas: 100% (3/3)
13  remote: Processing changes: new: 1, refs: 1, done
14  remote:
15  remote: New Changes:
16  remote:   https://gerrit.opnfv.org/gerrit/51
17  remote:
18  To ssh://agardner@gerrit.opnfv.org:29418/releng.git
19   * [new branch]      HEAD -> refs/publish/master
20
21 Follow the link to gerrit https://gerrit.opnfv.org/gerrit/51 in a few moments the verify job will have completed and you will see Verified +1 jenkins-ci in the gerrit ui.
22
23 If the changes pass the verify job https://build.opnfv.org/ci/view/builder/job/builder-verify-jjb/ The patch can be submitited by a committer.
24
25 Job Types
26
27 * Verify Job
28
29  * Trigger: **recheck** or **reverify**
30
31 * Merge Job
32
33  * Trigger: **remerge**
34
35 The verify and merge jobs are retriggerable in Gerrit by simply leaving a comment with one of the keywords listed above. This is useful in case you need to re-run one of those jobs in case if build issues or something changed with the environment.
36
37 You can add below persons as reviewers to your patch in order to get it reviewed and submitted.
38
39 * Ulrich Kleber (Ulrich.Kleber@huawei.com)
40 * Fatih Degirmenci (fatih.degirmenci@ericsson.com)
41 * Xinyu Zhao(Jerry) (zhaoxinyu@huawei.com)
42
43 Or just email a request for submission to opnfv-helpdesk@rt.linuxfoundation.org
44
45 The Current merge and verify jobs for jenkins job builder as pulled from the repo::
46
47  - project:
48     name: builder-jobs
49     jobs:
50         - 'builder-verify-jjb'
51         - 'builder-merge'
52
53     project: 'releng'
54
55  - job-template:
56     name: builder-verify-jjb
57
58     project-type: freestyle
59
60     logrotate:
61         daysToKeep: 30
62         numToKeep: 10
63         artifactDaysToKeep: -1
64         artifactNumToKeep: -1
65
66     parameters:
67         - project-parameter:
68             project: '{project}'
69         - gerrit-parameter:
70             branch: 'master'
71     scm:
72         - gerrit-trigger-scm:
73             credentials-id: '{ssh-credentials}'
74             refspec: '$GERRIT_REFSPEC'
75             choosing-strategy: 'gerrit'
76
77     wrappers:
78         - ssh-agent-credentials:
79             user: '{ssh-credentials}'
80
81     triggers:
82         - gerrit:
83             trigger-on:
84                 - patchset-created-event:
85                     exclude-drafts: 'false'
86                     exclude-trivial-rebase: 'false'
87                     exclude-no-code-change: 'false'
88                 - draft-published-event
89                 - comment-added-contains-event:
90                     comment-contains-value: 'recheck'
91                 - comment-added-contains-event:
92                     comment-contains-value: 'reverify'
93             projects:
94               - project-compare-type: 'ANT'
95                 project-pattern: 'releng'
96                 branches:
97                   - branch-compare-type: 'ANT'
98                     branch-pattern: '**/master'
99                 file-paths:
100                     - compare-type: ANT
101                       pattern: jjb/**
102                     - compare-type: ANT
103                       pattern: jjb-templates/**
104
105
106     builders:
107         - shell: |
108             source /opt/virtualenv/jenkins-job-builder/bin/activate
109             jenkins-jobs test /opt/jenkins-ci/builder/
110
111  - job-template:
112     name: 'builder-merge'
113
114     # builder-merge job to run JJB update
115     #
116     # This job's purpose is to update all the JJB
117
118     project-type: freestyle
119
120     logrotate:
121         daysToKeep: 30
122         numToKeep: 40
123         artifactDaysToKeep: -1
124         artifactNumToKeep: 5
125
126     parameters:
127         - project-parameter:
128             project: '{project}'
129         - gerrit-parameter:
130             branch: 'master'
131
132     scm:
133         - gerrit-trigger-scm:
134             credentials-id: '{ssh-credentials}'
135             refspec: ''
136             choosing-strategy: 'default'
137
138     wrappers:
139         - ssh-agent-credentials:
140             user: '{ssh-credentials}'
141
142     triggers:
143         - gerrit:
144             trigger-on:
145                 - change-merged-event
146                 - comment-added-contains-event:
147                     comment-contains-value: 'remerge'
148             projects:
149               - project-compare-type: 'ANT'
150                 project-pattern: 'releng'
151                 branches:
152                     - branch-compare-type: 'ANT'
153                       branch-pattern: '**/master'
154                 file-paths:
155                     - compare-type: ANT
156                       pattern: jjb/**
157
158     builders:
159         - shell: |
160                 source /opt/virtualenv/jenkins-job-builder/bin/activate
161                 cd /opt/jenkins-ci/releng
162                 git pull
163                 jenkins-jobs update --delete-old jjb/
164
165
166
167 **Documentation tracking**
168
169 Revision: _sha1_
170
171 Build date:  _date_