Merge "Use parameters in cli for deploy.sh"
[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'
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     builders:
72         - bottlenecks-hello
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         #- bottlenecks-unit-tests
106
107 - job-template:
108     name: 'bottlenecks-{suite}-upload-artifacts-{stream}'
109
110
111     disabled: '{obj:disabled}'
112
113     concurrent: true
114
115     properties:
116         - logrotate-default
117         - throttle:
118             enabled: true
119             max-total: 1
120             max-per-node: 1
121             option: 'project'
122
123     parameters:
124         - project-parameter:
125             project: '{project}'
126             branch: '{branch}'
127         - 'opnfv-build-ubuntu-defaults'
128         - bottlenecks-parameter:
129             gs-packagepath: '{gs-packagepath}'
130
131     scm:
132         - git-scm
133
134     builders:
135         - 'bottlenecks-builder-upload-artifact'
136         - 'bottlenecks-workspace-cleanup'
137
138 ####################
139 # parameter macros
140 ####################
141 - parameter:
142     name: bottlenecks-parameter
143     parameters:
144         - string:
145            name: CACHE_DIR
146            default: $WORKSPACE/cache{gs-packagepath}
147            description: "the cache to store packages downloaded from public IP"
148         - string:
149            name: SUITE_URL
150            default: gs://artifacts.opnfv.org/bottlenecks{gs-packagepath}
151            description: "LF artifacts url for storage of bottlenecks packages"
152         - string:
153            name: PACKAGE_URL
154            default: http://205.177.226.237:9999/bottlenecks{gs-packagepath}/
155            description: "the url where we store the packages used for bottlenecks 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-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 requirements.txt
209
210             # unit tests
211             /bin/bash $WORKSPACE/tests.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 "hello"