6 url: "https://gerrit.onap.org/r/{project}"
7 refspec: "+refs/heads/*:refs/remotes/origin/* +refs/changes/*:refs/changes/*"
12 name: doc-rules-patchset-created
16 - patchset-created-event
17 - comment-added-contains-event:
18 comment-contains-value: recheck
19 - comment-added-contains-event:
20 comment-contains-value: reverify
21 server-name: "Primary"
23 - project-compare-type: "ANT"
26 - branch-compare-type: "ANT"
27 branch-pattern: "**/*"
28 - branch-compare-type: "ANT"
29 branch-pattern: "refs/tags/**"
34 # yamllint disable rule:line-length
37 . /lib/lsb/init-functions || exit 0
41 log_success_msg "INFO Starting additional checks related to documentation."
42 log_success_msg "INFO See https://git.onap.org/doc/doc-best-practice for example config files (master branch)."
43 log_success_msg "INFO Modify example config files if you like to use them in a release branch."
44 log_success_msg "INFO See https://wiki.onap.org/x/w4IEBw for the detailed procedure #02."
45 log_success_msg "INFO In case of questions please contact the ONAP documentation team."
47 if [ ! -d docs ] ; then
48 log_success_msg "INFO Directory docs not found. Skipping further checks."
51 # config files, required
52 for i in docs/index.rst docs/conf.py docs/requirements-docs.txt docs/_static/css/ribbon.css .readthedocs.yaml; do
54 log_failure_msg "FAIL $i missing. Please add it or remove the full docs directory."
57 log_success_msg "INFO $i found."
60 # config files, no longer required
61 for i in docs/conf.yaml; do
63 log_failure_msg "FAIL $i found. It is no longer required. Please remove it."
66 log_success_msg "INFO $i not found."
69 # tox.ini @ docs directory
70 filename="docs/tox.ini"
71 if [ ! -f $filename ] ; then
72 log_failure_msg "FAIL $filename missing. Please add it or remove the full docs directory."
75 log_success_msg "INFO $filename found."
76 # sphinx-build command and -W option
77 sphinxbuild_detected=0
79 while IFS="" read -r line || [ -n "$line" ] ; do
80 linenumber=$((linenumber+1))
81 if echo $line | grep -q '^[ \t]*sphinx-build.*' ; then
82 sphinxbuild_detected="1"
83 if echo $line | grep -q '^[ \t]*sphinx-build.* -W ' ; then
84 log_success_msg "INFO sphinx-build option '-W' used in $filename, line $linenumber."
85 elif echo $line | grep -q ' \-b spelling ' ; then
86 log_warning_msg "WARN sphinx-build option '-W' missing for spellcheck in $filename, line $linenumber."
89 log_failure_msg "FAIL sphinx-build option '-W' missing in $filename, line $linenumber. Please add it."
94 if [ "$sphinxbuild_detected" = "0" ]; then
95 log_failure_msg "FAIL Sphinx-build command(s) missing in $filename. Please add it."
98 # second tox.ini @ root directory
99 if [ -f ./tox.ini ] ; then
100 # sphinx-build command
101 if cat ./tox.ini | grep -q '^[ \t]*sphinx-build.*' ; then
102 log_warning_msg "WARN tox.ini also exists in root directory and contains sphinx-build command(s). Please check for redundancies."
106 unset sphinxbuild_detected
111 filename="docs/_static/css/ribbon.css"
112 if [ ! -f $filename ]; then
113 log_failure_msg "FAIL $filename missing. Please add it or remove the full docs directory."
116 log_success_msg "INFO $filename found."
117 # max-width parameter
118 cssmaxwidth=$(grep '^[ \t]*max-width:' $filename | sed -e 's/^[ \t]*//' | sed -e 's/;$//');
119 if [[ ! $cssmaxwidth == *"max-width: 800px"* ]]; then
120 log_failure_msg "FAIL Setting 'max-width: 800px' missing in $filename. Please add it."
123 log_success_msg "INFO Setting 'max-width: 800px' found in $filename."
129 filename=".readthedocs.yaml"
130 if [ ! -f $filename ]; then
131 log_failure_msg "FAIL $filename missing. Please add it or remove the full docs directory."
134 log_success_msg "INFO $filename found."
135 # obsolete parameter: (build:) image: latest
136 buildimage=$(grep '^[ \t]*image:' $filename | sed -e 's/^[ \t]*//' | sed -e 's/;$//');
137 if [[ $buildimage == *"latest"* ]]; then
138 log_failure_msg "FAIL Setting '(build: image:) latest' found in $filename. Please remove it."
141 log_success_msg "INFO Setting '(build: image:) latest' not found in $filename."
144 # obsolete parameter: (python:) version: 3.7
145 pythonversion=$(grep '^[ \t]*version:' $filename | sed -e 's/^[ \t]*//' | sed -e 's/;$//');
146 if [[ $pythonversion == *"3.7"* ]]; then
147 log_failure_msg "FAIL Setting '(python:) version: 3.7' found in $filename. Please remove it."
150 log_success_msg "INFO Setting '(python:) version: 3.7' not found in $filename."
153 # obsolete parameter: submodules:
154 submodules=$(grep '^[ \t]*submodules:' $filename | sed -e 's/^[ \t]*//' | sed -e 's/;$//');
155 if [[ $submodules == *"submodules:"* ]]; then
156 log_failure_msg "FAIL Setting 'submodules:' found in $filename. Please remove it."
159 log_success_msg "INFO Setting 'submodules:' not found in $filename."
162 # required parameter: (build:) os:
163 buildos=$(grep '^[ \t]*os:' $filename | sed -e 's/^[ \t]*//' | sed -e 's/;$//');
164 if [[ ! $buildos == *"ubuntu-20.04"* ]]; then
165 log_failure_msg "FAIL Setting '(build:) os: ubuntu-20.04' missing in $filename. Please add it."
168 log_success_msg "INFO Setting '(build:) os: ubuntu-20.04' found in $filename."
171 # required parameter: (build: tools:) python
172 buildtoolspython=$(grep '^[ \t]*python:' $filename | sed -e 's/^[ \t]*//' | sed -e 's/;$//');
173 if [[ ! $buildtoolspython == *\"3.8\"* ]]; then
174 log_failure_msg "FAIL Setting '(build: tools:) python: \"3.8\"' missing in $filename. Please add it."
177 log_success_msg "INFO Setting '(build: tools:) python: \"3.8\"' found in $filename."
179 unset buildtoolspython
183 if [ "$exitstatus" = "0" ]; then
184 if [ "$warning" = "0" ]; then
185 log_success_msg "INFO Congratulations! No documentation problem(s) detected."
187 log_warning_msg "WARN No major documentation problem(s) detected but there are warnings!"
190 if [ ! "$warning" = "0" ]; then
191 log_warning_msg "WARN Please check the detected documentation warning(s)!"
193 log_failure_msg "FAIL Please fix the detected documentation problem(s)!"
200 node: ubuntu1804-docker-8c-8g
202 - doc-rules-patchset-created
206 project: $GERRIT_PROJECT