Merge "Added links to older release docs for maintained components"
authorAndreas Geissler <andreas-geissler@telekom.de>
Thu, 26 Nov 2020 09:15:16 +0000 (09:15 +0000)
committerGerrit Code Review <gerrit@onap.org>
Thu, 26 Nov 2020 09:15:16 +0000 (09:15 +0000)
docs/guides/onap-developer/apiref/index.rst
tools/checkdocs.sh
tools/checkrtd.sh

index 7cf6be7..9a8970e 100644 (file)
@@ -39,6 +39,7 @@ Platform Components
 * :ref:`SDNC - SDN Controller<onap-sdnc-oam:offeredapis>`
 * :ref:`SO - Service Orchestration<onap-so:offeredapis>`
 * :ref:`VFC - Virtual Function Controller<onap-vfc-nfvo-lcm:master_index>`
+* :ref:`CDS - Controller Design Studio<onap-ccsdk-cds:offeredapis>`
 
 Common Services
 ---------------
index 7a9b673..1f7f10b 100755 (executable)
@@ -58,7 +58,7 @@
 ### SHORT: curl -s 'https://gerrit.onap.org/r/projects/?d' | awk '{if(NR>1)print}' | jq -c '.[] | {id, state}' | sed -r 's:%2F:/:g; s:["{}]::g; s:id\:::; s:,state\::|:; /All-Projects/d; /All-Users/d'
 ###
 
-script_version="1.0 (2020-11-16)"
+script_version="1.2 (2020-11-18)"
 
 # save command for the restart with logging enabled
 command=$0
