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