b6a02dca32f4666a0a6164bdc272cd0da329844d
[releng.git] / jjb / yardstick / yardstick.yml
1 - project:
2     name: yardstick
3
4     project: 'yardstick'
5
6     pod:
7         - lf:
8             node: 'opnfv-jump-2'
9             installer_type: 'fuel'
10             installer_ip: '10.20.0.2'
11         - ericsson:
12             node: 'yardstick-pod'
13             installer_type: 'fuel'
14             installer_ip: '10.20.0.2'
15
16     installer:
17         - fuel
18
19     jobs:
20         - 'yardstick-{installer}-{pod}-{stream}'
21         - 'yardstick-merge'
22         - 'yardstick-verify'
23
24     # stream:    branch with - in place of / (eg. stable-helium)
25     # branch:    branch (eg. stable/helium)
26     stream:
27         - master:
28             branch: 'master'
29
30 - job-template:
31     name: 'yardstick-verify'
32
33     node: ericsson-build
34
35     parameters:
36         - project-parameter:
37             project: '{project}'
38         - gerrit-parameter:
39             branch: 'master'
40         - string:
41             name: GIT_BASE
42             default: https://gerrit.opnfv.org/gerrit/$PROJECT
43             description: "Used for overriding the GIT URL coming from Global Jenkins configuration in case if the stuff is done on none-LF HW."
44
45     scm:
46         - gerrit-trigger-scm:
47             credentials-id: '{ssh-credentials}'
48             refspec: '$GERRIT_REFSPEC'
49             choosing-strategy: 'gerrit'
50
51     triggers:
52         - gerrit:
53             trigger-on:
54                 - patchset-created-event:
55                     exclude-drafts: 'false'
56                     exclude-trivial-rebase: 'false'
57                     exclude-no-code-change: 'false'
58                 - draft-published-event
59                 - comment-added-contains-event:
60                     comment-contains-value: 'recheck'
61                 - comment-added-contains-event:
62                     comment-contains-value: 'reverify'
63             projects:
64               - project-compare-type: 'ANT'
65                 project-pattern: 'yardstick'
66                 branches:
67                   - branch-compare-type: 'ANT'
68                     branch-pattern: '**/master'
69
70     builders:
71         - shell: |
72             #!/bin/bash
73             set -o errexit
74             set -o pipefail
75
76             echo "Running unit tests..."
77             cd $WORKSPACE
78             virtualenv $WORKSPACE/yardstick_venv
79             source $WORKSPACE/yardstick_venv/bin/activate
80             easy_install -U setuptools
81             python setup.py develop
82             ./run_tests.sh
83             deactivate
84
85 - job-template:
86     name: 'yardstick-merge'
87
88     # builder-merge job to run JJB update
89     #
90     # This job's purpose is to update all the JJB
91
92     node: ericsson-build
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: ''
108             choosing-strategy: 'default'
109
110     triggers:
111         - gerrit:
112             trigger-on:
113                 - change-merged-event
114                 - comment-added-contains-event:
115                     comment-contains-value: 'remerge'
116             projects:
117               - project-compare-type: 'ANT'
118                 project-pattern: 'yardstick'
119                 branches:
120                     - branch-compare-type: 'ANT'
121                       branch-pattern: '**/master'
122
123     builders:
124         - shell: |
125             #!/bin/bash
126             set -o errexit
127             set -o pipefail
128
129             echo "Running unit tests..."
130             cd $WORKSPACE
131             virtualenv $WORKSPACE/yardstick_venv
132             source $WORKSPACE/yardstick_venv/bin/activate
133             easy_install -U setuptools
134             python setup.py develop
135             ./run_tests.sh
136             deactivate
137
138 - job-template:
139     name: 'yardstick-{installer}-{pod}-{stream}'
140
141     disabled: false
142
143     node: '{node}'
144
145     parameters:
146         - project-parameter:
147             project: '{project}'
148         - '{pod}-parameters'
149         - string:
150             name: POD_NAME
151             default: '{pod}'
152             description: "POD where the job runs"
153         - string:
154             name: INSTALLER_TYPE
155             default: '{installer_type}'
156             description: "Installer name that is used for deployment."
157         - string:
158             name: INSTALLER_IP
159             default: '{installer_ip}'
160             description: "Installer IP."
161
162     scm:
163         - git-scm:
164             credentials-id: '{ssh-credentials}'
165             refspec: ''
166             branch: master
167
168     triggers:
169         - 'yardstick-trigger-{pod}'
170
171     builders:
172         - 'yardstick-cleanup'
173         - 'yardstick-fetch-os-creds'
174         - 'yardstick-daily'
175
176     publishers:
177         - email:
178             recipients: ana.cunha@ericsson.com jorgen.w.karlsson@ericsson.com
179
180 ########################
181 # builder macros
182 ########################
183 - builder:
184     name: yardstick-daily
185     builders:
186         - shell: |
187             #!/bin/bash
188             set -o errexit
189
190             echo "Yardstick: Run benchmark test suites ..."
191
192             # Pull the latest image
193             docker pull opnfv/yardstick
194
195             # Test suites to run
196             TEST_SUITES=opnfv_${POD_NAME}_daily.yaml
197
198             docker run \
199                --privileged=true \
200                 --rm \
201                 -t \
202                 -e "INSTALLER_TYPE=${INSTALLER_TYPE}" \
203                 -e "INSTALLER_IP=${INSTALLER_IP}" \
204                 -e "POD_NAME=${POD_NAME}" \
205                 -e "EXTERNAL_NETWORK=net04_ext" \
206                 opnfv/yardstick \
207                 run_tests.sh \
208                 $TEST_SUITES
209
210             echo "Yardstick: done!"
211
212 - builder:
213     name: yardstick-fetch-os-creds
214     builders:
215         - shell:
216             !include-raw ../../utils/fetch_os_creds.sh
217
218 - builder:
219     name: yardstick-cleanup
220     builders:
221         - shell: |
222             #!/bin/bash
223
224             echo "Cleaning up docker containers/images..."
225
226             # Remove previous running containers if exist
227             if [[ ! -z $(docker ps -a | grep opnfv/yardstick) ]]; then
228                 echo "Removing existing opnfv/yardstick containers..."
229                 docker ps | grep opnfv/yardstick | awk '{print $1}' | xargs docker stop
230                 docker ps -a | grep opnfv/yardstick | awk '{print $1}' | xargs docker rm
231             fi
232
233             # Remove existing images if exist
234             if [[ ! -z $(docker images | grep opnfv/yardstick) ]]; then
235                 echo "Docker images to remove:"
236                 docker images | head -1 && docker images | grep opnfv/yardstick
237                 image_tags=($(docker images | grep opnfv/yardstick | awk '{print $2}'))
238                 for tag in "${image_tags[@]}"; do
239                     echo "Removing docker image opnfv/yardstick:$tag..."
240                     docker rmi opnfv/yardstick:$tag
241                 done
242             fi
243
244 ########################
245 # parameter macros
246 ########################
247 - parameter:
248     name: 'ericsson-parameters'
249     parameters:
250         - string:
251             name: GIT_BASE
252             default: https://gerrit.opnfv.org/gerrit/$PROJECT
253             description: "Used for overriding the GIT URL coming from Global Jenkins configuration in case if the stuff is done on none-LF HW."
254
255 - parameter:
256     name: 'lf-parameters'
257     parameters:
258         - string:
259             name: GIT_BASE
260             default: ssh://gerrit.opnfv.org:29418/$PROJECT
261             description: "URL for LF POD"
262
263 ########################
264 # trigger macros
265 ########################
266 - trigger:
267     name: 'yardstick-trigger-ericsson'
268     triggers:
269         - timed: '@midnight'
270
271 - trigger:
272     name: 'yardstick-trigger-lf'
273     triggers:
274         - timed: '#@midnight'