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/$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}'
60 name: 'daily-trigger-disabled'
65 name: 'weekly-trigger-disabled'
70 name: 'brahmaputra-trigger-daily-enabled'
75 name: gerrit-trigger-patch-submitted
78 server-name: 'gerrit.opnfv.org'
80 - patchset-created-event:
81 exclude-drafts: 'false'
82 exclude-trivial-rebase: 'false'
83 exclude-no-code-change: 'false'
84 - draft-published-event
85 - comment-added-contains-event:
86 comment-contains-value: 'recheck'
88 - project-compare-type: 'ANT'
89 project-pattern: '{name}'
91 - branch-compare-type: 'ANT'
92 branch-pattern: '**/{branch}'
95 name: gerrit-trigger-patch-merged
98 server-name: 'gerrit.opnfv.org'
100 - change-merged-event
101 - comment-added-contains-event:
102 comment-contains-value: 'remerge'
104 - project-compare-type: 'ANT'
105 project-pattern: '{name}'
107 - branch-compare-type: 'ANT'
108 branch-pattern: '**/{branch}'
111 name: archive-artifacts
114 artifacts: '{artifacts}'
120 name: email-notification
123 recipients: 'jenkins@lists.opnfv.org'
125 content-type: default
126 subject: '{email-prefix} $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!'
128 $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS:
130 Check console output at $BUILD_URL to view the results.
141 exec-pattern: "**/**.exec"
142 class-pattern: "**/classes"
143 source-pattern: "**/src/main/java"
144 exclusion-pattern: "**/gen/**,**/generated-sources/**,**/yang-gen**"
158 - shell: 'echo testing macro "test-macro"'
161 name: wipe-org-opendaylight-repo
163 - shell: 'if [ -d /tmp/r/org/opendaylight ]; then rm -rf /tmp/r/org/opendaylight; fi'
166 name: jacoco-nojava-workaround
168 - shell: 'mkdir -p $WORKSPACE/target/classes'
174 name: build-html-and-pdf-docs-output
180 export PATH=$PATH:/usr/local/bin/
181 git clone ssh://gerrit.opnfv.org:29418/opnfvdocs docs_build/_opnfvdocs
182 GERRIT_COMMENT=gerrit_comment.txt ./docs_build/_opnfvdocs/scripts/docs-build.sh
185 name: upload-under-review-docs-to-opnfv-artifacts
192 export PATH=$PATH:/usr/local/bin/
194 [[ $GERRIT_CHANGE_NUMBER =~ .+ ]]
195 [[ -d docs_output ]] || exit 0
198 echo "###########################"
199 echo "UPLOADING DOCS UNDER REVIEW"
200 echo "###########################"
203 gs_base="artifacts.opnfv.org/$PROJECT/review"
204 gs_path="$gs_base/$GERRIT_CHANGE_NUMBER"
205 local_path="upload/$GERRIT_CHANGE_NUMBER"
208 mv docs_output "$local_path"
209 gsutil -m cp -r "$local_path" "gs://$gs_base"
211 if gsutil ls "gs://$gs_path" | grep -e 'html$' > /dev/null 2>&1 ; then
213 -h "Content-Type:text/html" \
214 -h "Cache-Control:private, max-age=0, no-transform" \
215 "gs://$gs_path"/**.html
218 echo "Document link(s):" >> gerrit_comment.txt
219 find "$local_path" | grep -e 'index.html$' -e 'pdf$' | \
220 sed -e "s|^$local_path| http://$gs_path|" >> gerrit_comment.txt
223 name: upload-generated-docs-to-opnfv-artifacts
230 export PATH=$PATH:/usr/local/bin/
232 [[ -d docs_output ]] || exit 0
235 echo "########################"
236 echo "UPLOADING GENERATED DOCS"
237 echo "########################"
240 gs_path="$GS_URL/docs"
241 local_path="upload/docs"
244 mv docs_output "$local_path"
245 gsutil -m cp -r "$local_path" "gs://$GS_URL"
247 if gsutil ls "gs://$gs_path" | grep -e 'html$' > /dev/null 2>&1 ; then
249 -h "Content-Type:text/html" \
250 -h "Cache-Control:private, max-age=0, no-transform" \
251 "gs://$gs_path"/**.html
254 echo "Document link(s):" >> gerrit_comment.txt
255 find "$local_path" | grep -e 'index.html$' -e 'pdf$' | \
256 sed -e "s|^$local_path| http://$gs_path|" >> gerrit_comment.txt
259 name: report-docs-build-result-to-gerrit
266 export PATH=$PATH:/usr/local/bin/
267 if [[ -e gerrit_comment.txt ]] ; then
269 echo "posting review comment to gerrit..."
271 cat gerrit_comment.txt
273 ssh -p 29418 gerrit.opnfv.org \
274 "gerrit review -p $GERRIT_PROJECT \
275 -m '$(cat gerrit_comment.txt)' \
276 $GERRIT_PATCHSET_REVISION \
281 name: remove-old-docs-from-opnfv-artifacts
288 export PATH=$PATH:/usr/local/bin/
290 [[ $GERRIT_CHANGE_NUMBER =~ .+ ]]
292 gs_path="artifacts.opnfv.org/$PROJECT/review/$GERRIT_CHANGE_NUMBER"
294 if gsutil ls "gs://$gs_path" > /dev/null 2>&1 ; then
296 echo "Deleting Out-of-dated Documents..."
297 gsutil -m rm -r "gs://$gs_path"
299 gs_path="artifacts.opnfv.org/review/$GERRIT_CHANGE_NUMBER"
301 if gsutil ls "gs://$gs_path" > /dev/null 2>&1 ; then
303 echo "Deleting Out-of-dated Documents..."
304 gsutil -m rm -r "gs://$gs_path"
308 name: build-and-upload-artifacts-json-api
314 export PATH=$PATH:/usr/local/bin/
316 virtualenv -p python2.7 $WORKSPACE/releng_artifacts
317 source $WORKSPACE/releng_artifacts/bin/activate
319 # install python packages
320 pip install google-api-python-client
322 # generate and upload index file
323 echo "Generating Artifacts API ..."
324 python $WORKSPACE/utils/opnfv-artifacts.py > index.json
325 gsutil cp index.json gs://artifacts.opnfv.org/index.json
330 name: lint-python-code
337 export PATH=$PATH:/usr/local/bin/
339 virtualenv -p python2.7 $WORKSPACE/releng_flake8
340 source $WORKSPACE/releng_flake8/bin/activate
342 # install python packages
345 # generate and upload lint log
346 echo "Running flake8 code on $PROJECT ..."
348 # Get number of flake8 violations. If none, this will be an
350 FLAKE_COUNT="$(find . \
351 -path './releng_flake8' -prune -o \
352 -type f -name "*.py" -print | \
353 xargs flake8 --exit-zero -qq --count 2>&1)"
355 # Ensure we start with a clean environment
358 if [ ! -z $FLAKE_COUNT ]; then
359 echo "Flake8 Violations: $FLAKE_COUNT" > lint.log
361 -path './releng_flake8' -prune -o \
362 -type f -name "*.py" -print | \
363 xargs flake8 --exit-zero --first >> violation.log
364 SHOWN=$(wc -l violation.log | cut -d' ' -f1)
365 echo -e "First $SHOWN shown\n---" >> lint.log
366 cat violation.log >> lint.log
367 sed -r -i '4,$s/^/ /g' lint.log
374 name: report-lint-result-to-gerrit
381 export PATH=$PATH:/usr/local/bin/
383 # If no violations were found, no lint log will exist.
384 if [[ -e lint.log ]] ; then
385 echo -e "\nposting linting report to gerrit...\n"
390 ssh -p 29418 gerrit.opnfv.org \
391 "gerrit review -p $GERRIT_PROJECT \
392 -m \"$(cat lint.log)\" \
393 $GERRIT_PATCHSET_REVISION \
400 name: upload-review-docs
402 - build-html-and-pdf-docs-output
403 - upload-under-review-docs-to-opnfv-artifacts
404 - report-docs-build-result-to-gerrit
407 name: upload-merged-docs
409 - build-html-and-pdf-docs-output
410 - upload-generated-docs-to-opnfv-artifacts
411 - report-docs-build-result-to-gerrit
412 - remove-old-docs-from-opnfv-artifacts