Bugfix: Convert the string list to list
[releng.git] / jjb / bottlenecks / bottlenecks-project-jobs.yml
1 ###################################################
2 # Non-ci jobs for Bottlenecks project
3 # They will only be enabled on request by projects!
4 ###################################################
5 - project:
6     name: bottlenecks-project-jobs
7
8     project: 'bottlenecks'
9
10     jobs:
11         - 'bottlenecks-verify-{stream}'
12         - 'bottlenecks-merge-{stream}'
13         - 'bottlenecks-{suite}-upload-artifacts-{stream}'
14
15     stream:
16         - master:
17             branch: '{stream}'
18             #This is used for common project file storage
19             gs-pathname: ''
20             #This is used for different test suite dependent packages storage
21             gs-packagepath: '/{suite}'
22             disabled: false
23         - danube:
24             branch: 'stable/{stream}'
25             gs-pathname: '/{stream}'
26             gs-packagepath: '/{stream}/{suite}'
27             disabled: false
28
29     suite:
30         - 'rubbos'
31         - 'vstf'
32         - 'posca_stress_traffic'
33         - 'posca_stress_ping'
34
35 ################################
36 # job templates
37 ################################
38
39 - job-template:
40     name: 'bottlenecks-verify-{stream}'
41
42     disabled: '{obj:disabled}'
43
44     parameters:
45         - project-parameter:
46             project: '{project}'
47             branch: '{branch}'
48         - 'opnfv-build-ubuntu-defaults'
49
50     scm:
51         - git-scm-gerrit
52
53     triggers:
54         - gerrit:
55             server-name: 'gerrit.opnfv.org'
56             trigger-on:
57                 - patchset-created-event:
58                     exclude-drafts: 'false'
59                     exclude-trivial-rebase: 'false'
60                     exclude-no-code-change: 'false'
61                 - draft-published-event
62                 - comment-added-contains-event:
63                     comment-contains-value: 'recheck'
64                 - comment-added-contains-event:
65                     comment-contains-value: 'reverify'
66             projects:
67               - project-compare-type: 'ANT'
68                 project-pattern: '{project}'
69                 branches:
70                   - branch-compare-type: 'ANT'
71                     branch-pattern: '**/{branch}'
72     builders:
73         - bottlenecks-hello
74         #- bottlenecks-unit-tests
75
76 - job-template:
77     name: 'bottlenecks-merge-{stream}'
78
79     disabled: '{obj:disabled}'
80
81     parameters:
82         - project-parameter:
83             project: '{project}'
84             branch: '{branch}'
85         - 'opnfv-build-ubuntu-defaults'
86
87     scm:
88         - git-scm
89
90     triggers:
91         - gerrit:
92             server-name: 'gerrit.opnfv.org'
93             trigger-on:
94                 - change-merged-event
95                 - comment-added-contains-event:
96                     comment-contains-value: 'remerge'
97             projects:
98               - project-compare-type: 'ANT'
99                 project-pattern: '{project}'
100                 branches:
101                     - branch-compare-type: 'ANT'
102                       branch-pattern: '**/{branch}'
103
104     builders:
105         - bottlenecks-hello
106         #- bottlenecks-unit-tests
107
108 - job-template:
109     name: 'bottlenecks-{suite}-upload-artifacts-{stream}'
110
111
112     disabled: '{obj:disabled}'
113
114     concurrent: true
115
116     properties:
117         - logrotate-default
118         - throttle:
119             enabled: true
120             max-total: 1
121             max-per-node: 1
122             option: 'project'
123
124     parameters:
125         - project-parameter:
126             project: '{project}'
127             branch: '{branch}'
128         - 'opnfv-build-ubuntu-defaults'
129         - bottlenecks-parameter:
130             gs-packagepath: '{gs-packagepath}'
131
132     scm:
133         - git-scm
134
135     builders:
136         - 'bottlenecks-builder-upload-artifact'
137         - 'bottlenecks-workspace-cleanup'
138
139 ####################
140 # parameter macros
141 ####################
142 - parameter:
143     name: bottlenecks-parameter
144     parameters:
145         - string:
146            name: CACHE_DIR
147            default: $WORKSPACE/cache{gs-packagepath}
148            description: "the cache to store packages downloaded from public IP"
149         - string:
150            name: SUITE_URL
151            default: gs://artifacts.opnfv.org/bottlenecks{gs-packagepath}
152            description: "LF artifacts url for storage of bottlenecks packages"
153         - string:
154            name: PACKAGE_URL
155            default: http://205.177.226.237:9999/bottlenecks{gs-packagepath}/
156            description: "the url where we store the packages used for bottlenecks rubbos"
157
158 ####################################
159 #builders for bottlenecks project
160 ####################################
161 - builder:
162     name: bottlenecks-builder-upload-artifact
163     builders:
164         - shell: |
165             #!/bin/bash
166             set -o errexit
167
168             echo "Bottlenecks: upload to artifacts from the public IP"
169
170             [[ -d $CACHE_DIR ]] || mkdir -p $CACHE_DIR
171
172             for file in $(curl -s $PACKAGE_URL |
173                                grep href |
174                                sed 's/.*href="//' |
175                                sed 's/".*//' |
176                                grep '^[a-zA-Z].*'); do
177                  curl --connect-timeout 10 -o $CACHE_DIR/$file $PACKAGE_URL$file -v
178                  echo "bottlenecks: copy file $CACHE_DIR/$file to $SUITE_URL"
179                  gsutil cp $CACHE_DIR/$file $SUITE_URL
180             done
181
182 - builder:
183     name: bottlenecks-workspace-cleanup
184     builders:
185         - shell: |
186             #!/bin/bash
187             set -o errexit
188
189             echo "Bottlenecks: cleanup cache used for storage downloaded packages"
190
191             /bin/rm -rf $CACHE_DIR
192
193 - builder:
194     name: bottlenecks-unit-tests
195     builders:
196         - shell: |
197             #!/bin/bash
198             set -o errexit
199             set -o pipefail
200
201             echo "Running unit tests..."
202             cd $WORKSPACE
203             virtualenv $WORKSPACE/bottlenecks_venv
204             source $WORKSPACE/bottlenecks_venv/bin/activate
205
206             # install python packages
207             easy_install -U setuptools
208             easy_install -U pip
209             pip install -r requirements.txt
210
211             # unit tests
212             /bin/bash $WORKSPACE/tests.sh
213
214             deactivate
215
216 - builder:
217     name: bottlenecks-hello
218     builders:
219         - shell: |
220             #!/bin/bash
221             set -o errexit
222
223             echo "hello"