a28e2a407cf8c5251323e1e1c996c8c5947f071b
[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         - brahmaputra:
23             branch: 'stable/{stream}'
24             gs-pathname: '/{stream}'
25             gs-packagepath: '/{stream}/{suite}'
26
27     suite:
28         - 'rubbos'
29         - 'vstf'
30
31 ################################
32 # job templates
33 ################################
34
35 - job-template:
36     name: 'bottlenecks-verify-{stream}'
37
38     parameters:
39         - project-parameter:
40             project: '{project}'
41         - gerrit-parameter:
42             branch: '{branch}'
43         - 'opnfv-build-ubuntu-defaults'
44
45     scm:
46         - gerrit-trigger-scm:
47             credentials-id: '{ssh-credentials}'
48             refspec: '$GERRIT_REFSPEC'
49             choosing-strategy: 'gerrit'
50
51     triggers:
52         - gerrit:
53             trigger-on:
54                 - patchset-created-event:
55                     exclude-drafts: 'false'
56                     exclude-trivial-rebase: 'false'
57                     exclude-no-code-change: 'false'
58                 - draft-published-event
59                 - comment-added-contains-event:
60                     comment-contains-value: 'recheck'
61                 - comment-added-contains-event:
62                     comment-contains-value: 'reverify'
63             projects:
64               - project-compare-type: 'ANT'
65                 project-pattern: '{project}'
66                 branches:
67                   - branch-compare-type: 'ANT'
68                     branch-pattern: '**/{branch}'
69     builders:
70          - shell: |
71              echo "bottlenecks: verify job"
72          #TO DO: this should be changed when the unittest ready
73
74 - job-template:
75     name: 'bottlenecks-merge-{stream}'
76
77     parameters:
78         - project-parameter:
79             project: '{project}'
80         - gerrit-parameter:
81             branch: '{branch}'
82         - 'opnfv-build-ubuntu-defaults'
83
84     scm:
85         - gerrit-trigger-scm:
86             credentials-id: '{ssh-credentials}'
87             refspec: ''
88             choosing-strategy: 'default'
89
90     triggers:
91         - gerrit:
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          - shell: |
105              echo "bottlenecks: merge"
106
107 - job-template:
108     name: 'bottlenecks-{suite}-upload-artifacts-{stream}'
109
110     concurrent: true
111
112     properties:
113         - throttle:
114             enabled: true
115             max-total: 1
116             max-per-node: 1
117
118     parameters:
119         - project-parameter:
120             project: '{project}'
121         - 'ericsson-build-defaults'
122         - bottlenecks-parameter:
123             gs-packagepath: '{gs-packagepath}'
124
125     scm:
126         - git-scm:
127             credentials-id: '{ssh-credentials}'
128             refspec: ''
129             branch: '{branch}'
130
131     builders:
132         - 'bottlenecks-builder-upload-artifact'
133         - 'bottlenecks-workspace-cleanup'
134
135 ####################
136 # parameter macros
137 ####################
138 - parameter:
139     name: bottlenecks-parameter
140     parameters:
141         - string:
142            name: CACHE_DIR
143            default: $WORKSPACE/cache{gs-packagepath}
144            description: "the cache to store packages downloaded from public IP"
145         - string:
146            name: SUITE_URL
147            default: gs://artifacts.opnfv.org/bottlenecks{gs-packagepath}
148            description: "LF artifacts url for storage of bottlenecks packages"
149         - string:
150            name: PACKAGE_URL
151            default: http://205.177.226.237:9999/bottlenecks{gs-packagepath}/
152            description: "the url where we store the packages used for bottlenecks rubbos"
153
154 ####################################
155 #builders for bottlenecks project
156 ####################################
157 - builder:
158     name: bottlenecks-builder-upload-artifact
159     builders:
160         - shell: |
161             #!/bin/bash
162             set -o errexit
163
164             echo "Bottlenecks: upload to artifacts from the public IP"
165
166             [[ -d $CACHE_DIR ]] || mkdir -p $CACHE_DIR
167
168             for file in $(curl -s $PACKAGE_URL |
169                                grep href |
170                                sed 's/.*href="//' |
171                                sed 's/".*//' |
172                                grep '^[a-zA-Z].*'); do
173                  curl --connect-timeout 10 -o $CACHE_DIR/$file $PACKAGE_URL$file -v
174                  echo "bottlenecks: copy file $CACHE_DIR/$file to $SUITE_URL"
175                  gsutil cp $CACHE_DIR/$file $SUITE_URL
176             done
177
178 - builder:
179     name: bottlenecks-workspace-cleanup
180     builders:
181         - shell: |
182             #!/bin/bash
183             set -o errexit
184
185             echo "Bottlenecks: cleanup cache used for storage downloaded packages"
186
187             /bin/rm -rf $CACHE_DIR