4 # NOTE: make sure macros are listed in execution ordered.
6 # 1. parameters/properties
10 # 5. prebuilders (maven only, configured like Builders)
11 # 6. builders (maven, freestyle, matrix, etc..)
12 # 7. postbuilders (maven only, configured like Builders)
13 # 8. publishers/reporters/notifications
16 name: project-parameter
21 description: "JJB configured PROJECT parameter to identify an opnfv Gerrit project"
24 default: artifacts.opnfv.org/$PROJECT
25 description: "URL to Google Storage."
28 default: build.opnfv.org/artifacts.opnfv.org/$PROJECT
29 description: "URL to Google Storage proxy"
33 description: "JJB configured BRANCH parameter (e.g. master, stable/danube)"
37 description: "JJB configured GERRIT_BRANCH parameter (deprecated)"
40 default: 'refs/heads/{branch}'
41 description: "Default refspec needed for manually triggering."
44 # Reporting Deployment Results
46 # To report deployment results to
47 # http://testresults.opnfv.org/test/#/deployresults, add the following
48 # parameters, builders, and publishers to a deployment job:
54 # - track-begin-timestamp
57 # - report-provision-result
59 # Note: The following string parameter must also exist, as they are used
60 # when reporting the provision result:
66 # most installers include these but you should verify first before
67 # adding the publisher, otherwise the deployment build may be marked
72 name: testapi-parameter
76 default: 'http://testresults.opnfv.org/test/api/v1'
77 description: "Default TestAPI URL, currently using v1"
79 name: INSTALLER_VERSION
81 description: "Installer release version"
83 name: UPSTREAM_JOB_NAME
85 description: "Parent job name in Jenkins"
87 name: UPSTREAM_BUILD_ID
89 description: "Parent job build_id in Jenkins"
92 name: logrotate-default
97 artifact-days-to-keep: 60
98 artifact-num-to-keep: 200
103 - git: &git-scm-defaults
104 credentials-id: 'd42411ac011ad6f3dd2e1fa34eaa5d87f910eb2e'
121 choosing-strategy: 'gerrit'
122 refspec: '$GERRIT_REFSPEC'
123 <<: *git-scm-defaults
126 name: git-scm-gerrit-with-submodules
129 choosing-strategy: 'gerrit'
130 refspec: '$GERRIT_REFSPEC'
134 <<: *git-scm-defaults
136 name: git-scm-with-submodules
139 credentials-id: 'd42411ac011ad6f3dd2e1fa34eaa5d87f910eb2e'
143 - 'refs/heads/{branch}'
152 name: git-scm-openstack
154 - git: &git-scm-openstack-defaults
163 name: 'daily-trigger-disabled'
168 name: 'weekly-trigger-disabled'
173 name: gerrit-trigger-patchset-created
176 server-name: 'gerrit.opnfv.org'
178 - patchset-created-event:
179 exclude-drafts: 'false'
180 exclude-trivial-rebase: 'false'
181 exclude-no-code-change: 'false'
182 - draft-published-event
183 - comment-added-contains-event:
184 comment-contains-value: 'recheck'
185 - comment-added-contains-event:
186 comment-contains-value: 'reverify'
188 - project-compare-type: 'ANT'
189 project-pattern: '{project}'
191 - branch-compare-type: 'ANT'
192 branch-pattern: '**/{branch}'
194 - compare-type: 'ANT'
203 name: gerrit-trigger-patchset-approved
206 server-name: 'gerrit.opnfv.org'
208 - comment-added-event:
209 approval-category: 'CRVW'
211 - comment-added-contains-event:
212 comment-contains-value: 'gate'
214 - project-compare-type: 'ANT'
215 project-pattern: '{project}'
217 - branch-compare-type: 'ANT'
218 branch-pattern: '**/{branch}'
220 - compare-type: 'ANT'
229 name: gerrit-trigger-change-merged
232 server-name: 'gerrit.opnfv.org'
234 - change-merged-event
235 - comment-added-contains-event:
236 comment-contains-value: 'remerge'
238 - project-compare-type: 'ANT'
239 project-pattern: '{project}'
241 - branch-compare-type: 'ANT'
242 branch-pattern: '**/{branch}'
244 - compare-type: 'ANT'
248 name: gerrit-trigger-tag-created
251 server-name: 'gerrit.opnfv.org'
255 - project-compare-type: 'ANT'
256 project-pattern: '{project}'
258 - branch-compare-type: 'ANT'
259 branch-pattern: 'refs/tags/**'
265 server-name: 'gerrit.opnfv.org'
267 - comment-added-contains-event:
268 comment-contains-value: 'check-experimental'
270 - project-compare-type: 'ANT'
271 project-pattern: '{project}'
273 - branch-compare-type: 'ANT'
274 branch-pattern: '**/{branch}'
276 - compare-type: 'ANT'
285 name: ssh-agent-wrapper
287 - ssh-agent-credentials:
289 - 'd42411ac011ad6f3dd2e1fa34eaa5d87f910eb2e'
296 timeout-var: 'BUILD_TIMEOUT'
300 name: fix-workspace-permissions
305 sudo chown -R $USER:$USER $WORKSPACE || exit 1
308 name: upload-under-review-docs-to-opnfv-artifacts
315 export PATH=$PATH:/usr/local/bin/
317 [[ $GERRIT_CHANGE_NUMBER =~ .+ ]]
318 [[ -d docs/_build/ ]] || exit 0
321 echo "###########################"
322 echo "UPLOADING DOCS UNDER REVIEW"
323 echo "###########################"
326 gs_base="artifacts.opnfv.org/$PROJECT/review"
327 gs_path="$gs_base/$GERRIT_CHANGE_NUMBER"
328 local_path="upload/$GERRIT_CHANGE_NUMBER"
331 mv docs/_build/html/ "$local_path"
332 gsutil -m cp -r "$local_path" "gs://$gs_base"
335 -h "Content-Type:text/html" \
336 -h "Cache-Control:private, max-age=0, no-transform" \
337 "gs://$gs_path"/**.html > /dev/null 2>&1
339 echo "Document link(s):" >> gerrit_comment.txt
340 find "$local_path" | grep -e 'index.html$' -e 'pdf$' | \
341 sed -e "s|^$local_path| http://$gs_path|" >> gerrit_comment.txt
343 # To take advantage of this macro, have your build write
344 # out the file 'gerrit_comment.txt' with information to post
345 # back to gerrit and include this macro in the list of builders.
347 name: report-build-result-to-gerrit
354 export PATH=$PATH:/usr/local/bin/
355 if [[ -e gerrit_comment.txt ]] ; then
357 echo "posting review comment to gerrit..."
359 cat gerrit_comment.txt
361 ssh -o 'PubkeyAcceptedKeyTypes +ssh-rsa' \
362 -p 29418 fbot@gerrit.opnfv.org \
363 "gerrit review -p $GERRIT_PROJECT \
364 -m '$(cat gerrit_comment.txt)' \
365 $GERRIT_PATCHSET_REVISION \
370 name: remove-old-docs-from-opnfv-artifacts
377 export PATH=$PATH:/usr/local/bin/
379 [[ $GERRIT_CHANGE_NUMBER =~ .+ ]]
381 gs_path="artifacts.opnfv.org/$PROJECT/review/$GERRIT_CHANGE_NUMBER"
383 if gsutil ls "gs://$gs_path" > /dev/null 2>&1 ; then
385 echo "Deleting Out-of-dated Documents..."
386 gsutil -m rm -r "gs://$gs_path"
388 gs_path="artifacts.opnfv.org/review/$GERRIT_CHANGE_NUMBER"
390 if gsutil ls "gs://$gs_path" > /dev/null 2>&1 ; then
392 echo "Deleting Out-of-dated Documents..."
393 gsutil -m rm -r "gs://$gs_path"
397 name: upload-review-docs
399 - upload-under-review-docs-to-opnfv-artifacts
400 - report-build-result-to-gerrit
403 name: clean-workspace
410 sudo /bin/rm -rf "$WORKSPACE"
413 name: clean-workspace-log
416 find $WORKSPACE -type f -name '*.log' | xargs rm -f
419 name: track-begin-timestamp
422 echo "export TIMESTAMP_START="\'`date '+%Y-%m-%d %H:%M:%S.%3N'`\' > $WORKSPACE/installer_track.sh
425 name: archive-artifacts
428 artifacts: '{artifacts}'
434 name: publish-coverage
437 report-file: "coverage.xml"
439 health-auto-update: "false"
440 stability-auto-update: "false"
441 zoom-coverage-chart: "true"
452 # The majority of the email-ext plugin options are set to the default
453 # for this macro so they can be managed through Jenkins' global
456 name: email-jenkins-admins-on-failure
460 attach-build-log: true