Update Automation Job Repo to releng-testresults
[releng.git] / jjb / releng / automate.yml
1 ---
2 - project:
3     name: utils-automate
4     stream:
5       - master:
6           branch: '{stream}'
7
8     module:
9       - 'testapi'
10       - 'reporting'
11
12     phase:
13       - 'docker-deploy':
14           slave-label: 'testresults'
15       - 'generate-doc'
16
17     jobs:
18       - '{module}-automate-{stream}'
19       - '{module}-automate-{phase}-{stream}'
20       - '{module}-verify-{stream}'
21
22     project: 'releng-testresults'
23
24 - job:
25     name: 'testapi-mongodb-backup'
26
27     parameters:
28       - label:
29           name: SLAVE_LABEL
30           default: 'testresults'
31           description: 'Slave label on Jenkins'
32       - project-parameter:
33           project: 'releng-testresults'
34           branch: 'master'
35       - string:
36           name: GIT_BASE
37           default: https://gerrit.opnfv.org/gerrit/releng-testresults
38           description: 'Git URL to use on this Jenkins Slave'
39
40     scm:
41       - git-scm
42
43     triggers:
44       - timed: '@weekly'
45
46     builders:
47       - mongodb-backup
48
49 - job-template:
50     name: '{module}-verify-{stream}'
51
52     parameters:
53       - project-parameter:
54           project: '{project}'
55           branch: '{branch}'
56       - 'opnfv-build-ubuntu-defaults'
57
58     scm:
59       - git-scm-gerrit
60
61     triggers:
62       - gerrit:
63           server-name: 'gerrit.opnfv.org'
64           trigger-on:
65             - patchset-created-event:
66                 exclude-drafts: 'false'
67                 exclude-trivial-rebase: 'false'
68                 exclude-no-code-change: 'false'
69             - draft-published-event
70             - comment-added-contains-event:
71                 comment-contains-value: 'recheck'
72             - comment-added-contains-event:
73                 comment-contains-value: 'reverify'
74           projects:
75             - project-compare-type: 'ANT'
76               project-pattern: '{project}'
77               branches:
78                 - branch-compare-type: 'ANT'
79                   branch-pattern: '**/{branch}'
80               file-paths:
81                 - compare-type: 'ANT'
82                   pattern: '{module}/**'
83
84     builders:
85       - shell: |
86           cd {module}/
87           tox
88           if [ -e *.xml ];then
89               cp *.xml $WORKSPACE
90           fi
91
92     publishers:
93       - publish-coverage
94       - email-jenkins-admins-on-failure
95
96 - job-template:
97     name: '{module}-automate-{stream}'
98
99     project-type: multijob
100
101     properties:
102       - throttle:
103           enabled: true
104           max-total: 1
105           max-per-node: 1
106           option: 'project'
107
108     parameters:
109       - project-parameter:
110           project: '{project}'
111           branch: '{branch}'
112       - string:
113           name: DOCKER_TAG
114           default: 'latest'
115           description: 'Tag name for {module} docker image'
116       - string:
117           name: MODULE_NAME
118           default: '{module}'
119           description: "Name of the module"
120       - 'opnfv-build-defaults'
121
122     scm:
123       - git-scm
124
125     wrappers:
126       - ssh-agent-wrapper
127       - timeout:
128           timeout: 360
129           fail: true
130
131     triggers:
132       - gerrit:
133           server-name: 'gerrit.opnfv.org'
134           trigger-on:
135             - change-merged-event
136             - comment-added-contains-event:
137                 comment-contains-value: 'remerge'
138           projects:
139             - project-compare-type: 'ANT'
140               project-pattern: '{project}'
141               branches:
142                 - branch-compare-type: 'ANT'
143                   branch-pattern: '**/{branch}'
144               file-paths:
145                 - compare-type: 'ANT'
146                   pattern: '{module}/**'
147
148     builders:
149       - description-setter:
150           description: "Built on $NODE_NAME"
151       - docker-update
152       - multijob:
153           name: docker-deploy
154           condition: SUCCESSFUL
155           projects:
156             - name: '{module}-automate-docker-deploy-{stream}'
157               current-parameters: false
158               predefined-parameters: |
159                 GIT_BASE=$GIT_BASE
160               node-label-name: SLAVE_LABEL
161               node-label: testresults
162               kill-phase-on: FAILURE
163               abort-all-job: true
164       - multijob:
165           name: generate-doc
166           condition: SUCCESSFUL
167           projects:
168             - name: '{module}-automate-generate-doc-{stream}'
169               current-parameters: true
170               kill-phase-on: FAILURE
171               abort-all-job: true
172
173     publishers:
174       - 'email-publisher'
175       - email-jenkins-admins-on-failure
176
177 - job-template:
178     name: '{module}-automate-{phase}-{stream}'
179
180     properties:
181       - throttle:
182           enabled: true
183           max-per-node: 1
184           option: 'project'
185
186     parameters:
187       - project-parameter:
188           project: '{project}'
189           branch: '{branch}'
190
191     wrappers:
192       - ssh-agent-wrapper
193       - timeout:
194           timeout: 120
195           fail: true
196
197     scm:
198       - git-scm
199
200     builders:
201       - description-setter:
202           description: "Built on $NODE_NAME"
203       - '{module}-automate-{phase}-macro'
204
205 ################################
206 # job builders
207 ################################
208 - builder:
209     name: 'docker-update'
210     builders:
211       - shell: |
212           bash ./ci/docker-update.sh
213
214 - builder:
215     name: 'testapi-automate-generate-doc-macro'
216     builders:
217       - 'testapi-doc-build'
218       - 'upload-doc-artifact'
219
220 - builder:
221     name: 'testapi-doc-build'
222     builders:
223       - shell: |
224           bash ./ci/htmlize/doc-build.sh
225
226 - builder:
227     name: 'upload-doc-artifact'
228     builders:
229       - shell: |
230            bash ./ci/htmlize/push-doc-artifacts.sh
231
232 - builder:
233     name: 'reporting-automate-generate-doc-macro'
234     builders:
235       - shell: echo "To Be Done"
236
237 - builder:
238     name: 'testapi-automate-docker-deploy-macro'
239     builders:
240       - shell: |
241           sudo bash ./ci/docker-deploy.sh "sudo docker run -dti --name testapi -p 8082:8000
242           -e mongodb_url=mongodb://172.17.0.1:27017
243           -e base_url=http://testresults.opnfv.org/test opnfv/testapi" \
244           "http://testresults.opnfv.org/test/" "testapi"
245
246 - builder:
247     name: 'reporting-automate-docker-deploy-macro'
248     builders:
249       - shell: |
250           sudo bash ./ci/docker-deploy.sh \
251           "sudo docker run -itd --name reporting -p 8084:8000 opnfv/reporting" \
252           "http://testresults.opnfv.org/reporting/index.html" "reporting"
253
254 - builder:
255     name: mongodb-backup
256     builders:
257       - shell:
258           bash ./ci/testapi-backup-mongodb.sh
259
260 ################################
261 # job publishers
262 ################################
263
264 - publisher:
265     name: 'email-publisher'
266     publishers:
267       - email:
268           recipients: rohitsakala@gmail.com feng.xiaowei@zte.com.cn morgan.richomme@orange.com
269           notify-every-unstable-build: false
270           send-to-individuals: true