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