From: Thomas Kulik Date: Tue, 17 Nov 2020 14:09:48 +0000 (+0100) Subject: Issue-ID: DOC-686 X-Git-Url: https://gerrit.onap.org/r/gitweb?p=doc.git;a=commitdiff_plain;h=33cf98f667f339c13420468b9918636826500e30 Issue-ID: DOC-686 fixed an error with the url creation for doc repo Signed-off-by: Thomas Kulik Change-Id: I2b6b061dd6c918b2ebf8fb79da019922ddcb64ff --- diff --git a/tools/checkdocs.sh b/tools/checkdocs.sh index 7a9b6735b..f58e1f546 100755 --- a/tools/checkdocs.sh +++ b/tools/checkdocs.sh @@ -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.1 (2020-11-17)" # save command for the restart with logging enabled command=$0 @@ -196,6 +196,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 +568,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 +587,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 +620,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})" diff --git a/tools/checkrtd.sh b/tools/checkrtd.sh index 02574f83b..8be384ccd 100755 --- a/tools/checkrtd.sh +++ b/tools/checkrtd.sh @@ -10,13 +10,14 @@ 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 @@ -25,6 +26,9 @@ readarray -t array < ${file_to_process}; for line in "${array[@]}" do + reponame=$(echo ${line} | cut -d "[" -f2 | cut -d "]" -f1) + #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 @@ -40,7 +44,16 @@ do url_file=$(echo ${line} | sed -r 's/^.+\]//' | sed -r 's/^.*docs\///' | sed -r 's/\.rst$/\.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_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!) # to prevent (server side) cached results a unique element is added to the request @@ -51,7 +64,7 @@ do if [ "${curl_result}" = "0" ]; then curl_result="accessible" elif [ "${curl_result}" = "22" ]; then - curl_result="NOT ACCESSIBLE" + curl_result="does not exist" fi #echo -e "DBUG: ${line}"