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"
212 if gsutil ls "gs://$gs_path" | grep -e 'html$' > /dev/null 2>&1 ; then
214 -h "Content-Type:text/html" \
215 -h "Cache-Control:private, max-age=0, no-transform" \
216 "gs://$gs_path"/**.html
219 echo "Document link(s):" >> gerrit_comment.txt
220 find "$local_path" | grep -e 'index.html$' -e 'pdf$' | \
221 sed -e "s|^$local_path| http://$gs_path|" >> gerrit_comment.txt
224 name: upload-generated-docs-to-opnfv-artifacts
231 export PATH=$PATH:/usr/local/bin/
233 [[ -d docs_output ]] || exit 0
236 echo "########################"
237 echo "UPLOADING GENERATED DOCS"
238 echo "########################"
241 gs_path="$GS_URL/docs"
242 local_path="upload/docs"
245 mv docs_output "$local_path"
246 gsutil -m cp -r "$local_path" "gs://$GS_URL"
248 if gsutil ls "gs://$gs_path" | grep -e 'html$' > /dev/null 2>&1 ; then
250 -h "Content-Type:text/html" \
251 -h "Cache-Control:private, max-age=0, no-transform" \
252 "gs://$gs_path"/**.html
255 echo "Document link(s):" >> gerrit_comment.txt
256 find "$local_path" | grep -e 'index.html$' -e 'pdf$' | \
257 sed -e "s|^$local_path| http://$gs_path|" >> gerrit_comment.txt
260 name: report-docs-build-result-to-gerrit
267 export PATH=$PATH:/usr/local/bin/
268 if [[ -e gerrit_comment.txt ]] ; then
270 echo "posting review comment to gerrit..."
272 cat gerrit_comment.txt
274 ssh -p 29418 gerrit.opnfv.org \
275 "gerrit review -p $GERRIT_PROJECT \
276 -m '$(cat gerrit_comment.txt)' \
277 $GERRIT_PATCHSET_REVISION \
282 name: remove-old-docs-from-opnfv-artifacts
289 export PATH=$PATH:/usr/local/bin/
291 [[ $GERRIT_CHANGE_NUMBER =~ .+ ]]
293 gs_path="artifacts.opnfv.org/$PROJECT/review/$GERRIT_CHANGE_NUMBER"
295 if gsutil ls "gs://$gs_path" > /dev/null 2>&1 ; then
297 echo "Deleting Out-of-dated Documents..."
298 gsutil -m rm -r "gs://$gs_path"
300 gs_path="artifacts.opnfv.org/review/$GERRIT_CHANGE_NUMBER"
302 if gsutil ls "gs://$gs_path" > /dev/null 2>&1 ; then
304 echo "Deleting Out-of-dated Documents..."
305 gsutil -m rm -r "gs://$gs_path"
309 name: build-and-upload-artifacts-json-api
315 export PATH=$PATH:/usr/local/bin/
317 virtualenv -p python2.7 $WORKSPACE/releng_artifacts
318 source $WORKSPACE/releng_artifacts/bin/activate
320 # install python packages
321 pip install google-api-python-client
323 # generate and upload index file
324 echo "Generating Artifacts API ..."
325 python $WORKSPACE/utils/opnfv-artifacts.py > index.json
326 gsutil cp index.json gs://artifacts.opnfv.org/index.json
331 name: lint-python-code
338 export PATH=$PATH:/usr/local/bin/
340 virtualenv -p python2.7 $WORKSPACE/releng_flake8
341 source $WORKSPACE/releng_flake8/bin/activate
343 # install python packages
344 pip install "flake8==2.6.2"
346 # generate and upload lint log
347 echo "Running flake8 code on $PROJECT ..."
349 # Get number of flake8 violations. If none, this will be an
351 FLAKE_COUNT="$(find . \
352 -path './releng_flake8' -prune -o \
353 -path './.tox' -prune -o \
354 -type f -name "*.py" -print | \
355 xargs flake8 --exit-zero -qq --count 2>&1)"
357 # Ensure we start with a clean environment
360 if [ ! -z $FLAKE_COUNT ]; then
361 echo "Flake8 Violations: $FLAKE_COUNT" > lint.log
363 -path './releng_flake8' -prune -o \
364 -path './.tox' -prune -o \
365 -type f -name "*.py" -print | \
366 xargs flake8 --exit-zero --first >> violation.log
367 SHOWN=$(wc -l violation.log | cut -d' ' -f1)
368 echo -e "First $SHOWN shown\n---" >> lint.log
369 cat violation.log >> lint.log
370 sed -r -i '4,$s/^/ /g' lint.log
377 name: report-lint-result-to-gerrit
384 export PATH=$PATH:/usr/local/bin/
386 # If no violations were found, no lint log will exist.
387 if [[ -e lint.log ]] ; then
388 echo -e "\nposting linting report to gerrit...\n"
393 ssh -p 29418 gerrit.opnfv.org \
394 "gerrit review -p $GERRIT_PROJECT \
395 -m \"$(cat lint.log)\" \
396 $GERRIT_PATCHSET_REVISION \
403 name: upload-review-docs
405 - build-html-and-pdf-docs-output
406 - upload-under-review-docs-to-opnfv-artifacts
407 - report-docs-build-result-to-gerrit
410 name: upload-merged-docs
412 - build-html-and-pdf-docs-output
413 - upload-generated-docs-to-opnfv-artifacts
414 - report-docs-build-result-to-gerrit
415 - remove-old-docs-from-opnfv-artifacts
418 name: check-bash-syntax
420 - shell: "find . -name '*.sh' | xargs bash -n"