d85d14e58e4abf1904d7573f3ceaaa13d38343e2
[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             set -o errexit
137             set -o pipefail
138
139             echo "Running unit tests..."
140             cd $WORKSPACE
141             virtualenv $WORKSPACE/yardstick_venv
142             source $WORKSPACE/yardstick_venv/bin/activate
143             easy_install -U setuptools
144             python setup.py develop
145             ./run_tests.sh
146             deactivate
147
148 - job-template:
149     name: 'yardstick-merge'
150
151     # builder-merge job to run JJB update
152     #
153     # This job's purpose is to update all the JJB
154
155     project-type: freestyle
156
157     node: ericsson-build
158
159     logrotate:
160         daysToKeep: 30
161         numToKeep: 40
162         artifactDaysToKeep: -1
163         artifactNumToKeep: 5
164
165     parameters:
166         - project-parameter:
167             project: '{project}'
168         - gerrit-parameter:
169             branch: 'master'
170         - string:
171             name: GIT_BASE
172             default: https://gerrit.opnfv.org/gerrit/$PROJECT
173             description: "Used for overriding the GIT URL coming from Global Jenkins configuration in case if the stuff is done on none-LF HW."
174
175     scm:
176         - gerrit-trigger-scm:
177             credentials-id: '{ssh-credentials}'
178             refspec: ''
179             choosing-strategy: 'default'
180
181     wrappers:
182         - ssh-agent-credentials:
183             user: '{ssh-credentials}'
184
185     triggers:
186         - gerrit:
187             trigger-on:
188                 - change-merged-event
189                 - comment-added-contains-event:
190                     comment-contains-value: 'remerge'
191             projects:
192               - project-compare-type: 'ANT'
193                 project-pattern: 'yardstick'
194                 branches:
195                     - branch-compare-type: 'ANT'
196                       branch-pattern: '**/master'
197
198     builders:
199         - shell: |
200             #!/bin/bash
201             set -o errexit
202             set -o pipefail
203
204             echo "Running unit tests..."
205             cd $WORKSPACE
206             virtualenv $WORKSPACE/yardstick_venv
207             source $WORKSPACE/yardstick_venv/bin/activate
208             easy_install -U setuptools
209             python setup.py develop
210             ./run_tests.sh
211             deactivate
212
213 - job-template:
214     name: 'yardstick-{pod}'
215
216     project-type: freestyle
217
218     disabled: false
219
220     node: '{node}'
221
222     parameters:
223         - project-parameter:
224             project: '{project}'
225         - string:
226             name: INSTALLER_TYPE
227             default: '{installer_type}'
228             description: "Installer name that is used for deployment."
229         - string:
230             name: INSTALLER_IP
231             default: '{installer_ip}'
232             description: "Installer IP."
233
234     scm:
235         - git-scm:
236             credentials-id: '{ssh-credentials}'
237             refspec: ''
238             branch: master
239
240     logrotate:
241         daysToKeep: 30
242         numToKeep: 10
243         artifactDaysToKeep: -1
244         artifactNumToKeep: -1
245
246     builders:
247         - 'yardstick-fetch-os-creds'
248         - 'yardstick-ping'
249
250 ########################
251 # builder macros
252 ########################
253 - builder:
254     name: yardstick-ping
255     builders:
256         - shell: |
257             #!/bin/bash
258              set -o errexit
259              set -o pipefail
260
261             echo "Yardstick: prepare Yardstick environment"
262
263             # source openstack vars
264             if [[ ! -f $HOME/opnfv-openrc.sh ]]; then
265                 echo "Unable to access file $HOME/opnfv-openrc.sh"
266                 exit 1
267             fi
268             source $HOME/opnfv-openrc.sh
269
270             # check if cirros-0.3.3 image is already available
271             # if not, create the image
272             echo "Yardstick: configure the image"
273             IMAGE_NAME=cirros-0.3.3
274             if [[ ! $(nova image-show $IMAGE_NAME > /dev/null 2>&1) ]]; then
275                 echo "Image $IMAGE_NAME doesn't exist. Creating image $IMAGE_NAME"
276                 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
277             else
278                 echo "Image $IMAGE_NAME exists. Proceeding with yardstick."
279             fi
280
281             # set virtualenv
282             echo "Yardstick: setup virtualenv"
283             cd $WORKSPACE
284             virtualenv $WORKSPACE/yardstick_venv
285             source $WORKSPACE/yardstick_venv/bin/activate
286             python setup.py develop > /dev/null 2>&1
287
288             # set virtualenv
289             echo "Yardstick: execute ping scenario"
290             yardstick task start samples/ping.yaml -v -d
291
292             # cleanup
293             echo "Yardstick: cleanup"
294             glance image-delete $IMAGE_NAME
295
296             # done
297             echo "Yardstick: done!"
298
299 - builder:
300     name: yardstick-fetch-os-creds
301     builders:
302         - shell:
303             !include-raw ../../utils/fetch_os_creds.sh