simplify automate jjb definition using releng_macro
[releng.git] / jjb / releng / testresults-automate.yml
1 ---
2 - project:
3     name: testresults-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     publishers:
50       - email:
51           recipients: serena.feng.711@gmail.com
52           notify-every-unstable-build: true
53           send-to-individuals: true
54
55 - job-template:
56     name: '{module}-verify-{stream}'
57
58     parameters:
59       - project-parameter:
60           project: '{project}'
61           branch: '{branch}'
62       - 'opnfv-build-ubuntu-defaults'
63
64     scm:
65       - git-scm-gerrit
66
67     triggers:
68       - gerrit-trigger-patchset-created:
69           server: 'gerrit.opnfv.org'
70           project: '**'
71           branch: '{branch}'
72           files: '{module}/**'
73
74     builders:
75       - shell: |
76           cd {module}/
77           tox
78           if [ -e *.xml ];then
79               cp *.xml $WORKSPACE
80           fi
81
82     publishers:
83       - publish-coverage
84       - email-jenkins-admins-on-failure
85
86 - job-template:
87     name: '{module}-automate-{stream}'
88
89     project-type: multijob
90
91     properties:
92       - throttle:
93           enabled: true
94           max-total: 1
95           max-per-node: 1
96           option: 'project'
97
98     parameters:
99       - project-parameter:
100           project: '{project}'
101           branch: '{branch}'
102       - string:
103           name: DOCKER_TAG
104           default: 'latest'
105           description: 'Tag name for {module} docker image'
106       - string:
107           name: MODULE_NAME
108           default: '{module}'
109           description: "Name of the module"
110       - 'opnfv-build-defaults'
111
112     scm:
113       - git-scm
114
115     wrappers:
116       - ssh-agent-wrapper
117       - timeout:
118           timeout: 360
119           fail: true
120
121     triggers:
122       - gerrit-trigger-change-merged:
123           project: '**'
124           branch: '{branch}'
125           files: '{module}/**'
126
127     builders:
128       - description-setter:
129           description: "Built on $NODE_NAME"
130       - docker-update
131       - multijob:
132           name: docker-deploy
133           condition: SUCCESSFUL
134           projects:
135             - name: '{module}-automate-docker-deploy-{stream}'
136               current-parameters: false
137               predefined-parameters: |
138                 GIT_BASE=$GIT_BASE
139               node-label-name: SLAVE_LABEL
140               node-label: testresults
141               kill-phase-on: FAILURE
142               abort-all-job: true
143       - multijob:
144           name: generate-doc
145           condition: SUCCESSFUL
146           projects:
147             - name: '{module}-automate-generate-doc-{stream}'
148               current-parameters: true
149               kill-phase-on: FAILURE
150               abort-all-job: true
151
152     publishers:
153       - 'email-publisher'
154       - email-jenkins-admins-on-failure
155
156 - job-template:
157     name: '{module}-automate-{phase}-{stream}'
158
159     properties:
160       - throttle:
161           enabled: true
162           max-per-node: 1
163           option: 'project'
164
165     parameters:
166       - project-parameter:
167           project: '{project}'
168           branch: '{branch}'
169
170     wrappers:
171       - ssh-agent-wrapper
172       - timeout:
173           timeout: 120
174           fail: true
175
176     scm:
177       - git-scm
178
179     builders:
180       - description-setter:
181           description: "Built on $NODE_NAME"
182       - '{module}-automate-{phase}-macro'
183
184 ################################
185 # job builders
186 ################################
187 - builder:
188     name: 'docker-update'
189     builders:
190       - shell: |
191           bash ./ci/docker-update.sh
192
193 - builder:
194     name: 'testapi-automate-generate-doc-macro'
195     builders:
196       - 'testapi-doc-build'
197       - 'upload-doc-artifact'
198
199 - builder:
200     name: 'testapi-doc-build'
201     builders:
202       - shell: |
203           bash ./ci/htmlize/doc-build.sh
204
205 - builder:
206     name: 'upload-doc-artifact'
207     builders:
208       - shell: |
209            bash ./ci/htmlize/push-doc-artifacts.sh
210
211 - builder:
212     name: 'reporting-automate-generate-doc-macro'
213     builders:
214       - shell: echo "To Be Done"
215
216 - builder:
217     name: 'testapi-automate-docker-deploy-macro'
218     builders:
219       - shell: |
220           sudo bash ./ci/docker-deploy.sh "sudo docker run -dti --name testapi -p 8082:8000
221           -e mongodb_url=mongodb://172.17.0.1:27017
222           -e base_url=http://testresults.opnfv.org/test opnfv/testapi" \
223           "http://testresults.opnfv.org/test/" "testapi"
224
225 - builder:
226     name: 'reporting-automate-docker-deploy-macro'
227     builders:
228       - shell: |
229           sudo bash ./ci/docker-deploy.sh \
230           "sudo docker run -itd --name reporting -p 8084:8000 opnfv/reporting" \
231           "http://testresults.opnfv.org/reporting/index.html" "reporting"
232
233 - builder:
234     name: mongodb-backup
235     builders:
236       - shell:
237           bash ./ci/testapi-backup-mongodb.sh
238
239 ################################
240 # job publishers
241 ################################
242
243 - publisher:
244     name: 'email-publisher'
245     publishers:
246       - email:
247           recipients: rohitsakala@gmail.com feng.xiaowei@zte.com.cn morgan.richomme@orange.com
248           notify-every-unstable-build: false
249           send-to-individuals: true