fffc22def9bef63159d0fc6ad3b03848476a07f6
[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             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     builders:
74          - shell: |
75              echo "bottlenecks: verify job"
76          #TO DO: this should be changed when the unittest ready
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             trigger-on:
99                 - change-merged-event
100                 - comment-added-contains-event:
101                     comment-contains-value: 'remerge'
102             projects:
103               - project-compare-type: 'ANT'
104                 project-pattern: '{project}'
105                 branches:
106                     - branch-compare-type: 'ANT'
107                       branch-pattern: '**/{branch}'
108
109     builders:
110          - shell: |
111              echo "bottlenecks: merge"
112
113 - job-template:
114     name: 'bottlenecks-{suite}-upload-artifacts-{stream}'
115
116
117     disabled: '{obj:disabled}'
118
119     concurrent: true
120
121     properties:
122         - throttle:
123             enabled: true
124             max-total: 1
125             max-per-node: 1
126             option: 'project'
127
128     parameters:
129         - project-parameter:
130             project: '{project}'
131         - 'opnfv-build-ubuntu-defaults'
132         - bottlenecks-parameter:
133             gs-packagepath: '{gs-packagepath}'
134
135     scm:
136         - git-scm:
137             credentials-id: '{ssh-credentials}'
138             refspec: ''
139             branch: '{branch}'
140
141     builders:
142         - 'bottlenecks-builder-upload-artifact'
143         - 'bottlenecks-workspace-cleanup'
144
145 ####################
146 # parameter macros
147 ####################
148 - parameter:
149     name: bottlenecks-parameter
150     parameters:
151         - string:
152            name: CACHE_DIR
153            default: $WORKSPACE/cache{gs-packagepath}
154            description: "the cache to store packages downloaded from public IP"
155         - string:
156            name: SUITE_URL
157            default: gs://artifacts.opnfv.org/bottlenecks{gs-packagepath}
158            description: "LF artifacts url for storage of bottlenecks packages"
159         - string:
160            name: PACKAGE_URL
161            default: http://205.177.226.237:9999/bottlenecks{gs-packagepath}/
162            description: "the url where we store the packages used for bottlenecks rubbos"
163
164 ####################################
165 #builders for bottlenecks project
166 ####################################
167 - builder:
168     name: bottlenecks-builder-upload-artifact
169     builders:
170         - shell: |
171             #!/bin/bash
172             set -o errexit
173
174             echo "Bottlenecks: upload to artifacts from the public IP"
175
176             [[ -d $CACHE_DIR ]] || mkdir -p $CACHE_DIR
177
178             for file in $(curl -s $PACKAGE_URL |
179                                grep href |
180                                sed 's/.*href="//' |
181                                sed 's/".*//' |
182                                grep '^[a-zA-Z].*'); do
183                  curl --connect-timeout 10 -o $CACHE_DIR/$file $PACKAGE_URL$file -v
184                  echo "bottlenecks: copy file $CACHE_DIR/$file to $SUITE_URL"
185                  gsutil cp $CACHE_DIR/$file $SUITE_URL
186             done
187
188 - builder:
189     name: bottlenecks-workspace-cleanup
190     builders:
191         - shell: |
192             #!/bin/bash
193             set -o errexit
194
195             echo "Bottlenecks: cleanup cache used for storage downloaded packages"
196
197             /bin/rm -rf $CACHE_DIR