385099dc7db40c419cdc503b8bd0622663d7522c
[releng.git] / jjb / yardstick / yardstick.yml
1 - project:
2     name: yardstick
3
4     installer:
5         - fuel:
6             node: 'opnfv-jump-2'
7             installer_type: 'fuel'
8             installer_ip: '10.20.0.2'
9         - foreman:
10             node: 'opnfv-jump-2'
11             installer_type: 'foreman'
12             installer_ip: '172.30.10.73'
13
14     jobs:
15         - 'yardstick-{installer}-{stream}'
16         - 'yardstick-merge'
17         - 'yardstick-verify'
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         - stable-arno:
25             branch: 'stable/arno'
26             gs-pathname: '/arno'
27
28     project: 'yardstick'
29
30 - job-template:
31     name: 'yardstick-verify'
32
33     project-type: freestyle
34
35     node: ericsson-build
36
37     logrotate:
38         daysToKeep: 30
39         numToKeep: 10
40         artifactDaysToKeep: -1
41         artifactNumToKeep: -1
42
43     parameters:
44         - project-parameter:
45             project: '{project}'
46         - gerrit-parameter:
47             branch: 'master'
48         - string:
49             name: GIT_BASE
50             default: https://gerrit.opnfv.org/gerrit/$PROJECT
51             description: "Used for overriding the GIT URL coming from Global Jenkins configuration in case if the stuff is done on none-LF HW."
52
53     scm:
54         - gerrit-trigger-scm:
55             credentials-id: '{ssh-credentials}'
56             refspec: '$GERRIT_REFSPEC'
57             choosing-strategy: 'gerrit'
58
59     wrappers:
60         - ssh-agent-credentials:
61             user: '{ssh-credentials}'
62
63     triggers:
64         - gerrit:
65             trigger-on:
66                 - patchset-created-event:
67                     exclude-drafts: 'false'
68                     exclude-trivial-rebase: 'false'
69                     exclude-no-code-change: 'false'
70                 - draft-published-event
71                 - comment-added-contains-event:
72                     comment-contains-value: 'recheck'
73                 - comment-added-contains-event:
74                     comment-contains-value: 'reverify'
75             projects:
76               - project-compare-type: 'ANT'
77                 project-pattern: 'yardstick'
78                 branches:
79                   - branch-compare-type: 'ANT'
80                     branch-pattern: '**/master'
81
82     builders:
83         - shell: |
84             #!/bin/bash
85             set -o errexit
86             set -o pipefail
87
88             echo "Running unit tests..."
89             cd $WORKSPACE
90             virtualenv $WORKSPACE/yardstick_venv
91             source $WORKSPACE/yardstick_venv/bin/activate
92             easy_install -U setuptools
93             python setup.py develop
94             ./run_tests.sh
95             deactivate
96
97 - job-template:
98     name: 'yardstick-merge'
99
100     # builder-merge job to run JJB update
101     #
102     # This job's purpose is to update all the JJB
103
104     project-type: freestyle
105
106     node: ericsson-build
107
108     logrotate:
109         daysToKeep: 30
110         numToKeep: 40
111         artifactDaysToKeep: -1
112         artifactNumToKeep: 5
113
114     parameters:
115         - project-parameter:
116             project: '{project}'
117         - gerrit-parameter:
118             branch: 'master'
119         - string:
120             name: GIT_BASE
121             default: https://gerrit.opnfv.org/gerrit/$PROJECT
122             description: "Used for overriding the GIT URL coming from Global Jenkins configuration in case if the stuff is done on none-LF HW."
123
124     scm:
125         - gerrit-trigger-scm:
126             credentials-id: '{ssh-credentials}'
127             refspec: ''
128             choosing-strategy: 'default'
129
130     wrappers:
131         - ssh-agent-credentials:
132             user: '{ssh-credentials}'
133
134     triggers:
135         - gerrit:
136             trigger-on:
137                 - change-merged-event
138                 - comment-added-contains-event:
139                     comment-contains-value: 'remerge'
140             projects:
141               - project-compare-type: 'ANT'
142                 project-pattern: 'yardstick'
143                 branches:
144                     - branch-compare-type: 'ANT'
145                       branch-pattern: '**/master'
146
147     builders:
148         - shell: |
149             #!/bin/bash
150             set -o errexit
151             set -o pipefail
152
153             echo "Running unit tests..."
154             cd $WORKSPACE
155             virtualenv $WORKSPACE/yardstick_venv
156             source $WORKSPACE/yardstick_venv/bin/activate
157             easy_install -U setuptools
158             python setup.py develop
159             ./run_tests.sh
160             deactivate
161
162 - job-template:
163     name: 'yardstick-{installer}-{stream}'
164
165     project-type: freestyle
166
167     disabled: false
168
169     node: '{node}'
170
171     parameters:
172         - project-parameter:
173             project: '{project}'
174         - string:
175             name: INSTALLER_TYPE
176             default: '{installer_type}'
177             description: "Installer name that is used for deployment."
178         - string:
179             name: INSTALLER_IP
180             default: '{installer_ip}'
181             description: "Installer IP."
182
183     scm:
184         - git-scm:
185             credentials-id: '{ssh-credentials}'
186             refspec: ''
187             branch: master
188
189     logrotate:
190         daysToKeep: 30
191         numToKeep: 10
192         artifactDaysToKeep: -1
193         artifactNumToKeep: -1
194
195     builders:
196         - 'yardstick-fetch-os-creds'
197         - 'yardstick-daily'
198
199     publishers:
200         - email:
201             recipients: ana.cunha@ericsson.com
202
203 ########################
204 # builder macros
205 ########################
206 - builder:
207     name: yardstick-daily
208     builders:
209         - shell: |
210             #!/bin/bash
211              set -o errexit
212              set -o pipefail
213
214             echo "Yardstick: prepare Yardstick environment"
215
216             # source openstack vars
217             if [[ ! -f $HOME/opnfv-openrc.sh ]]; then
218                 echo "Unable to access file $HOME/opnfv-openrc.sh"
219                 exit 1
220             fi
221             source $HOME/opnfv-openrc.sh
222
223             # Emergency fix for glance '--is-public' error.
224             # TODO: This should maybe go into openrc instead!?
225             export OS_IMAGE_API_VERSION=1
226
227             # Install required packages. 
228             # 'qemu-nbd' is needed when building the yardstick image. 
229             sudo yum -y install qemu-img
230
231             # set virtualenv
232             echo "Yardstick: setup virtualenv"
233             cd $WORKSPACE
234             virtualenv $WORKSPACE/yardstick_venv
235             source $WORKSPACE/yardstick_venv/bin/activate
236             easy_install -U setuptools
237             python setup.py develop > /dev/null 2>&1
238
239             echo "Yardstick: configure the images"
240             # check if cirros-0.3.3 image is already available
241             # if not, create the image
242             IMAGE_NAMES[0]=cirros-0.3.3
243             if ! nova image-show ${IMAGE_NAMES[0]} > /dev/null 2>&1; then
244                 echo "Image ${IMAGE_NAMES[0]} doesn't exist. Creating image ${IMAGE_NAMES[0]}"
245                 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
246             fi
247
248             # check if yardstick-trusty image is already available
249             # if not, create the image to $WORKSPACE
250             IMAGE_NAMES[1]=yardstick-trusty-server
251             if ! nova image-show ${IMAGE_NAMES[1]} > /dev/null 2>&1; then
252                 echo "Image ${IMAGE_NAMES[1]} doesn't exist. Creating image ${IMAGE_NAMES[1]}"
253                 sudo $(which yardstick-img-modify) $WORKSPACE/tools/ubuntu-server-cloudimg-modify.sh
254                 glance image-create --name yardstick-trusty-server --is-public true --disk-format qcow2 --container-format bare --file $WORKSPACE/yardstick-trusty-server.img
255             fi
256
257             # execute tasks
258             echo "Yardstick: execute scenarios"
259             ./ci/run_tasks.sh
260
261             # cleanup
262             echo "Yardstick: cleanup"
263             for IMAGE_NAME in ${IMAGE_NAMES[@]}
264             do
265                 glance image-delete $IMAGE_NAME
266             done
267
268             # done
269             echo "Yardstick: done!"
270
271 - builder:
272     name: yardstick-fetch-os-creds
273     builders:
274         - shell:
275             !include-raw ../../utils/fetch_os_creds.sh