2 #set -x # uncomment for bash script debugging
8 # NOTE: works NOT with elalto release and below because of the submodule structure used for documentation
11 url_start="https://docs.onap.org/projects/onap"
15 # "master" docs are available as "latest" in read-the-docs
16 if [ "${url_branch}" = "master" ]; then
20 #readarray -t array < ./${branch}_releasenotes.log;
21 readarray -t array < ${file_to_process};
22 for line in "${array[@]}"
25 # example line: [dmaap/messagerouter/messageservice]/docs/release-notes/release-notes.rst
26 # example url: https://docs.onap.org/projects/onap-dmaap-messagerouter-messageservice/en/frankfurt/release-notes/release-notes.html
28 # extract repo name which comes in square bracktes ([...]) and convert slash (/) to minus (-)
29 # line: [dmaap/messagerouter/messageservice]/docs/release-notes/release-notes.rst
30 # output: dmaap-messagerouter-messageservice
31 url_repo=$(echo ${line} | sed -r 's/].+$//' | sed -r 's/\[//' | sed -r 's/\//-/g')
33 # extract rst filename and its path; replace .rst ending with .html
34 # warning: path does not always contain "docs"!
35 # line: [dmaap/messagerouter/messageservice]/docs/release-notes/release-notes.rst
36 # output: release-notes/release-notes.html
37 url_file=$(echo ${line} | sed -r 's/^.+\]//' | sed -r 's/^.*docs\///' | sed -r 's/\.rst$/\.html/' )
40 url="${url_start}-${url_repo}/${url_lang}/${url_branch}/${url_file}"
42 # check with curl if html page is accessible (no content check!)
43 curl --head --silent --fail "${url}" >/dev/null
46 # "0" and "22" are expected as a curl result
47 if [ "${curl_result}" = "0" ]; then
49 elif [ "${curl_result}" = "22" ]; then
53 echo -e "DBUG: ${line}"
54 echo -e "DBUG: ${curl_result} ${url}"