CI: Update packer cloud setting to use HCL2 file
[ci-management.git] / jjb / doc / rules.yaml
index 9315bc8..b78c5aa 100644 (file)
@@ -1,11 +1,12 @@
+---
 - scm:
     name: doc-scm
     scm:
       - git:
-          url: 'https://gerrit.onap.org/r/{project}'
-          refspec: '+refs/heads/*:refs/remotes/origin/* +refs/changes/*:refs/changes/*'
+          url: "https://gerrit.onap.org/r/{project}"
+          refspec: "+refs/heads/*:refs/remotes/origin/* +refs/changes/*:refs/changes/*"
           branches:
-            - '{ref}'
+            - "{ref}"
 
 - trigger:
     name: doc-rules-patchset-created
                 comment-contains-value: recheck
             - comment-added-contains-event:
                 comment-contains-value: reverify
-          server-name: 'Primary'
+          server-name: "Primary"
           projects:
-            - project-compare-type: 'ANT'
-              project-pattern: '**'
+            - project-compare-type: "ANT"
+              project-pattern: "**"
               branches:
-                - branch-compare-type: 'ANT'
-                  branch-pattern: '**/*'
-                - branch-compare-type: 'ANT'
-                  branch-pattern: 'refs/tags/**'
+                - branch-compare-type: "ANT"
+                  branch-pattern: "**/*"
+                - branch-compare-type: "ANT"
+                  branch-pattern: "refs/tags/**"
 
 - builder:
     name: doc-rules
     builders:
+      # yamllint disable rule:line-length
       - shell: |
           #!/bin/bash
           . /lib/lsb/init-functions || exit 0
           exitstatus="0"
           warning="0"
           # message, begin
+          log_success_msg "INFO doc-rules Version 23-07-07-A"
           log_success_msg "INFO Starting additional checks related to documentation."
           log_success_msg "INFO See https://git.onap.org/doc/doc-best-practice for example config files (master branch)."
           log_success_msg "INFO Modify example config files if you like to use them in a release branch."
@@ -47,7 +50,7 @@
             exit 0
           fi
           # config files, required
-          for i in docs/index.rst docs/conf.py docs/requirements-docs.txt docs/_static/css/ribbon.css; do
+          for i in docs/index.rst docs/conf.py docs/requirements-docs.txt docs/_static/css/ribbon.css .readthedocs.yaml; do
             if [ ! -f $i ] ; then
               log_failure_msg "FAIL $i missing. Please add it or remove the full docs directory."
               exitstatus="1"
                   log_warning_msg "WARN sphinx-build option '-W' missing for spellcheck in $filename, line $linenumber."
                   warning="1"
                 else
-                  log_failure_msg "FAIL sphinx-build option '-W' missing in $filename, line $linenumber. Please add it."
-                  exitstatus="1"
+                  log_warning_msg "WARN sphinx-build option '-W' missing in $filename, line $linenumber. Please add it."
+                  warning="1"
+                  #log_failure_msg "FAIL sphinx-build option '-W' missing in $filename, line $linenumber. Please add it."
+                  #exitstatus="1"
                 fi
               fi
             done < $filename
             if [ "$sphinxbuild_detected" = "0" ]; then
-              log_failure_msg "FAIL Sphinx-build command(s) missing in $filename. Please add it."
-              exitstatus="1"
+              log_warning_msg "WARN Sphinx-build command(s) missing in $filename. Please add it."
+              warning="1"
+              #log_failure_msg "FAIL Sphinx-build command(s) missing in $filename. Please add it."
+              #exitstatus="1"
             fi
             # second tox.ini @ root directory
             if [ -f ./tox.ini ] ; then
             unset cssmaxwidth
           fi
           unset filename
+          # readthedocs.yaml
+          filename=".readthedocs.yaml"
+          if [ ! -f $filename ]; then
+            log_failure_msg "FAIL $filename missing. Please add it or remove the full docs directory."
+            exitstatus="1"
+          else
+            log_success_msg "INFO $filename found."
+            # obsolete parameter: (build:) image: latest
+            buildimage=$(grep '^[ \t]*image:' $filename | sed -e 's/^[ \t]*//' | sed -e 's/;$//');
+            if [[ $buildimage == *"latest"* ]]; then
+              log_failure_msg "FAIL Setting '(build: image:) latest' found in $filename. Please remove it."
+              exitstatus="1"
+            else
+              log_success_msg "INFO Setting '(build: image:) latest' not found in $filename."
+            fi
+            unset buildimage
+            # obsolete parameter: (python:) version: 3.7
+            pythonversion=$(grep '^[ \t]*version:' $filename | sed -e 's/^[ \t]*//' | sed -e 's/;$//');
+            if [[ $pythonversion == *"3.7"* ]]; then
+              log_failure_msg "FAIL Setting '(python:) version: 3.7' found in $filename. Please remove it."
+              exitstatus="1"
+            else
+              log_success_msg "INFO Setting '(python:) version: 3.7' not found in $filename."
+            fi
+            unset pythonversion
+            # obsolete parameter: submodules:
+            submodules=$(grep '^[ \t]*submodules:' $filename | sed -e 's/^[ \t]*//' | sed -e 's/;$//');
+            if [[ $submodules == *"submodules:"* ]]; then
+              log_failure_msg "FAIL Setting 'submodules:' found in $filename. Please remove it."
+              exitstatus="1"
+            else
+              log_success_msg "INFO Setting 'submodules:' not found in $filename."
+            fi
+            unset submodules
+            # required parameter: (build:) os:
+            buildos=$(grep '^[ \t]*os:' $filename | sed -e 's/^[ \t]*//' | sed -e 's/;$//');
+            if [[ ! $buildos == *"ubuntu-20.04"* ]]; then
+              log_failure_msg "FAIL Setting '(build:) os: ubuntu-20.04' missing in $filename. Please add it."
+              exitstatus="1"
+            else
+              log_success_msg "INFO Setting '(build:) os: ubuntu-20.04' found in $filename."
+            fi
+            unset buildos
+            # required parameter: (build: tools:) python
+            buildtoolspython=$(grep '^[ \t]*python:' $filename | sed -e 's/^[ \t]*//' | sed -e 's/;$//');
+            if [[ ! $buildtoolspython == *\"3.8\"* ]]; then
+              log_failure_msg "FAIL Setting '(build: tools:) python: \"3.8\"' missing in $filename. Please add it."
+              exitstatus="1"
+            else
+              log_success_msg "INFO Setting '(build: tools:) python: \"3.8\"' found in $filename."
+            fi
+            unset buildtoolspython
+          fi
+          unset filename
           # message, end
           if [ "$exitstatus" = "0" ]; then
             if [ "$warning" = "0" ]; then
             log_failure_msg "FAIL Please fix the detected documentation problem(s)!"
           fi
           exit $exitstatus
+      # yamllint enable
 
 - job-template:
     name: doc-rules
       - doc-rules
 
 - project:
-    name: 'doc-rules'
+    name: "doc-rules"
     jobs:
-      - 'doc-rules'
+      - "doc-rules"