d12ee5d68084234a0aecf7a477c3e0f02cf164ae
[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             tox
87             if [ -e *.xml ];then
88                 cp *.xml $WORKSPACE
89             fi
90
91     publishers:
92         - publish-coverage
93         - email-jenkins-admins-on-failure
94
95 - job-template:
96     name: '{module}-automate-{stream}'
97
98     project-type: multijob
99
100     properties:
101         - throttle:
102             enabled: true
103             max-total: 1
104             max-per-node: 1
105             option: 'project'
106
107     parameters:
108         - project-parameter:
109             project: '{project}'
110             branch: '{branch}'
111         - string:
112             name: DOCKER_TAG
113             default: 'latest'
114             description: 'Tag name for {module} docker image'
115         - string:
116             name: MODULE_NAME
117             default: '{module}'
118             description: "Name of the module"
119         - 'opnfv-build-defaults'
120
121     scm:
122         - git-scm
123
124     wrappers:
125         - ssh-agent-wrapper
126         - timeout:
127             timeout: 360
128             fail: true
129
130     triggers:
131         - gerrit:
132             server-name: 'gerrit.opnfv.org'
133             trigger-on:
134                 - change-merged-event
135                 - comment-added-contains-event:
136                     comment-contains-value: 'remerge'
137             projects:
138               - project-compare-type: 'ANT'
139                 project-pattern: '{project}'
140                 branches:
141                   - branch-compare-type: 'ANT'
142                     branch-pattern: '**/{branch}'
143                 file-paths:
144                   - compare-type: 'ANT'
145                     pattern: 'utils/test/{module}/**'
146
147     builders:
148         - description-setter:
149             description: "Built on $NODE_NAME"
150         - docker-update
151         - multijob:
152             name: docker-deploy
153             condition: SUCCESSFUL
154             projects:
155                 - name: '{module}-automate-docker-deploy-{stream}'
156                   current-parameters: false
157                   predefined-parameters: |
158                     GIT_BASE=$GIT_BASE
159                   node-label-name: SLAVE_LABEL
160                   node-label: testresults
161                   kill-phase-on: FAILURE
162                   abort-all-job: true
163         - multijob:
164             name: generate-doc
165             condition: SUCCESSFUL
166             projects:
167                 - name: '{module}-automate-generate-doc-{stream}'
168                   current-parameters: true
169                   kill-phase-on: FAILURE
170                   abort-all-job: true
171
172     publishers:
173         - 'email-publisher'
174         - email-jenkins-admins-on-failure
175
176 - job-template:
177     name: '{module}-automate-{phase}-{stream}'
178
179     properties:
180         - throttle:
181             enabled: true
182             max-per-node: 1
183             option: 'project'
184
185     parameters:
186         - project-parameter:
187             project: '{project}'
188             branch: '{branch}'
189
190     wrappers:
191         - ssh-agent-wrapper
192         - timeout:
193             timeout: 120
194             fail: true
195
196     scm:
197         - git-scm
198
199     builders:
200         - description-setter:
201             description: "Built on $NODE_NAME"
202         - '{module}-automate-{phase}-macro'
203
204 ################################
205 # job builders
206 ################################
207 - builder:
208     name: 'docker-update'
209     builders:
210         - shell:
211             !include-raw: ./docker-update.sh
212
213 - builder:
214     name: 'testapi-automate-generate-doc-macro'
215     builders:
216         - 'testapi-doc-build'
217         - 'upload-doc-artifact'
218
219 - builder:
220     name: 'testapi-doc-build'
221     builders:
222         - shell: |
223             bash ./utils/test/testapi/htmlize/doc-build.sh
224
225 - builder:
226     name: 'upload-doc-artifact'
227     builders:
228         - shell: |
229             bash ./utils/test/testapi/htmlize/push-doc-artifact.sh
230
231 - builder:
232     name: 'reporting-automate-generate-doc-macro'
233     builders:
234         - shell: echo "To Be Done"
235
236 - builder:
237     name: 'testapi-automate-docker-deploy-macro'
238     builders:
239         - shell: |
240             bash ./jjb/releng/docker-deploy.sh "sudo docker run -dti -p 8082:8000
241             -e mongodb_url=mongodb://172.17.0.1:27017
242             -e base_url=http://testresults.opnfv.org/test opnfv/testapi" \
243             "http://testresults.opnfv.org/test/swagger/APIs" "testapi"
244
245 - builder:
246     name: 'reporting-automate-docker-deploy-macro'
247     builders:
248         - shell: |
249             bash ./jjb/releng/docker-deploy.sh "sudo docker run -itd -p 8084:8000 opnfv/reporting" \
250             "http://testresults.opnfv.org/reporting2/reporting/index.html" "reporting"
251
252 - builder:
253     name: mongodb-backup
254     builders:
255         - shell: |
256             bash ./jjb/releng/testapi-backup-mongodb.sh
257
258 ################################
259 # job publishers
260 ################################
261
262 - publisher:
263     name: 'email-publisher'
264     publishers:
265         - email:
266             recipients: rohitsakala@gmail.com feng.xiaowei@zte.com.cn morgan.richomme@orange.com
267             notify-every-unstable-build: false
268             send-to-individuals: true