Create Stable Branch Jobs for bottlenecks
[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       - hunter: &hunter
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-unit-tests
74
75 - job-template:
76     name: 'bottlenecks-merge-{stream}'
77
78     disabled: '{obj:disabled}'
79
80     parameters:
81       - project-parameter:
82           project: '{project}'
83           branch: '{branch}'
84       - 'opnfv-build-ubuntu-defaults'
85
86     scm:
87       - git-scm
88
89     triggers:
90       - gerrit:
91           server-name: 'gerrit.opnfv.org'
92           trigger-on:
93             - change-merged-event
94             - comment-added-contains-event:
95                 comment-contains-value: 'remerge'
96           projects:
97             - project-compare-type: 'ANT'
98               project-pattern: '{project}'
99               branches:
100                 - branch-compare-type: 'ANT'
101                   branch-pattern: '**/{branch}'
102
103     builders:
104       - bottlenecks-hello
105
106 - job-template:
107     name: 'bottlenecks-{suite}-upload-artifacts-{stream}'
108
109
110     disabled: '{obj:disabled}'
111
112     concurrent: true
113
114     properties:
115       - logrotate-default
116       - throttle:
117           enabled: true
118           max-total: 1
119           max-per-node: 1
120           option: 'project'
121
122     parameters:
123       - project-parameter:
124           project: '{project}'
125           branch: '{branch}'
126       - 'opnfv-build-ubuntu-defaults'
127       - bottlenecks-parameter:
128           gs-packagepath: '{gs-packagepath}'
129
130     scm:
131       - git-scm
132
133     builders:
134       - 'bottlenecks-builder-upload-artifact'
135       - 'bottlenecks-artifact-workspace-cleanup'
136
137 ####################
138 # parameter macros
139 ####################
140 - parameter:
141     name: bottlenecks-parameter
142     parameters:
143       - string:
144           name: CACHE_DIR
145           default: $WORKSPACE/cache{gs-packagepath}
146           description: "the cache to store packages downloaded from public IP"
147       - string:
148           name: SUITE_URL
149           default: gs://artifacts.opnfv.org/bottlenecks{gs-packagepath}
150           description: "LF artifacts url for storage of bottlenecks packages"
151       - string:
152           name: PACKAGE_URL
153           default: http://205.177.226.237:9999/bottlenecks{gs-packagepath}/
154           description: "the url where we store the packages used for bottlenecks\
155             \ rubbos"
156
157 ####################################
158 # builders for bottlenecks project
159 ####################################
160 - builder:
161     name: bottlenecks-builder-upload-artifact
162     builders:
163       - shell: |
164           #!/bin/bash
165           set -o errexit
166
167           echo "Bottlenecks: upload to artifacts from the public IP"
168
169           [[ -d $CACHE_DIR ]] || mkdir -p $CACHE_DIR
170
171           for file in $(curl -s $PACKAGE_URL |
172                              grep href |
173                              sed 's/.*href="//' |
174                              sed 's/".*//' |
175                              grep '^[a-zA-Z].*'); do
176                curl --connect-timeout 10 -o $CACHE_DIR/$file $PACKAGE_URL$file -v
177                echo "bottlenecks: copy file $CACHE_DIR/$file to $SUITE_URL"
178                gsutil cp $CACHE_DIR/$file $SUITE_URL
179           done
180
181 - builder:
182     name: bottlenecks-artifact-workspace-cleanup
183     builders:
184       - shell: |
185           #!/bin/bash
186           set -o errexit
187
188           echo "Bottlenecks: cleanup cache used for storage downloaded packages"
189
190           /bin/rm -rf $CACHE_DIR
191
192 - builder:
193     name: bottlenecks-unit-tests
194     builders:
195       - shell: |
196           #!/bin/bash
197           set -o errexit
198           set -o pipefail
199
200           echo "Running unit tests..."
201           cd $WORKSPACE
202           virtualenv $WORKSPACE/bottlenecks_venv
203           source $WORKSPACE/bottlenecks_venv/bin/activate
204
205           # install python packages
206           easy_install -U setuptools
207           easy_install -U pip
208           pip install -r $WORKSPACE/requirements/verify.txt
209
210           # unit tests
211           /bin/bash $WORKSPACE/verify.sh
212
213           deactivate
214
215 - builder:
216     name: bottlenecks-hello
217     builders:
218       - shell: |
219           #!/bin/bash
220           set -o errexit
221
222           echo -e "Wellcome to Bottlenecks! \nMerge event is planning to support more functions! "