X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=tools%2Fcheckrtd.sh;h=e626dd9c17cc7e7e9828555c60888140b0a806d3;hb=2360a44a06e2ce2da7f878cf8303006f74a9e3b5;hp=02574f83b58b73f8006838e1c0b9188dd9450aea;hpb=2c1f5dbabcd65d031d94490f02cf6ff7914a3ae2;p=doc.git diff --git a/tools/checkrtd.sh b/tools/checkrtd.sh index 02574f83b..e626dd9c1 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,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 @@ -37,10 +42,25 @@ 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!) # to prevent (server side) cached results a unique element is added to the request @@ -51,7 +71,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}"