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: 'brahmaputra-trigger-daily-enabled'
70 name: gerrit-trigger-patch-submitted
73 server-name: 'gerrit.opnfv.org'
75 - patchset-created-event:
76 exclude-drafts: 'false'
77 exclude-trivial-rebase: 'false'
78 exclude-no-code-change: 'false'
79 - draft-published-event
80 - comment-added-contains-event:
81 comment-contains-value: 'recheck'
83 - project-compare-type: 'ANT'
84 project-pattern: '{name}'
86 - branch-compare-type: 'ANT'
87 branch-pattern: '**/{branch}'
90 name: gerrit-trigger-patch-merged
93 server-name: 'gerrit.opnfv.org'
96 - comment-added-contains-event:
97 comment-contains-value: 'remerge'
99 - project-compare-type: 'ANT'
100 project-pattern: '{name}'
102 - branch-compare-type: 'ANT'
103 branch-pattern: '**/{branch}'
106 name: archive-artifacts
109 artifacts: '{artifacts}'
115 name: email-notification
118 recipients: 'jenkins@lists.opnfv.org'
120 content-type: default
121 subject: '{email-prefix} $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!'
123 $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS:
125 Check console output at $BUILD_URL to view the results.
136 exec-pattern: "**/**.exec"
137 class-pattern: "**/classes"
138 source-pattern: "**/src/main/java"
139 exclusion-pattern: "**/gen/**,**/generated-sources/**,**/yang-gen**"
153 - shell: 'echo testing macro "test-macro"'
156 name: wipe-org-opendaylight-repo
158 - shell: 'if [ -d /tmp/r/org/opendaylight ]; then rm -rf /tmp/r/org/opendaylight; fi'
161 name: jacoco-nojava-workaround
163 - shell: 'mkdir -p $WORKSPACE/target/classes'
169 name: build-html-and-pdf-docs-output
175 export PATH=$PATH:/usr/local/bin/
176 git clone ssh://gerrit.opnfv.org:29418/releng
177 GERRIT_COMMENT=gerrit_comment.txt ./releng/utils/docs-build.sh
180 name: upload-under-review-docs-to-opnfv-artifacts
187 export PATH=$PATH:/usr/local/bin/
189 [[ $GERRIT_CHANGE_NUMBER =~ .+ ]]
190 [[ -d docs_output ]] || exit 0
193 echo "###########################"
194 echo "UPLOADING DOCS UNDER REVIEW"
195 echo "###########################"
198 gs_base="artifacts.opnfv.org/$PROJECT/review"
199 gs_path="$gs_base/$GERRIT_CHANGE_NUMBER"
200 local_path="upload/$GERRIT_CHANGE_NUMBER"
203 mv docs_output "$local_path"
204 gsutil -m cp -r "$local_path" "gs://$gs_base"
206 if gsutil ls "gs://$gs_path" | grep -e 'html$' > /dev/null 2>&1 ; then
208 -h "Content-Type:text/html" \
209 -h "Cache-Control:private, max-age=0, no-transform" \
210 "gs://$gs_path"/**.html
213 echo "Document link(s):" >> gerrit_comment.txt
214 find "$local_path" | grep -e 'index.html$' -e 'pdf$' | \
215 sed -e "s|^$local_path| http://$gs_path|" >> gerrit_comment.txt
218 name: upload-generated-docs-to-opnfv-artifacts
225 export PATH=$PATH:/usr/local/bin/
227 [[ -d docs_output ]] || exit 0
230 echo "########################"
231 echo "UPLOADING GENERATED DOCS"
232 echo "########################"
235 gs_path="$GS_URL/docs"
236 local_path="upload/docs"
239 mv docs_output "$local_path"
240 gsutil -m cp -r "$local_path" "gs://$GS_URL"
242 if gsutil ls "gs://$gs_path" | grep -e 'html$' > /dev/null 2>&1 ; then
244 -h "Content-Type:text/html" \
245 -h "Cache-Control:private, max-age=0, no-transform" \
246 "gs://$gs_path"/**.html
249 echo "Document link(s):" >> gerrit_comment.txt
250 find "$local_path" | grep -e 'index.html$' -e 'pdf$' | \
251 sed -e "s|^$local_path| http://$gs_path|" >> gerrit_comment.txt
254 name: report-docs-build-result-to-gerrit
261 export PATH=$PATH:/usr/local/bin/
262 if [[ -e gerrit_comment.txt ]] ; then
264 echo "posting review comment to gerrit..."
266 cat gerrit_comment.txt
268 ssh -p 29418 gerrit.opnfv.org \
269 "gerrit review -p $GERRIT_PROJECT \
270 -m '$(cat gerrit_comment.txt)' \
271 $GERRIT_PATCHSET_REVISION \
276 name: remove-old-docs-from-opnfv-artifacts
283 export PATH=$PATH:/usr/local/bin/
285 [[ $GERRIT_CHANGE_NUMBER =~ .+ ]]
287 gs_path="artifacts.opnfv.org/$PROJECT/review/$GERRIT_CHANGE_NUMBER"
289 if gsutil ls "gs://$gs_path" > /dev/null 2>&1 ; then
291 echo "Deleting Out-of-dated Documents..."
292 gsutil -m rm -r "gs://$gs_path"
294 gs_path="artifacts.opnfv.org/review/$GERRIT_CHANGE_NUMBER"
296 if gsutil ls "gs://$gs_path" > /dev/null 2>&1 ; then
298 echo "Deleting Out-of-dated Documents..."
299 gsutil -m rm -r "gs://$gs_path"
303 name: build-and-upload-artifacts-json-api
309 export PATH=$PATH:/usr/local/bin/
311 virtualenv -p python2.7 $WORKSPACE/releng_artifacts
312 source $WORKSPACE/releng_artifacts/bin/activate
314 # install python packages
315 pip install google-api-python-client
317 # generate and upload index file
318 echo "Generating Artifacts API ..."
319 python $WORKSPACE/utils/opnfv-artifacts.py > index.json
320 gsutil cp index.json gs://artifacts.opnfv.org/index.json
325 name: lint-python-code
332 export PATH=$PATH:/usr/local/bin/
334 virtualenv -p python2.7 $WORKSPACE/releng_flake8
335 source $WORKSPACE/releng_flake8/bin/activate
337 # install python packages
340 # generate and upload lint log
341 echo "Running flake8 code on $PROJECT ..."
343 # Get number of flake8 violations. If none, this will be an
345 FLAKE_COUNT="$(find . \
346 -path './releng_flake8' -prune -o \
347 -type f -name "*.py" -print | \
348 xargs flake8 --exit-zero -qq --count 2>&1)"
350 if [ ! -z $FLAKE_COUNT ]; then
351 echo "Flake8 Violations: $FLAKE_COUNT" >> lint.log
353 -path './releng_flake8' -prune -o \
354 -type f -name "*.py" -print | \
355 xargs flake8 --exit-zero --first >> violation.log
356 SHOWN=$(wc -l violation.log | cut -d' ' -f1)
357 echo -e "First $SHOWN shown\n---" >> lint.log
358 cat violation.log >> lint.log
359 sed -r -i '4,$s/^/ /g' lint.log
362 echo -e "Flake8 Violations: 0" > lint.log
368 name: report-lint-result-to-gerrit
375 export PATH=$PATH:/usr/local/bin/
376 if [[ -e lint.log ]] ; then
377 echo -e "\nposting linting report to gerrit...\n"
380 ssh -p 29418 gerrit.opnfv.org \
381 "gerrit review -p $GERRIT_PROJECT \
382 -m \"$(cat lint.log)\" \
383 $GERRIT_PATCHSET_REVISION \
388 name: upload-review-docs
390 - build-html-and-pdf-docs-output
391 - upload-under-review-docs-to-opnfv-artifacts
392 - report-docs-build-result-to-gerrit
395 name: upload-merged-docs
397 - build-html-and-pdf-docs-output
398 - upload-generated-docs-to-opnfv-artifacts
399 - report-docs-build-result-to-gerrit
400 - remove-old-docs-from-opnfv-artifacts