Use bash in yardstick execute shells of verify and merge jobs
[releng.git] / jjb / yardstick / yardstick.yml
1 - project:
2     name: yardstick
3     jobs:
4         - 'yardstick-{pod}'
5         - 'yardstick-daily-{stream}'
6         - 'yardstick-merge'
7         - 'yardstick-verify'
8
9     pod:
10         - opnfv-jump-1:
11             node: 'opnfv-jump-1'
12             installer_type: 'fuel'
13             installer_ip: '10.20.0.2'
14         - opnfv-jump-2:
15             node: 'opnfv-jump-2'
16             installer_type: 'foreman'
17             installer_ip: '172.30.10.73'
18
19     # stream:    branch with - in place of / (eg. stable-helium)
20     # branch:    branch (eg. stable/helium)
21     stream:
22         - master:
23             branch: 'master'
24
25     project: 'yardstick'
26     somevar: 'foo'
27
28 - job-template:
29     name: 'yardstick-daily-{stream}'
30
31     # Job template for daily builders
32     #
33     # Required Variables:
34     #     stream:    branch with - in place of / (eg. stable)
35     #     branch:    branch (eg. stable)
36
37     node: ericsson-build
38
39     project-type: freestyle
40     varsetabove: '{somevar}'
41
42     logrotate:
43         daysToKeep: '{build-days-to-keep}'
44         numToKeep: '{build-num-to-keep}'
45         artifactDaysToKeep: '{build-artifact-days-to-keep}'
46         artifactNumToKeep: '{build-artifact-num-to-keep}'
47
48     parameters:
49         - project-parameter:
50             project: '{project}'
51         - string:
52             name: GIT_BASE
53             default: https://gerrit.opnfv.org/gerrit/$PROJECT
54             description: "Used for overriding the GIT URL coming from Global Jenkins configuration in case if the stuff is done on none-LF HW."
55
56     scm:
57         - git-scm:
58             credentials-id: '{ssh-credentials}'
59             refspec: ''
60             branch: '{branch}'
61
62     wrappers:
63         - ssh-agent-credentials:
64             user: '{ssh-credentials}'
65
66     triggers:
67         - timed: 'H H * * *'
68
69     prebuilders:
70         - test-macro
71
72     builders:
73         - shell: |
74             pwd
75             find .
76             echo "Hello world from yardstick {somevar} daily"
77
78     postbuilders:
79         - test-macro
80
81 - job-template:
82     name: 'yardstick-verify'
83
84     project-type: freestyle
85
86     node: ericsson-build
87
88     logrotate:
89         daysToKeep: 30
90         numToKeep: 10
91         artifactDaysToKeep: -1
92         artifactNumToKeep: -1
93
94     parameters:
95         - project-parameter:
96             project: '{project}'
97         - gerrit-parameter:
98             branch: 'master'
99         - string:
100             name: GIT_BASE
101             default: https://gerrit.opnfv.org/gerrit/$PROJECT
102             description: "Used for overriding the GIT URL coming from Global Jenkins configuration in case if the stuff is done on none-LF HW."
103
104     scm:
105         - gerrit-trigger-scm:
106             credentials-id: '{ssh-credentials}'
107             refspec: '$GERRIT_REFSPEC'
108             choosing-strategy: 'gerrit'
109
110     wrappers:
111         - ssh-agent-credentials:
112             user: '{ssh-credentials}'
113
114     triggers:
115         - gerrit:
116             trigger-on:
117                 - patchset-created-event:
118                     exclude-drafts: 'false'
119                     exclude-trivial-rebase: 'false'
120                     exclude-no-code-change: 'false'
121                 - draft-published-event
122                 - comment-added-contains-event:
123                     comment-contains-value: 'recheck'
124                 - comment-added-contains-event:
125                     comment-contains-value: 'reverify'
126             projects:
127               - project-compare-type: 'ANT'
128                 project-pattern: 'yardstick'
129                 branches:
130                   - branch-compare-type: 'ANT'
131                     branch-pattern: '**/master'
132
133     builders:
134         - shell: |
135             #!/bin/bash
136
137             echo "Running unit tests..."
138             cd $WORKSPACE
139             virtualenv $WORKSPACE/yardstick_venv
140             source $WORKSPACE/yardstick_venv/bin/activate
141             python setup.py develop > /dev/null 2>&1
142             ./run_tests.sh
143             deactivate
144
145 - job-template:
146     name: 'yardstick-merge'
147
148     # builder-merge job to run JJB update
149     #
150     # This job's purpose is to update all the JJB
151
152     project-type: freestyle
153
154     node: ericsson-build
155
156     logrotate:
157         daysToKeep: 30
158         numToKeep: 40
159         artifactDaysToKeep: -1
160         artifactNumToKeep: 5
161
162     parameters:
163         - project-parameter:
164             project: '{project}'
165         - gerrit-parameter:
166             branch: 'master'
167         - string:
168             name: GIT_BASE
169             default: https://gerrit.opnfv.org/gerrit/$PROJECT
170             description: "Used for overriding the GIT URL coming from Global Jenkins configuration in case if the stuff is done on none-LF HW."
171
172     scm:
173         - gerrit-trigger-scm:
174             credentials-id: '{ssh-credentials}'
175             refspec: ''
176             choosing-strategy: 'default'
177
178     wrappers:
179         - ssh-agent-credentials:
180             user: '{ssh-credentials}'
181
182     triggers:
183         - gerrit:
184             trigger-on:
185                 - change-merged-event
186                 - comment-added-contains-event:
187                     comment-contains-value: 'remerge'
188             projects:
189               - project-compare-type: 'ANT'
190                 project-pattern: 'yardstick'
191                 branches:
192                     - branch-compare-type: 'ANT'
193                       branch-pattern: '**/master'
194
195     builders:
196         - shell: |
197             #!/bin/bash
198
199             echo "Running unit tests..."
200             cd $WORKSPACE
201             virtualenv $WORKSPACE/yardstick_venv
202             source $WORKSPACE/yardstick_venv/bin/activate
203             python setup.py develop > /dev/null 2>&1
204             ./run_tests.sh
205             deactivate
206
207 - job-template:
208     name: 'yardstick-{pod}'
209
210     project-type: freestyle
211
212     disabled: false
213
214     node: '{node}'
215
216     parameters:
217         - project-parameter:
218             project: '{project}'
219         - string:
220             name: INSTALLER_TYPE
221             default: '{installer_type}'
222             description: "Installer name that is used for deployment."
223         - string:
224             name: INSTALLER_IP
225             default: '{installer_ip}'
226             description: "Installer IP."
227
228     scm:
229         - git-scm:
230             credentials-id: '{ssh-credentials}'
231             refspec: ''
232             branch: master
233
234     logrotate:
235         daysToKeep: 30
236         numToKeep: 10
237         artifactDaysToKeep: -1
238         artifactNumToKeep: -1
239
240     builders:
241         - 'yardstick-fetch-os-creds'
242         - 'yardstick-ping'
243
244 ########################
245 # builder macros
246 ########################
247 - builder:
248     name: yardstick-ping
249     builders:
250         - shell: |
251             #!/bin/bash
252              set -o errexit
253              set -o pipefail
254
255             echo "Yardstick: prepare Yardstick environment"
256
257             # source openstack vars
258             if [[ ! -f $HOME/opnfv-openrc.sh ]]; then
259                 echo "Unable to access file $HOME/opnfv-openrc.sh"
260                 exit 1
261             fi
262             source $HOME/opnfv-openrc.sh
263
264             # check if cirros-0.3.3 image is already available
265             # if not, create the image
266             echo "Yardstick: configure the image"
267             IMAGE_NAME=cirros-0.3.3
268             if [[ ! $(nova image-show $IMAGE_NAME > /dev/null 2>&1) ]]; then
269                 echo "Image $IMAGE_NAME doesn't exist. Creating image $IMAGE_NAME"
270                 glance image-create --name cirros-0.3.3 --is-public true --disk-format qcow2 --container-format bare --file $HOME/yardstick/cirros-0.3.3-x86_64-disk.img
271             else
272                 echo "Image $IMAGE_NAME exists. Proceeding with yardstick."
273             fi
274
275             # set virtualenv
276             echo "Yardstick: setup virtualenv"
277             cd $WORKSPACE
278             virtualenv $WORKSPACE/yardstick_venv
279             source $WORKSPACE/yardstick_venv/bin/activate
280             python setup.py develop > /dev/null 2>&1
281
282             # set virtualenv
283             echo "Yardstick: execute ping scenario"
284             yardstick task start samples/ping.yaml -v -d
285
286             # cleanup
287             echo "Yardstick: cleanup"
288             glance image-delete $IMAGE_NAME
289
290             # done
291             echo "Yardstick: done!"
292
293 - builder:
294     name: yardstick-fetch-os-creds
295     builders:
296         - shell:
297             !include-raw ../../utils/fetch_os_creds.sh