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