Merge "add lab path for volume option with joid"
[releng.git] / jjb / releng-macros.yaml
1 # OLD Releng macros
2
3 - parameter:
4     name: project-parameter
5     parameters:
6         - string:
7             name: PROJECT
8             default: '{project}'
9             description: "JJB configured PROJECT parameter to identify an opnfv Gerrit project"
10
11 - parameter:
12     name: gerrit-parameter
13     parameters:
14         - string:
15             name: GERRIT_BRANCH
16             default: '{branch}'
17             description: "JJB configured GERRIT_BRANCH parameter"
18
19 - scm:
20     name: git-scm
21     scm:
22         - git:
23             credentials-id: '{credentials-id}'
24             url: '$GIT_BASE'
25             refspec: ''
26             branches:
27                 - 'origin/{branch}'
28             skip-tag: true
29             wipe-workspace: true
30
31 - scm:
32     name: gerrit-trigger-scm
33     scm:
34         - git:
35             credentials-id: '{credentials-id}'
36             url: '$GIT_BASE'
37             refspec: '{refspec}'
38             branches:
39                 - 'origin/$GERRIT_BRANCH'
40             skip-tag: true
41             choosing-strategy: '{choosing-strategy}'
42
43 - wrapper:
44     name: build-timeout
45     wrappers:
46         - timeout:
47             type: absolute
48             timeout: 360
49             fail: true
50
51 - trigger:
52     name: gerrit-trigger-patch-submitted
53     triggers:
54         - gerrit:
55             server-name: 'gerrit.opnfv.org'
56             trigger-on:
57                 - patchset-created-event:
58                     exclude-drafts: 'false'
59                     exclude-trivial-rebase: 'false'
60                     exclude-no-code-change: 'false'
61                 - draft-published-event
62                 - comment-added-contains-event:
63                     comment-contains-value: 'recheck'
64             projects:
65               - project-compare-type: 'ANT'
66                 project-pattern: '{name}'
67                 branches:
68                   - branch-compare-type: 'ANT'
69                     branch-pattern: '**/{branch}'
70
71 - trigger:
72     name: gerrit-trigger-patch-merged
73     triggers:
74         - gerrit:
75             server-name: 'gerrit.opnfv.org'
76             trigger-on:
77                 - change-merged-event
78                 - comment-added-contains-event:
79                     comment-contains-value: 'remerge'
80             projects:
81               - project-compare-type: 'ANT'
82                 project-pattern: '{name}'
83                 branches:
84                   - branch-compare-type: 'ANT'
85                     branch-pattern: '**/{branch}'
86
87 - publisher:
88     name: archive-artifacts
89     publishers:
90         - archive:
91             artifacts: '{artifacts}'
92             allow-empty: true
93             fingerprint: true
94             latest-only: true
95
96 - publisher:
97     name: email-notification
98     publishers:
99         - email-ext:
100             recipients: 'jenkins@lists.opnfv.org'
101             reply-to:
102             content-type: default
103             subject: '{email-prefix} $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!'
104             body: |
105                 $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS:
106
107                 Check console output at $BUILD_URL to view the results.
108             unstable: true
109             fixed: true
110             send-to:
111                 - developers
112                 - recipients
113
114 - publisher:
115         name: jacoco-report
116         publishers:
117             - jacoco:
118                 exec-pattern: "**/**.exec"
119                 class-pattern: "**/classes"
120                 source-pattern: "**/src/main/java"
121                 exclusion-pattern: "**/gen/**,**/generated-sources/**,**/yang-gen**"
122                 status-update: true
123                 targets:
124                   - branch:
125                       healthy: 10
126                       unhealthy: 20
127                   - method:
128                       healthy: 50
129                       unhealthy: 40
130
131
132 - builder:
133     name: test-macro
134     builders:
135         - shell: 'echo testing macro "test-macro"'
136
137 - builder:
138     name: wipe-org-opendaylight-repo
139     builders:
140         - shell: 'if [ -d /tmp/r/org/opendaylight ]; then rm -rf /tmp/r/org/opendaylight; fi'
141
142 - builder:
143     name: jacoco-nojava-workaround
144     builders:
145         - shell: 'mkdir -p $WORKSPACE/target/classes'
146
147
148 # New Releng macros
149
150 - builder:
151     name: build-html-and-pdf-docs-output
152     builders:
153         - shell: |
154             #!/bin/bash -e
155             export PATH=$PATH:/usr/local/bin/
156             git clone ssh://gerrit.opnfv.org:29418/releng
157             GERRIT_COMMENT=gerrit_comment.txt ./releng/utils/docs-build.sh
158
159 - builder:
160     name: upload-under-review-docs-to-opnfv-artifacts
161     builders:
162         - shell: |
163             #!/bin/bash -e
164             set -o pipefail
165             export PATH=$PATH:/usr/local/bin/
166
167             [[ $GERRIT_CHANGE_NUMBER =~ .+ ]]
168             [[ -d output ]]
169
170             echo
171             echo "###########################"
172             echo "UPLOADING DOCS UNDER REVIEW"
173             echo "###########################"
174             echo
175
176             gs_base="artifacts.opnfv.org/review"
177             gs_path="$gs_base/$GERRIT_CHANGE_NUMBER"
178             local_path="upload/$GERRIT_CHANGE_NUMBER"
179
180             mkdir -p upload
181             mv output "$local_path"
182             gsutil -m cp -r "$local_path" "gs://$gs_base"
183
184             if gsutil ls "gs://$gs_path" | grep -e 'html$' > /dev/null 2>&1 ; then
185                 gsutil -m setmeta \
186                     -h "Content-Type:text/html" \
187                     -h "Cache-Control:private, max-age=0, no-transform" \
188                     "gs://$gs_path"/**.html
189             fi
190
191             echo "Document link(s):" >> gerrit_comment.txt
192             find "$local_path" | grep -e 'index.html$' -e 'pdf$' | \
193                 sed -e "s|^$local_path|    http://$gs_path|" >> gerrit_comment.txt
194
195 - builder:
196     name: upload-merged-docs-to-opnfv-artifacts
197     builders:
198         - shell: |
199             #!/bin/bash -e
200             set -o pipefail
201             export PATH=$PATH:/usr/local/bin/
202
203             [[ -d output ]]
204
205             echo
206             echo "#####################"
207             echo "UPLOADING MERGED DOCS"
208             echo "#####################"
209             echo
210
211             if [[ "$GERRIT_BRANCH" == "master" ]] ; then
212                 gs_base="artifacts.opnfv.org/$GERRIT_PROJECT"
213             else
214                 gs_base="artifacts.opnfv.org/$GERRIT_PROJECT/$GERRIT_BRANCH"
215             fi
216             gs_path="$gs_base/docs"
217             local_path="upload/docs"
218
219             mkdir -p upload
220             mv output "$local_path"
221             gsutil -m cp -r "$local_path" "gs://$gs_base"
222
223             if gsutil ls "gs://$gs_path" | grep -e 'html$' > /dev/null 2>&1 ; then
224                 gsutil -m setmeta \
225                     -h "Content-Type:text/html" \
226                     -h "Cache-Control:private, max-age=0, no-transform" \
227                     "gs://$gs_path"/**.html
228             fi
229
230             echo "Document link(s):" >> gerrit_comment.txt
231             find "$local_path" | grep -e 'index.html$' -e 'pdf$' | \
232                 sed -e "s|^$local_path|    http://$gs_path|" >> gerrit_comment.txt
233
234 - builder:
235     name: report-docs-build-result-to-gerrit
236     builders:
237         - shell: |
238             #!/bin/bash -e
239             export PATH=$PATH:/usr/local/bin/
240             if [[ -e gerrit_comment.txt ]] ; then
241                 echo
242                 echo "posting review comment to gerrit..."
243                 echo
244                 cat gerrit_comment.txt
245                 echo
246                 ssh -p 29418 gerrit.opnfv.org \
247                     "gerrit review -p $GERRIT_PROJECT \
248                      -m '$(cat gerrit_comment.txt)' \
249                      $GERRIT_PATCHSET_REVISION"
250             fi
251
252 - builder:
253     name: remove-old-docs-from-opnfv-artifacts
254     builders:
255         - shell: |
256             #!/bin/bash -e
257             export PATH=$PATH:/usr/local/bin/
258
259             [[ $GERRIT_CHANGE_NUMBER =~ .+ ]]
260
261             gs_path="artifacts.opnfv.org/review/$GERRIT_CHANGE_NUMBER"
262
263             if gsutil ls "gs://$gs_path" > /dev/null 2>&1 ; then
264                 echo
265                 echo "Deleting Out-of-dated Documents..."
266                 gsutil -m rm -r "gs://$gs_path"
267             fi
268
269 - builder:
270     name: upload-review-docs
271     builders:
272         - build-html-and-pdf-docs-output
273         - upload-under-review-docs-to-opnfv-artifacts
274         - report-docs-build-result-to-gerrit
275
276 - builder:
277     name: upload-merged-docs
278     builders:
279         - build-html-and-pdf-docs-output
280         - upload-merged-docs-to-opnfv-artifacts
281         - report-docs-build-result-to-gerrit
282         - remove-old-docs-from-opnfv-artifacts