4 name: project-parameter
9 description: "JJB configured PROJECT parameter to identify an opnfv Gerrit project"
12 default: artifacts.opnfv.org/$PROJECT
13 description: "URL to Google Storage."
16 default: build.opnfv.org/artifacts.opnfv.org/$PROJECT
17 description: "URL to Google Storage proxy"
20 name: gerrit-parameter
25 description: "JJB configured GERRIT_BRANCH parameter"
31 credentials-id: '{credentials-id}'
40 name: gerrit-trigger-scm
43 credentials-id: '{credentials-id}'
47 - 'origin/$GERRIT_BRANCH'
49 choosing-strategy: '{choosing-strategy}'
61 name: 'daily-trigger-disabled'
66 name: 'weekly-trigger-disabled'
71 name: 'brahmaputra-trigger-daily-enabled'
76 name: gerrit-trigger-patch-submitted
79 server-name: 'gerrit.opnfv.org'
81 - patchset-created-event:
82 exclude-drafts: 'false'
83 exclude-trivial-rebase: 'false'
84 exclude-no-code-change: 'false'
85 - draft-published-event
86 - comment-added-contains-event:
87 comment-contains-value: 'recheck'
89 - project-compare-type: 'ANT'
90 project-pattern: '{name}'
92 - branch-compare-type: 'ANT'
93 branch-pattern: '**/{branch}'
96 name: gerrit-trigger-patch-merged
99 server-name: 'gerrit.opnfv.org'
101 - change-merged-event
102 - comment-added-contains-event:
103 comment-contains-value: 'remerge'
105 - project-compare-type: 'ANT'
106 project-pattern: '{name}'
108 - branch-compare-type: 'ANT'
109 branch-pattern: '**/{branch}'
112 name: archive-artifacts
115 artifacts: '{artifacts}'
121 name: email-notification
124 recipients: 'jenkins@lists.opnfv.org'
126 content-type: default
127 subject: '{email-prefix} $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!'
129 $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS:
131 Check console output at $BUILD_URL to view the results.
142 exec-pattern: "**/**.exec"
143 class-pattern: "**/classes"
144 source-pattern: "**/src/main/java"
145 exclusion-pattern: "**/gen/**,**/generated-sources/**,**/yang-gen**"
159 - shell: 'echo testing macro "test-macro"'
162 name: wipe-org-opendaylight-repo
164 - shell: 'if [ -d /tmp/r/org/opendaylight ]; then rm -rf /tmp/r/org/opendaylight; fi'
167 name: jacoco-nojava-workaround
169 - shell: 'mkdir -p $WORKSPACE/target/classes'
175 name: build-html-and-pdf-docs-output
181 export PATH=$PATH:/usr/local/bin/
182 git clone ssh://gerrit.opnfv.org:29418/opnfvdocs docs_build/_opnfvdocs
183 GERRIT_COMMENT=gerrit_comment.txt ./docs_build/_opnfvdocs/scripts/docs-build.sh
186 name: upload-under-review-docs-to-opnfv-artifacts
193 export PATH=$PATH:/usr/local/bin/
195 [[ $GERRIT_CHANGE_NUMBER =~ .+ ]]
196 [[ -d docs_output ]] || exit 0
199 echo "###########################"
200 echo "UPLOADING DOCS UNDER REVIEW"
201 echo "###########################"
204 gs_base="artifacts.opnfv.org/$PROJECT/review"
205 gs_path="$gs_base/$GERRIT_CHANGE_NUMBER"
206 local_path="upload/$GERRIT_CHANGE_NUMBER"
209 mv docs_output "$local_path"
210 gsutil -m cp -r "$local_path" "gs://$gs_base"
213 -h "Content-Type:text/html" \
214 -h "Cache-Control:private, max-age=0, no-transform" \
215 "gs://$gs_path"/**.html > /dev/null 2>&1
217 echo "Document link(s):" >> gerrit_comment.txt
218 find "$local_path" | grep -e 'index.html$' -e 'pdf$' | \
219 sed -e "s|^$local_path| http://$gs_path|" >> gerrit_comment.txt
222 name: upload-generated-docs-to-opnfv-artifacts
229 export PATH=$PATH:/usr/local/bin/
231 [[ -d docs_output ]] || exit 0
234 echo "########################"
235 echo "UPLOADING GENERATED DOCS"
236 echo "########################"
239 gs_path="$GS_URL/docs"
240 local_path="upload/docs"
243 mv docs_output "$local_path"
244 gsutil -m cp -r "$local_path" "gs://$GS_URL"
247 -h "Content-Type:text/html" \
248 -h "Cache-Control:private, max-age=0, no-transform" \
249 "gs://$gs_path"/**.html > /dev/null 2>&1
251 echo "Document link(s):" >> gerrit_comment.txt
252 find "$local_path" | grep -e 'index.html$' -e 'pdf$' | \
253 sed -e "s|^$local_path| http://$gs_path|" >> gerrit_comment.txt
256 name: report-docs-build-result-to-gerrit
263 export PATH=$PATH:/usr/local/bin/
264 if [[ -e gerrit_comment.txt ]] ; then
266 echo "posting review comment to gerrit..."
268 cat gerrit_comment.txt
270 ssh -p 29418 gerrit.opnfv.org \
271 "gerrit review -p $GERRIT_PROJECT \
272 -m '$(cat gerrit_comment.txt)' \
273 $GERRIT_PATCHSET_REVISION \
278 name: remove-old-docs-from-opnfv-artifacts
285 export PATH=$PATH:/usr/local/bin/
287 [[ $GERRIT_CHANGE_NUMBER =~ .+ ]]
289 gs_path="artifacts.opnfv.org/$PROJECT/review/$GERRIT_CHANGE_NUMBER"
291 if gsutil ls "gs://$gs_path" > /dev/null 2>&1 ; then
293 echo "Deleting Out-of-dated Documents..."
294 gsutil -m rm -r "gs://$gs_path"
296 gs_path="artifacts.opnfv.org/review/$GERRIT_CHANGE_NUMBER"
298 if gsutil ls "gs://$gs_path" > /dev/null 2>&1 ; then
300 echo "Deleting Out-of-dated Documents..."
301 gsutil -m rm -r "gs://$gs_path"
305 name: build-and-upload-artifacts-json-api
311 export PATH=$PATH:/usr/local/bin/
313 virtualenv -p python2.7 $WORKSPACE/releng_artifacts
314 source $WORKSPACE/releng_artifacts/bin/activate
316 # install python packages
317 pip install google-api-python-client
319 # generate and upload index file
320 echo "Generating Artifacts API ..."
321 python $WORKSPACE/utils/opnfv-artifacts.py > index.json
322 gsutil cp index.json gs://artifacts.opnfv.org/index.json
327 name: lint-python-code
334 export PATH=$PATH:/usr/local/bin/
336 virtualenv -p python2.7 $WORKSPACE/releng_flake8
337 source $WORKSPACE/releng_flake8/bin/activate
339 # install python packages
340 pip install "flake8==2.6.2"
342 # generate and upload lint log
343 echo "Running flake8 code on $PROJECT ..."
345 # Get number of flake8 violations. If none, this will be an
347 FLAKE_COUNT="$(find . \
348 -path './releng_flake8' -prune -o \
349 -path './.tox' -prune -o \
350 -type f -name "*.py" -print | \
351 xargs flake8 --exit-zero -qq --count 2>&1)"
353 # Ensure we start with a clean environment
356 if [ ! -z $FLAKE_COUNT ]; then
357 echo "Flake8 Violations: $FLAKE_COUNT" > lint.log
359 -path './releng_flake8' -prune -o \
360 -path './.tox' -prune -o \
361 -type f -name "*.py" -print | \
362 xargs flake8 --exit-zero --first >> violation.log
363 SHOWN=$(wc -l violation.log | cut -d' ' -f1)
364 echo -e "First $SHOWN shown\n---" >> lint.log
365 cat violation.log >> lint.log
366 sed -r -i '4,$s/^/ /g' lint.log
373 name: report-lint-result-to-gerrit
380 export PATH=$PATH:/usr/local/bin/
382 # If no violations were found, no lint log will exist.
383 if [[ -e lint.log ]] ; then
384 echo -e "\nposting linting report to gerrit...\n"
389 ssh -p 29418 gerrit.opnfv.org \
390 "gerrit review -p $GERRIT_PROJECT \
391 -m \"$(cat lint.log)\" \
392 $GERRIT_PATCHSET_REVISION \
399 name: upload-review-docs
401 - build-html-and-pdf-docs-output
402 - upload-under-review-docs-to-opnfv-artifacts
403 - report-docs-build-result-to-gerrit
406 name: upload-merged-docs
408 - build-html-and-pdf-docs-output
409 - upload-generated-docs-to-opnfv-artifacts
410 - report-docs-build-result-to-gerrit
411 - remove-old-docs-from-opnfv-artifacts
414 name: check-bash-syntax
416 - shell: "find . -name '*.sh' | xargs bash -n"