Refactor yardstick JJB to prepare for Milestone E
[releng.git] / jjb / yardstick / yardstick-ci-jobs.yml
1 ###################################
2 # job configuration for functest
3 ###################################
4 - project:
5     name: yardstick
6
7     project: '{name}'
8
9 #--------------------------------
10 # BRANCH ANCHORS
11 #--------------------------------
12     master: &master
13         stream: master
14         branch: '{stream}'
15         gs-pathname: ''
16     brahmaputra: &brahmaputra
17         stream: brahmaputra
18         branch: 'stable/{stream}'
19         gs-pathname: '{stream}'
20 #--------------------------------
21 # POD, INSTALLER, AND BRANCH MAPPING
22 #--------------------------------
23 #      Current Mapping
24 #--------------------------------
25 #  everything runs against master branch
26 #--------------------------------
27     pod:
28         - opnfv-jump-2:
29             installer: fuel
30             <<: *master
31         - ericsson-pod1:
32             installer: fuel
33             <<: *master
34         - ericsson-pod2:
35             installer: fuel
36             <<: *master
37         - huawei-us-deploy-bare-1:
38             installer: compass
39             <<: *master
40 #--------------------------------
41 #     Milestone E Mapping
42 #     !!!DO NOT ENABLE!!!
43 #--------------------------------
44 #        brahmaputra
45 #--------------------------------
46 #        - huawei-us-deploy-bare-1:
47 #            installer: compass
48 #            <<: *brahmaputra
49 #        - intel-pod5:
50 #            installer: joid
51 #            <<: *brahmaputra
52 #        - opnfv-jump-1:
53 #            installer: apex
54 #            <<: *brahmaputra
55 #        - opnfv-jump-2:
56 #            installer: fuel
57 #            <<: *brahmaputra
58 #--------------------------------
59 #           master
60 #--------------------------------
61 #        - ericsson-pod1:
62 #            installer: fuel
63 #            <<: *master
64 #        - ericsson-pod2:
65 #            installer: fuel
66 #            <<: *master
67 #--------------------------------
68     loop:
69         - daily
70
71     jobs:
72         - 'yardstick-{installer}-{pod}-{loop}-{stream}'
73
74 ################################
75 # job templates
76 ################################
77 - job-template:
78     name: 'yardstick-{installer}-{pod}-{loop}-{stream}'
79
80     disabled: false
81
82     wrappers:
83         - build-name:
84             name: '$BUILD_NUMBER - SDN: $SDN_CONTROLLER Feature: $OPNFV_FEATURE'
85
86     parameters:
87         - project-parameter:
88             project: '{project}'
89         - '{pod}-defaults'
90         - '{installer}-defaults'
91         - 'yardstick-params-{pod}'
92         - string:
93             name: YARDSTICK_SUITE_NAME
94             default: opnfv_${{NODE_NAME}}_{loop}.yaml
95             description: 'Path to test suite'
96
97     scm:
98         - git-scm:
99             credentials-id: '{ssh-credentials}'
100             refspec: ''
101             branch: '{branch}'
102
103     builders:
104         - 'yardstick-cleanup'
105         - 'yardstick-fetch-os-creds'
106         - 'yardstick-daily'
107
108     publishers:
109         - email:
110             recipients: ana.cunha@ericsson.com jorgen.w.karlsson@ericsson.com
111
112 ########################
113 # builder macros
114 ########################
115 - builder:
116     name: yardstick-daily
117     builders:
118         - shell: |
119             #!/bin/bash
120             set -o errexit
121
122             echo "Yardstick: Run benchmark test suites ..."
123
124             # Pull the latest image
125             docker pull opnfv/yardstick
126
127             docker run \
128                --privileged=true \
129                 --rm \
130                 -t \
131                 -e "INSTALLER_TYPE=${INSTALLER_TYPE}" \
132                 -e "INSTALLER_IP=${INSTALLER_IP}" \
133                 -e "POD_NAME=${NODE_NAME}" \
134                 -e "EXTERNAL_NETWORK=net04_ext" \
135                 opnfv/yardstick \
136                 run_tests.sh \
137                 $YARDSTICK_SUITE_NAME
138
139             echo "Yardstick: done!"
140
141 - builder:
142     name: yardstick-fetch-os-creds
143     builders:
144         - shell:
145             !include-raw ../../utils/fetch_os_creds.sh
146
147 - builder:
148     name: yardstick-cleanup
149     builders:
150         - shell: |
151             #!/bin/bash
152
153             echo "Cleaning up docker containers/images..."
154
155             # Remove previous running containers if exist
156             if [[ ! -z $(docker ps -a | grep opnfv/yardstick) ]]; then
157                 echo "Removing existing opnfv/yardstick containers..."
158                 docker ps | grep opnfv/yardstick | awk '{print $1}' | xargs docker stop
159                 docker ps -a | grep opnfv/yardstick | awk '{print $1}' | xargs docker rm
160             fi
161
162             # Remove existing images if exist
163             if [[ ! -z $(docker images | grep opnfv/yardstick) ]]; then
164                 echo "Docker images to remove:"
165                 docker images | head -1 && docker images | grep opnfv/yardstick
166                 image_tags=($(docker images | grep opnfv/yardstick | awk '{print $2}'))
167                 for tag in "${image_tags[@]}"; do
168                     echo "Removing docker image opnfv/yardstick:$tag..."
169                     docker rmi opnfv/yardstick:$tag
170                 done
171             fi
172 ########################
173 # parameter macros
174 ########################
175 - parameter:
176     name: 'yardstick-params-ericsson-pod1'
177     parameters:
178         - string:
179             name: YARDSTICK_DB_BACKEND
180             default: 'none'
181             description: 'Arguments to use in order to choose the backend DB'
182
183 - parameter:
184     name: 'yardstick-params-ericsson-pod2'
185     parameters:
186         - string:
187             name: YARDSTICK_DB_BACKEND
188             default: 'none'
189             description: 'Arguments to use in order to choose the backend DB'
190
191 - parameter:
192     name: 'yardstick-params-opnfv-jump-2'
193     parameters:
194         - string:
195             name: YARDSTICK_DB_BACKEND
196             default: 'db_args'
197             description: 'Arguments to use in order to choose the backend DB'
198
199 - parameter:
200     name: 'yardstick-params-huawei-us-deploy-bare-1'
201     parameters:
202         - string:
203             name: YARDSTICK_DB_BACKEND
204             default: 'none'
205             description: 'Arguments to use in order to choose the backend DB'