4 name: project-parameter
9 description: "JJB configured PROJECT parameter to identify an opnfv Gerrit project"
12 name: gerrit-parameter
17 description: "JJB configured GERRIT_BRANCH parameter"
23 credentials-id: '{credentials-id}'
32 name: gerrit-trigger-scm
35 credentials-id: '{credentials-id}'
39 - 'origin/$GERRIT_BRANCH'
41 choosing-strategy: '{choosing-strategy}'
52 name: gerrit-trigger-patch-submitted
55 server-name: 'gerrit.opnfv.org'
57 - patchset-created-event:
58 exclude-drafts: 'false'
59 exclude-trivial-rebase: 'false'
60 exclude-no-code-change: 'false'
61 - draft-published-event
62 - comment-added-contains-event:
63 comment-contains-value: 'recheck'
65 - project-compare-type: 'ANT'
66 project-pattern: '{name}'
68 - branch-compare-type: 'ANT'
69 branch-pattern: '**/{branch}'
72 name: gerrit-trigger-patch-merged
75 server-name: 'gerrit.opnfv.org'
78 - comment-added-contains-event:
79 comment-contains-value: 'remerge'
81 - project-compare-type: 'ANT'
82 project-pattern: '{name}'
84 - branch-compare-type: 'ANT'
85 branch-pattern: '**/{branch}'
88 name: archive-artifacts
91 artifacts: '{artifacts}'
97 name: email-notification
100 recipients: 'jenkins@lists.opnfv.org'
102 content-type: default
103 subject: '{email-prefix} $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS!'
105 $PROJECT_NAME - Build # $BUILD_NUMBER - $BUILD_STATUS:
107 Check console output at $BUILD_URL to view the results.
118 exec-pattern: "**/**.exec"
119 class-pattern: "**/classes"
120 source-pattern: "**/src/main/java"
121 exclusion-pattern: "**/gen/**,**/generated-sources/**,**/yang-gen**"
135 - shell: 'echo testing macro "test-macro"'
138 name: wipe-org-opendaylight-repo
140 - shell: 'if [ -d /tmp/r/org/opendaylight ]; then rm -rf /tmp/r/org/opendaylight; fi'
143 name: jacoco-nojava-workaround
145 - shell: 'mkdir -p $WORKSPACE/target/classes'
151 name: build-html-and-pdf-docs-output
156 export PATH=$PATH:/usr/local/bin/
158 [[ $GERRIT_CHANGE_NUMBER =~ .+ ]]
162 from docutils import core, nodes
163 with open('index.rst', 'r') as file:
165 doctree = core.publish_doctree(data,
166 settings_overrides={'report_level': 5,
168 if isinstance(doctree[0], nodes.title):
171 for c in doctree.children:
172 if isinstance(c, nodes.section):
175 print title.astext()"
176 _git_sha1="$(git rev-parse HEAD)"
178 git clone ssh://gerrit.opnfv.org:29418/releng
181 find docs/ -name 'index.rst' -printf '%h\n' | while read dir
185 _output="docs/output/$_name"
188 echo "#################${dir//?/#}"
189 echo "Building DOCS in $dir"
190 echo "#################${dir//?/#}"
193 sed -i "s/_sha1_/$_git_sha1/g" "$dir/index.rst"
195 if [[ ! -f "$dir/conf.py" ]] ; then
196 cp releng/docs/etc/conf.py "$dir/conf.py"
197 _title=$(cd $dir; python -c "$_get_title_script")
198 echo "latex_documents = [('index', '$_name.tex', \"$_title\", 'OPNFV', 'manual'),]" >> "$dir/conf.py"
200 cp -f releng/docs/etc/opnfv-logo.png "$dir/opnfv-logo.png"
204 sphinx-build -b html -E "$dir" "$_output"
206 # Note: PDF creation may fail in project doc builds.
207 # We allow this test to be marked as succeeded with
208 # failure in PDF creation, but leave message to fix it.
209 # Any failure has to be fixed before B release.
211 sphinx-build -b latex -E "$dir" "$_build"
212 make -C "$_build" LATEXOPTS='--interaction=nonstopmode' all-pdf
213 mv "$_build/$_name.pdf" "$_output"
215 _msg="Error: PDF creation for $dir has failed, please fix source rst file(s)."
219 echo "$_msg" >> gerrit_comment.txt
224 name: upload-under-review-docs-to-opnfv-artifacts
229 export PATH=$PATH:/usr/local/bin/
231 [[ $GERRIT_CHANGE_NUMBER =~ .+ ]]
235 echo "###########################"
236 echo "UPLOADING DOCS UNDER REVIEW"
237 echo "###########################"
240 gs_base="artifacts.opnfv.org/review"
241 gs_path="$gs_base/$GERRIT_CHANGE_NUMBER"
242 local_path="docs/$GERRIT_CHANGE_NUMBER"
244 mv docs/output "$local_path"
245 gsutil -m cp -r "$local_path" "gs://$gs_base"
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: upload-merged-docs-to-opnfv-artifacts
264 export PATH=$PATH:/usr/local/bin/
269 echo "#####################"
270 echo "UPLOADING MERGED DOCS"
271 echo "#####################"
274 if [[ "$GERRIT_BRANCH" == "master" ]] ; then
275 gs_base="artifacts.opnfv.org/$GERRIT_PROJECT"
277 gs_base="artifacts.opnfv.org/$GERRIT_PROJECT/$GERRIT_BRANCH"
279 gs_path="$gs_base/docs"
280 local_path="docs/docs"
282 mv docs/output "$local_path"
283 gsutil -m cp -r "$local_path" "gs://$gs_base"
285 if gsutil ls "gs://$gs_path" | grep -e 'html$' > /dev/null 2>&1 ; then
287 -h "Content-Type:text/html" \
288 -h "Cache-Control:private, max-age=0, no-transform" \
289 "gs://$gs_path"/**.html
292 echo "Document link(s):" >> gerrit_comment.txt
293 find "$local_path" | grep -e 'index.html$' -e 'pdf$' | \
294 sed -e "s|^$local_path| http://$gs_path|" >> gerrit_comment.txt
297 name: report-docs-build-result-to-gerrit
301 export PATH=$PATH:/usr/local/bin/
302 if [[ -e gerrit_comment.txt ]] ; then
304 echo "posting review comment to gerrit..."
306 cat gerrit_comment.txt
308 ssh -p 29418 gerrit.opnfv.org \
309 "gerrit review -p $GERRIT_PROJECT \
310 -m '$(cat gerrit_comment.txt)' \
311 $GERRIT_PATCHSET_REVISION"
315 name: remove-old-docs-from-opnfv-artifacts
319 export PATH=$PATH:/usr/local/bin/
321 [[ $GERRIT_CHANGE_NUMBER =~ .+ ]]
323 gs_path="artifacts.opnfv.org/review/$GERRIT_CHANGE_NUMBER"
325 if gsutil ls "gs://$gs_path" > /dev/null 2>&1 ; then
327 echo "Deleting Out-of-dated Documents..."
328 gsutil -m rm -r "gs://$gs_path"
332 name: upload-review-docs
334 - build-html-and-pdf-docs-output
335 - upload-under-review-docs-to-opnfv-artifacts
336 - report-docs-build-result-to-gerrit
339 name: upload-merged-docs
341 - build-html-and-pdf-docs-output
342 - upload-merged-docs-to-opnfv-artifacts
343 - report-docs-build-result-to-gerrit
344 - remove-old-docs-from-opnfv-artifacts