[auto] Fix missing yaml block marker
[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       - fraser: &fraser
25           branch: 'stable/{stream}'
26           gs-pathname: '/{stream}'
27           gs-packagepath: '/{stream}/{suite}'
28           disabled: false
29
30     suite:
31       - 'posca_stress_traffic'
32       - 'posca_stress_ping'
33
34 ################################
35 # job templates
36 ################################
37
38 - job-template:
39     name: 'bottlenecks-verify-{stream}'
40
41     disabled: '{obj:disabled}'
42
43     parameters:
44       - project-parameter:
45           project: '{project}'
46           branch: '{branch}'
47       - 'opnfv-build-ubuntu-defaults'
48
49     scm:
50       - git-scm-gerrit
51
52     triggers:
53       - gerrit:
54           server-name: 'gerrit.opnfv.org'
55           trigger-on:
56             - patchset-created-event:
57                 exclude-drafts: 'false'
58                 exclude-trivial-rebase: 'false'
59                 exclude-no-code-change: 'false'
60             - draft-published-event
61             - comment-added-contains-event:
62                 comment-contains-value: 'recheck'
63             - comment-added-contains-event:
64                 comment-contains-value: 'reverify'
65           projects:
66             - project-compare-type: 'ANT'
67               project-pattern: '{project}'
68               branches:
69                 - branch-compare-type: 'ANT'
70                   branch-pattern: '**/{branch}'
71
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-artifact-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\
157             \ rubbos"
158
159 ####################################
160 # builders for bottlenecks project
161 ####################################
162 - builder:
163     name: bottlenecks-builder-upload-artifact
164     builders:
165       - shell: |
166           #!/bin/bash
167           set -o errexit
168
169           echo "Bottlenecks: upload to artifacts from the public IP"
170
171           [[ -d $CACHE_DIR ]] || mkdir -p $CACHE_DIR
172
173           for file in $(curl -s $PACKAGE_URL |
174                              grep href |
175                              sed 's/.*href="//' |
176                              sed 's/".*//' |
177                              grep '^[a-zA-Z].*'); do
178                curl --connect-timeout 10 -o $CACHE_DIR/$file $PACKAGE_URL$file -v
179                echo "bottlenecks: copy file $CACHE_DIR/$file to $SUITE_URL"
180                gsutil cp $CACHE_DIR/$file $SUITE_URL
181           done
182
183 - builder:
184     name: bottlenecks-artifact-workspace-cleanup
185     builders:
186       - shell: |
187           #!/bin/bash
188           set -o errexit
189
190           echo "Bottlenecks: cleanup cache used for storage downloaded packages"
191
192           /bin/rm -rf $CACHE_DIR
193
194 - builder:
195     name: bottlenecks-unit-tests
196     builders:
197       - shell: |
198           #!/bin/bash
199           set -o errexit
200           set -o pipefail
201
202           echo "Running unit tests..."
203           cd $WORKSPACE
204           virtualenv $WORKSPACE/bottlenecks_venv
205           source $WORKSPACE/bottlenecks_venv/bin/activate
206
207           # install python packages
208           easy_install -U setuptools
209           easy_install -U pip
210           pip install -r $WORKSPACE/requirements/verify.txt
211
212           # unit tests
213           /bin/bash $WORKSPACE/verify.sh
214
215           deactivate
216
217 - builder:
218     name: bottlenecks-hello
219     builders:
220       - shell: |
221           #!/bin/bash
222           set -o errexit
223
224           echo -e "Wellcome to Bottlenecks! \nMerge event is planning to support more functions! "