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