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