clean scm defenitions
[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         - 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         - gerrit-parameter:
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         - 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         - '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-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 rubbos"
155
156 ####################################
157 #builders for bottlenecks project
158 ####################################
159 - builder:
160     name: bottlenecks-builder-upload-artifact
161     builders:
162         - shell: |
163             #!/bin/bash
164             set -o errexit
165
166             echo "Bottlenecks: upload to artifacts from the public IP"
167
168             [[ -d $CACHE_DIR ]] || mkdir -p $CACHE_DIR
169
170             for file in $(curl -s $PACKAGE_URL |
171                                grep href |
172                                sed 's/.*href="//' |
173                                sed 's/".*//' |
174                                grep '^[a-zA-Z].*'); do
175                  curl --connect-timeout 10 -o $CACHE_DIR/$file $PACKAGE_URL$file -v
176                  echo "bottlenecks: copy file $CACHE_DIR/$file to $SUITE_URL"
177                  gsutil cp $CACHE_DIR/$file $SUITE_URL
178             done
179
180 - builder:
181     name: bottlenecks-workspace-cleanup
182     builders:
183         - shell: |
184             #!/bin/bash
185             set -o errexit
186
187             echo "Bottlenecks: cleanup cache used for storage downloaded packages"
188
189             /bin/rm -rf $CACHE_DIR
190
191 - builder:
192     name: bottlenecks-unit-tests
193     builders:
194         - shell: |
195             #!/bin/bash
196             set -o errexit
197             set -o pipefail
198
199             echo "Running unit tests..."
200             cd $WORKSPACE
201             virtualenv $WORKSPACE/bottlenecks_venv
202             source $WORKSPACE/bottlenecks_venv/bin/activate
203
204             # install python packages
205             easy_install -U setuptools
206             easy_install -U pip
207             pip install -r requirements.txt
208
209             # unit tests
210             /bin/bash $WORKSPACE/tests.sh
211
212             deactivate
213
214 - builder:
215     name: bottlenecks-hello
216     builders:
217         - shell: |
218             #!/bin/bash
219             set -o errexit
220
221             echo "hello"