c792a63d020c2157a60743cc65fb571b63790a83
[releng.git] / jjb / cperf / cperf-ci-jobs.yaml
1 ---
2 ###################################
3 # job configuration for cperf
4 ###################################
5 - project:
6     name: cperf-ci-jobs
7     project: cperf
8
9     # -------------------------------
10     # BRANCH ANCHORS
11     # -------------------------------
12     stream: master
13     branch: '{stream}'
14     gs-pathname: ''
15     docker-tag: 'latest'
16
17     installer: apex
18
19     testsuite:
20       - csit
21       - cbench
22
23     jobs:
24       - 'cperf-{installer}-{testsuite}-{stream}'
25       - 'cperf-upload-logs-csit'
26
27 ################################
28 # job template
29 ################################
30 - job-template:
31     name: 'cperf-{installer}-{testsuite}-{stream}'
32
33     concurrent: true
34
35     properties:
36       - throttle:
37           enabled: true
38           max-per-node: 1
39           option: 'project'
40
41     wrappers:
42       - build-name:
43           name: '$BUILD_NUMBER Suite: $CPERF_SUITE_NAME ODL BRANCH: $ODL_BRANCH'
44       - timeout:
45           timeout: 400
46           abort: true
47
48     parameters:
49       - cperf-parameter:
50           testsuite: '{testsuite}'
51           gs-pathname: '{gs-pathname}'
52           docker-tag: '{docker-tag}'
53           stream: '{stream}'
54
55     builders:
56       - 'cperf-{testsuite}-builder'
57
58 - job-template:
59     name: 'cperf-upload-logs-csit'
60
61     concurrent: true
62
63     disabled: false
64     scm:
65       - git-scm-gerrit
66     parameters:
67       - project-parameter:
68           project: '{project}'
69           branch: '{branch}'
70       - cperf-parameter:
71           testsuite: 'csit'
72           gs-pathname: '{gs-pathname}'
73           docker-tag: '{docker-tag}'
74           stream: '{stream}'
75
76     # yamllint enable rule:line-length
77     properties:
78       - logrotate-default
79       - throttle:
80           max-per-node: 1
81           max-total: 10
82           option: 'project'
83
84     builders:
85       - 'cperf-upload-logs-csit'
86
87 ########################
88 # parameter macros
89 ########################
90 - parameter:
91     name: cperf-parameter
92     parameters:
93       - string:
94           name: CPERF_SUITE_NAME
95           default: '{testsuite}'
96           description: "Suite name to run"
97       - string:
98           name: ODL_BRANCH
99           default: 'master'
100           description: "Branch that OpenDaylight is running"
101       - string:
102           name: OS_VERSION
103           default: 'master'
104           description: "OpenStack version (short name, no stable/ prefix)"
105       - string:
106           name: GS_PATHNAME
107           default: '{gs-pathname}'
108           description: "Version directory where the opnfv documents will be stored in gs repository"
109       - string:
110           name: CI_DEBUG
111           default: 'false'
112           description: "Show debug output information"
113       - string:
114           name: DOCKER_TAG
115           default: '{docker-tag}'
116           description: 'Tag to pull docker image'
117       - string:
118           name: RC_FILE_PATH
119           default: ''
120           description: "Path to the OS credentials file if given"
121       - string:
122           name: SSH_KEY_PATH
123           default: ''
124           description: "Path to the private SSH key to access OPNFV nodes"
125       - string:
126           name: NODE_FILE_PATH
127           default: ''
128           description: "Path to the yaml file describing overcloud nodes"
129       - string:
130           name: ODL_CONTAINERIZED
131           default: 'true'
132           description: "boolean set true if ODL on overcloud is a container"
133
134 ########################
135 # trigger macros
136 ########################
137
138 ########################
139 # builder macros
140 ########################
141 - builder:
142     name: cperf-csit-builder
143     builders:
144       - 'cperf-cleanup'
145       - 'cperf-prepare-robot'
146       - 'cperf-robot-netvirt-csit'
147
148 - builder:
149     name: cperf-cbench-builder
150     builders:
151       - 'cperf-cleanup'
152       - 'cperf-prepare-robot'
153       - 'cperf-robot-cbench'
154
155 - builder:
156     name: cperf-prepare-robot
157     builders:
158       - shell:
159           !include-raw: ./cperf-prepare-robot.sh
160
161 - builder:
162     name: cperf-robot-cbench
163     builders:
164       - shell: |
165           #!/bin/bash
166           set -o errexit
167           set -o nounset
168           set -o pipefail
169
170           # cbench requires the openflow drop test feature to be installed.
171           sshpass -p karaf ssh -o StrictHostKeyChecking=no \
172                                -o UserKnownHostsFile=/dev/null \
173                                -o LogLevel=error \
174                                -p 8101 karaf@$SDN_CONTROLLER_IP \
175                                 feature:install odl-openflowplugin-flow-services-ui odl-openflowplugin-drop-test
176
177           robot_cmd="pybot -e exclude -L TRACE -d /tmp \
178                       -v ODL_SYSTEM_1_IP:${SDN_CONTROLLER_IP} \
179                       -v ODL_SYSTEM_IP:${SDN_CONTROLLER_IP} \
180                       -v BUNDLEFOLDER:/opt/opendaylight \
181                       -v RESTCONFPORT:8081 \
182                       -v USER_HOME:/tmp \
183                       -v USER:heat-admin \
184                       -v ODL_SYSTEM_USER:heat-admin \
185                       -v TOOLS_SYSTEM_IP:localhost \
186                       -v of_port:6653"
187           robot_suite="/home/opnfv/repos/odl_test/csit/suites/openflowplugin/Performance/010_Cbench.robot"
188
189           docker run -i -v /tmp:/tmp opnfv/cperf:$DOCKER_TAG ${robot_cmd} ${robot_suite}
190
191 - builder:
192     name: cperf-robot-netvirt-csit
193     builders:
194       - shell:
195           !include-raw: ./cperf-robot-netvirt-csit.sh
196
197 - builder:
198     name: cperf-cleanup
199     builders:
200       - shell: |
201           #!/bin/bash
202           [[ $CI_DEBUG == true ]] && redirect="/dev/stdout" || redirect="/dev/null"
203
204           echo "Cleaning up docker containers/images..."
205           # Remove previous running containers if exist
206           if [[ ! -z $(docker ps -a | grep opnfv/cperf) ]]; then
207               echo "Removing existing opnfv/cperf containers..."
208               docker ps -a | grep opnfv/cperf | awk '{print $1}' | xargs docker rm -f >${redirect}
209           fi
210
211           # Remove existing images if exist
212           if [[ ! -z $(docker images | grep opnfv/cperf) ]]; then
213               echo "Docker images to remove:"
214               docker images | head -1 && docker images | grep opnfv/cperf >${redirect}
215               image_tags=($(docker images | grep opnfv/cperf | awk '{print $2}'))
216               for tag in "${image_tags[@]}"; do
217                   echo "Removing docker image opnfv/cperf:$tag..."
218                   docker rmi opnfv/cperf:$tag >/dev/null
219               done
220           fi
221
222 - builder:
223     name: cperf-upload-logs-csit
224     builders:
225       - shell: !include-raw: ./cperf-upload-logs-csit.sh