#!/bin/bash #set -x # uncomment for bash script debugging # ============================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ============LICENSE_END===================================================== ### ### warnstats ### ### AUTHOR(S): ### Thomas Kulik, Deutsche Telekom AG, 2020 ### ### DESCRIPTION: ### warnstat helps to find the onap modules (projects) and rst-files which are ### responsible for the most warnings during the documentation build process. ### it requires a tox build logfile, parses it line by line, prints out some ### statistics and provides links to the local rst file, its html version, the ### related link to readthedocs and as well the doc8 test result for the rst. ### ### ### CHANGELOG (LATEST ON TOP) ### ### 1.6.2 (2020-05-14) - fixed a major problem with rst files within one module ### which have the same name (but reside in different ### subdirectories). they were not shown in the result ### list. introduced a crc-number for every file for proper ### identification and to build the index. ### - fixed a problem where the results are showing the link ### to a wrong file due to a regex problem in the script. ### 1.6.1 (2020-04-21) - fixed a problem with duplicates in rst filenames ### 1.6.0 (2020-04-03) - extended detection of docs pathes in case they are not ### below the submodules directory ### 1.5.0 (2020-03-23) - doc8 test now executed for every rst file. result is ### provided in the output as "doc8_(nnnnn)" where nnnnn ### is the total number of accumulated doc8 errors. ### - improved readability of output ### 1.4.0 (2020-03-18) - the link to the local html and rst file is provided in ### the output. this may help to ease the debug process. ### use mouse-over/context menu functionality of bash to ### easily open files with your browser or rst editor. ### - improved handling for module names (in case they are ### no real onap projects/modules but directories which ### contain additional documentation in rst format). ### 1.3.1 (2020-03-10) - fixed minor typo in usage message ### 1.3.0 (2020-03-09) - initially released to the community ### script_version="1.6.2 (2020-05-14)" doc8_dir=$(pwd)/doc8_results logfile=$1; doc8_command="doc8 --verbose"; #add options if required web_base_url="https://docs.onap.org/en/latest"; echo " "; echo " warnstats version ${script_version}"; declare -A module_array declare -A message_short_array declare -A message_long_array declare -A rstfile_array declare -A rstfilepath_array declare -A htmlfilepath_array declare -A webpath_array declare -A doc8_result_array ### ### simple script argument handling ### # check if there is an argument at all if [[ "$logfile" == "" ]] ; then echo 'Usage: warnstats [tox-logfile]' exit 1 fi # check if argument is a file if [ ! -f $logfile ] ; then echo "Error: can't find tox-logfile \"$logfile\"" exit 1 fi # create and clean doc8 directory if [ ! -d "$doc8_dir" ]; then mkdir $doc8_dir; else rm ${doc8_dir}/*.txt 2>/dev/null; fi # get local html build directory html_build_dir=$(grep "Generated docs available in" $logfile); html_build_dir=$(echo "$html_build_dir" | grep -oP " /.*/doc/docs/_build/html$"); html_build_dir=$(echo "$html_build_dir" | sed -r 's:^ ::'); echo " html build directory ..... $html_build_dir" echo " web base url ............. $web_base_url"; echo " doc8 command ............. $doc8_command"; echo " doc8 results directory ... $doc8_dir"; echo " tox logfile .............. $logfile"; # read in the tox build logfile - use only lines which contain a warning readarray -t logfile_array < <(grep ": WARNING:" $logfile); # process filtered logfile line by line for line in "${logfile_array[@]}" do # count warning lines (( counter++ )); echo -n -e " lines processed .......... $counter (doc8 check may take a while ...)\r"; # # extract path to local rst file # # remove problematic text in the original line that causes regex to fail line=$(echo "$line" | sed -r 's:, other instance in.*::'); path_rst=$line; path_rst_debug=$line; #echo "DBUG line: $line" # remove problematic text in line that causes regex to fail path_rst=$(echo "$path_rst" | sed -r 's:, other instance in.*::'); #echo "DBUG path_rst: $path_rst" # grep the rst file path path_rst=$(echo "$path_rst" | grep -oP "^(/|docs).*\.rst"); #echo "DBUG path_rst: $path_rst" # create an unique identifier for the rst file for the case that the rst file name is used multiple times (but in different subdirectories) within one module rst_crc=$(crc32 "$path_rst" 2>/dev/null); #echo "DBUG rst_crc: $rst_crc" if [[ "$rst_crc" == "" ]] ; then rst_crc="rst_crc_missing" fi if [[ "$path_rst" == "" ]] ; then path_rst="path_to_rst_missing" #echo "DBUG path_rst: $path_rst" #echo "DBUG path_rst_debug: $path_rst_debug" fi # finally embed the full rst path in a message to use mouse-over/context menu of bash to open file path_rst_link='\e]8;;file:'$path_rst'\arst\e]8;;\a'; #echo -e "DBUG path_rst: "$path_rst; # # extract path to the html version of the local rst file # path_html=$line; #echo "DBUG line: $line" # remove problematic text in line that causes regex to fail path_html=$(echo "$path_html" | sed -r 's:, other instance in.*::'); #echo "DBUG path_html: $path_html" # grep the rst file path and modify it so we get the local html build path; grep a little bit more to be save path_html=$(echo "$path_html" | grep -oP "(^|/)docs(/.*|)/[\w -]*\.rst"); #echo "DBUG path_html: $path_html" path_html=$(echo "$path_html" | sed -r 's:^/docs::'); #echo "DBUG path_html: $path_html" path_html=$(echo "$path_html" | sed -r 's:.rst:.html:'); #echo "DBUG path_html: $path_html" # create also the path to the web version path_web_link='\e]8;;'${web_base_url}${path_html}'\aweb\e]8;;\a'; #echo "DBUG path_web_link: $path_web_link" # finally embed the full html path in a message to use mouse-over/context menu of bash to open file path_html_link='\e]8;;file:'${html_build_dir}${path_html}'\ahtml\e]8;;\a'; #echo -e "DBUG path_html_link: "$path_html_link; # extract module name from line (remove all text before module name; then cut out module name) module=$(echo "$line" | sed -r 's:(^.*/doc/docs/submodules/|^docs/submodules/|checking consistency... )::' | cut -f1 -d\/); #echo "DBUG line: $line" #echo "DBUG module: $module" # in case the extraction has not lead to a valid module name do some additional investigation if [[ "$module" == "" ]] ; then if [[ $line =~ doc/docs/release ]] ; then module="docs_release" #echo "DBUG line: $line" #echo "DBUG module: $module" elif [[ $line =~ doc/docs/use-cases ]] ; then module="docs_use-cases" #echo "DBUG line: $line" #echo "DBUG module: $module" elif [[ $line =~ doc/docs/guides/onap-developer ]] ; then module="docs_guides_onap-developer" #echo "DBUG line: $line" #echo "DBUG module: $module" elif [[ $line =~ doc/docs/guides/onap-operator ]] ; then module="docs_guides_onap-operator" #echo "DBUG line: $line" #echo "DBUG module: $module" elif [[ $line =~ doc/docs/guides/onap-provider ]] ; then module="docs_guides_onap-provider" #echo "DBUG line: $line" #echo "DBUG module: $module" elif [[ $line =~ doc/docs/guides/onap-user ]] ; then module="docs_guides_onap-user" #echo "DBUG line: $line" #echo "DBUG module: $module" elif [[ $line =~ doc/docs/guides/overview ]] ; then module="docs_guides_overview" #echo "DBUG line: $line" #echo "DBUG module: $module" elif [[ $line =~ doc/docs/templates ]] ; then module="docs_templates" #echo "DBUG line: $line" #echo "DBUG module: $module" elif [[ $line =~ doc/docs/guides ]] ; then module="docs_guides" #echo "DBUG line: $line" #echo "DBUG module: $module" else module="docs" #echo "DBUG line: $line" #echo "DBUG module: $module" fi fi #echo "DBUG line: $line"; #echo "DBUG module: $module"; # get the maximum length of the variable entries to adjust table width later on if [[ ${#module} -gt "$maxlength_module" ]]; then maxlength_module=${#module}; fi #echo "DBUG maxlength_module=$maxlength_module"; # extract rst file name from line and do some formatting to use it later as an array name #echo "DBUG line: $line"; rstfile=$(echo "$line" | sed -r 's:, other instance in.*::'); rstfile=$(echo -e "${rstfile}" | grep -oP "[\w -]*\.rst"); rstfile=$(echo -e ${rstfile} | tr '[:blank:]' '_'); #echo "DBUG rstfile: '$rstfile'"; # get the maximum length of the variable entries to adjust table width later on if [[ ${#rstfile} -gt "$maxl
# Copyright © 2018 AT&T USA
# Copyright © 2020 Huawei
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#       http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#################################################################
# Global configuration defaults.
#################################################################
global:
  nodePortPrefix: 302
  nodePortPrefixExt: 304
  persistence:
    mountPath: /dockerdata-nfs
  app:
    msoKey: 07a7159d3bf51a0e53be7a8f89699be7
  mariadbGalera:
    serviceName: mariadb-galera
    servicePort: '3306'

readinessCheck:
  wait_for:
    jobs:
      - '{{ include "common.release" . }}-so-mariadb-config-job'

#################################################################
# Secrets metaconfig
#################################################################
secrets:
  - uid: db-user-creds
    name: '{{ include "common.release" . }}-so-catalog-db-adapter-db-user-creds'
    type: basicAuth
    externalSecret: '{{ tpl (default "" .Values.db.userCredsExternalSecret) . }}'
    login: '{{ .Values.db.userName }}'
    password: '{{ .Values.db.userPassword }}'
    passwordPolicy: required
  - uid: db-admin-creds
    name: '{{ include "common.release" . }}-so-catalog-db-adapter-db-admin-creds'
    type: basicAuth
    externalSecret: '{{ tpl (default "" .Values.db.adminCredsExternalSecret) . }}'
    login: '{{ .Values.db.adminName }}'
    password: '{{ .Values.db.adminPassword }}'
    passwordPolicy: required

#secretsFilePaths: |
#  - 'my file 1'
#  - '{{ include "templateThatGeneratesFileName" . }}'

#################################################################
# Application configuration defaults.
#################################################################
image: onap/so/catalog-db-adapter:1.11.0
pullPolicy: