5 url: 'https://gerrit.onap.org/r/{project}'
6 refspec: '+refs/heads/*:refs/remotes/origin/* +refs/changes/*:refs/changes/*'
11 name: doc-rules-patchset-created
15 - patchset-created-event
16 - comment-added-contains-event:
17 comment-contains-value: recheck
18 - comment-added-contains-event:
19 comment-contains-value: reverify
20 server-name: 'Primary'
22 - project-compare-type: 'ANT'
25 - branch-compare-type: 'ANT'
26 branch-pattern: '**/*'
27 - branch-compare-type: 'ANT'
28 branch-pattern: 'refs/tags/**'
35 . /lib/lsb/init-functions || exit 0
39 log_success_msg "Starting additional checks related to documentation."
40 log_success_msg "See https://git.onap.org/doc/doc-best-practice for example config files (master branch)."
41 log_success_msg "Modify example config files if you like to use them in a release branch."
42 log_success_msg "See https://wiki.onap.org/x/w4IEBw for the detailed procedure #02."
43 log_success_msg "In case of questions please contact the ONAP documentation team."
45 if [ ! -d docs ] ; then
46 log_success_msg "Directory docs not found. Skipping further checks."
49 # config files, required
50 for i in docs/index.rst docs/conf.py docs/requirements-docs.txt docs/_static/css/ribbon.css; do
52 log_failure_msg "$i missing. Please add it or remove the full docs directory."
55 log_success_msg "$i found."
58 # config files, no longer required
59 for i in docs/conf.yaml; do
61 log_failure_msg "$i found. It is no longer required. Please remove it."
64 log_success_msg "$i not found."
67 # tox.ini @ docs directory
68 filename="docs/tox.ini"
69 if [ ! -f $filename ] ; then
70 log_failure_msg "$filename missing. Please add it or remove the full docs directory."
73 log_success_msg "$filename found."
74 # sphinx-build command and -W option
75 sphinxbuild_detected=0
77 while IFS="" read -r line || [ -n "$line" ] ; do
78 linenumber=$((linenumber+1))
79 if echo $line | grep -q '^[ \t]*sphinx-build.*' ; then
80 sphinxbuild_detected="1"
81 if echo $line | grep -q '^[ \t]*sphinx-build.* -W ' ; then
82 log_success_msg "sphinx-build option '-W' used in $filename, line $linenumber."
83 elif echo $line | grep -q ' \-b spelling ' ; then
84 log_warning_msg "sphinx-build option '-W' missing for spellcheck in $filename, line $linenumber."
87 log_failure_msg "sphinx-build option '-W' missing in $filename, line $linenumber. Please add it."
92 if [ "$sphinxbuild_detected" = "0" ]; then
93 log_failure_msg "Sphinx-build command(s) missing in $filename. Please add it."
96 # second tox.ini @ root directory
97 if [ -f ./tox.ini ] ; then
98 # sphinx-build command
99 if cat ./tox.ini | grep -q '^[ \t]*sphinx-build.*' ; then
100 log_warning_msg "tox.ini also exists in root directory and contains sphinx-build command(s). Please check for redundancies."
104 unset sphinxbuild_detected
109 filename="docs/_static/css/ribbon.css"
110 if [ ! -f $filename ]; then
111 log_failure_msg "$filename missing. Please add it or remove the full docs directory."
114 log_success_msg "$filename found."
115 # max-width parameter
116 cssmaxwidth=$(grep '^[ \t]*max-width:' $filename | sed -e 's/^[ \t]*//' | sed -e 's/;$//');
117 if [[ ! $cssmaxwidth == *"max-width: 800px"* ]]; then
118 log_failure_msg "Setting 'max-width: 800px' missing in $filename. Please add it."
121 log_success_msg "Setting 'max-width: 800px' found in $filename."
127 if [ "$exitstatus" = "0" ]; then
128 if [ "$warning" = "0" ]; then
129 log_success_msg "Congratulations! No documentation problem(s) detected."
131 log_warning_msg "No major documentation problem(s) detected but there are warnings!"
134 if [ ! "$warning" = "0" ]; then
135 log_warning_msg "Please check the detected documentation warning(s)!"
137 log_failure_msg "Please fix the detected documentation problem(s)!"
143 node: ubuntu1804-docker-8c-8g
145 - doc-rules-patchset-created
149 project: $GERRIT_PROJECT