@@ -71,9 +71,11 @@ fullcommand="${command} ${arguments}"
 
 # print usage
 function usage() {
+  echo "                                                           "
+  echo " checkdocs.sh Version ${script_version}"
   echo "                                                           "
   echo " USAGE:                                                    "
-  echo "  ./checkdocs.sh                                           "
+  echo "  ./checkdocs.sh <arguments>                               "
   echo "                                                           "
   echo " ARGUMENTS:                                                "
   echo "  -u|--user username                                       "
@@ -196,6 +198,7 @@ fi
 
 today=$(date '+%Y-%m-%d');
 repolist="gerrit-repos-master-"$today".txt";
+unique=$(date +%s)
 
 echo "Retrieving a full list of ONAP repositories (master) from gerrit.onap.org."
 
@@ -567,7 +570,12 @@ do
         # OPTIONAL: USE ALSO GITEXITCODE AS A FILTER CRITERIA ???
 
         # url base
-        url_start="https://docs.onap.org/projects/onap"
+        # important! only doc project needs a different url base
+        if [[ ${reponame} == "doc" ]]; then
+          url_start="https://docs.onap.org"
+        else
+          url_start="https://docs.onap.org/projects/onap"
+        fi
         url_lang="en"
         url_branch=${branch}
 
@@ -581,11 +589,17 @@ do
         url_file="index.html"
 
         # build the full url
-        url="${url_start}-${url_repo}/${url_lang}/${url_branch}/${url_file}"
+        if [[ ${reponame} == "doc" ]]; then
+          # build the full url for the doc project
+          url="${url_start}/${url_lang}/${url_branch}/${url_file}"
+        else
+          # build the full url for the other projects
+          url="${url_start}-${url_repo}/${url_lang}/${url_branch}/${url_file}"
+        fi
         #echo "DBUG: url=$url"
 
         # test accessibility of url
-        curl --head --silent --fail "${url}" >/dev/null
+        curl --head --silent --fail "${url}?${unique}" >/dev/null
         curl_result=$?
 
         # convert numeric results to text
@@ -608,7 +622,7 @@ do
           #echo "DBUG: url=$url"
 
           # test accessibility of url in "master branch" (latest)
-          curl --head --silent --fail "${url}" >/dev/null
+          curl --head --silent --fail "${url}?${unique}" >/dev/null
           curl_result=$?
           # denote result as a value from "master" branch (latest)
           url="(${url})"
index 1b60a76..e626dd9 100755 (executable)
@@ -1,19 +1,23 @@
 #!/bin/bash
 #set -x # uncomment for bash script debugging
 
+# branch, e.g. "master" or "guilin"
 branch=$1
+# logfile produced by checkdocs that contains the list of links
 file_to_process=$2
 
 #
 # NOTE: works NOT with elalto release and below because of the submodule structure used for documentation
 #
 
- url_start="https://docs.onap.org/projects/onap"
-  url_lang="en"
+# url
+# important! only doc project needs a different url base
+url_lang="en"
 url_branch=${branch}
+unique=$(date +%s)
 
-# "master" docs are available as "latest" in read-the-docs
-if [ "${url_branch}" = "master" ]; then
+# "master" branch documentation is available as "latest" in RTD
+if [[ ${url_branch} == "master" ]]; then
   url_branch="latest"
 fi
 
@@ -22,6 +26,10 @@ readarray -t array < ${file_to_process};
 for line in "${array[@]}"
 do
 
+  reponame=$(echo ${line} | cut -d "[" -f2 | cut -d "]" -f1)
+  #reponame="[${reponame}]"
+  #echo "DBUG: reponame=${reponame}"
+
   # example line: [dmaap/messagerouter/messageservice]/docs/release-notes/release-notes.rst
   # example url:  https://docs.onap.org/projects/onap-dmaap-messagerouter-messageservice/en/frankfurt/release-notes/release-notes.html
 
@@ -34,25 +42,43 @@ do
   # warning: path does not always contain "docs"!
   # line:   [dmaap/messagerouter/messageservice]/docs/release-notes/release-notes.rst
   # output:                                           release-notes/release-notes.html
-  url_file=$(echo ${line} | sed -r 's/^.+\]//' | sed -r 's/^.*docs\///' | sed -r 's/\.rst$/\.html/' )
+  url_file=$(echo ${line} | sed -r 's/^.+\]//' | sed -r 's/^.*\/docs\///' | sed -r 's/\.rst$/\.html/' )
+
+  #echo "DBUG:     line = ${line}"
+  #echo "DBUG: url_file = ${url_file}"
+  #echo "DBUG: url_repo = ${url_repo}"
+  #echo "DBUG: reponame = ${reponame}"
 
   # build the full url
-  url="${url_start}-${url_repo}/${url_lang}/${url_branch}/${url_file}"
+  if [[ ${reponame} == "doc" ]]; then
+    # build the full url for the doc project
+    url_start="https://docs.onap.org"
+    url="${url_start}/${url_lang}/${url_branch}/${url_file}"
+  else
+    # build the full url for the other projects
+    url_start="https://docs.onap.org/projects/onap"
+    url="${url_start}-${url_repo}/${url_lang}/${url_branch}/${url_file}"
+  fi
+
+  #echo "DBUG:      url = $url"
 
   # check with curl if html page is accessible (no content check!)
-  curl --head --silent --fail "${url}" >/dev/null
+  # to prevent (server side) cached results a unique element is added to the request
+  curl --head --silent --fail "${url}?${unique}" >/dev/null
   curl_result=$?
 
   # "0" and "22" are expected as a curl result
   if [ "${curl_result}" = "0" ]; then
-    curl_result="ok   "
+    curl_result="accessible"
   elif [ "${curl_result}" = "22" ]; then
-    curl_result="ERROR"
+    curl_result="does not exist"
   fi
 
-  echo -e "DBUG:       ${line}"
-  echo -e "DBUG: ${curl_result} ${url}"
-  echo " "
+  #echo -e "DBUG:       ${line}"
+  #echo -e "DBUG: ${curl_result} ${url}"
+  #echo " "
+
+  echo "${line},${url},${curl_result}"
 
   ((i++))
 done