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