Brian Freeman | 3163151 | 2019-04-11 12:28:52 -0500 | [diff] [blame] | 1 | # Copyright (c) 2017 AT&T Intellectual Property. All rights reserved. |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | |
| 15 | #!/bin/bash |
| 16 | |
| 17 | # |
kaihlavi | 30824ba | 2019-05-10 08:57:14 +0300 | [diff] [blame] | 18 | # Run the health-check testsuites for the tags discovered by helm list |
Brian Freeman | 3163151 | 2019-04-11 12:28:52 -0500 | [diff] [blame] | 19 | # Please clean up logs when you are done... |
Brian Freeman | 3163151 | 2019-04-11 12:28:52 -0500 | [diff] [blame] | 20 | # |
| 21 | if [ "$1" == "" ] ; then |
kaihlavi | 30824ba | 2019-05-10 08:57:14 +0300 | [diff] [blame] | 22 | echo "Usage: eteHelm-k8s.sh [namespace]" |
kaihlavi | 7a41110 | 2019-05-09 16:31:15 +0300 | [diff] [blame] | 23 | echo " list projects via helm list and runs health-check with those tags except dev and dev-consul" |
Brian Freeman | 3163151 | 2019-04-11 12:28:52 -0500 | [diff] [blame] | 24 | exit |
| 25 | fi |
| 26 | |
| 27 | set -x |
| 28 | |
| 29 | export NAMESPACE="$1" |
| 30 | |
| 31 | POD=$(kubectl --namespace $NAMESPACE get pods | sed 's/ .*//'| grep robot) |
| 32 | |
Brian Freeman | 32ad67d | 2019-04-26 12:18:41 -0500 | [diff] [blame] | 33 | PROJECTS=$(helm list | tail +3 | grep '-' | cut -d' ' -f1 | sed -E 's/\w+-(\w+)/health-\1/g' | grep -v consul | grep -v nfs-provision) |
Brian Freeman | 3163151 | 2019-04-11 12:28:52 -0500 | [diff] [blame] | 34 | |
| 35 | TAGS="" |
| 36 | for project in $PROJECTS ; |
| 37 | do |
| 38 | TAGS="$TAGS -i $project" |
| 39 | done |
| 40 | |
| 41 | |
| 42 | ETEHOME=/var/opt/ONAP |
| 43 | export GLOBAL_BUILD_NUMBER=$(kubectl --namespace $NAMESPACE exec ${POD} -- bash -c "ls -1q /share/logs/ | wc -l") |
| 44 | OUTPUT_FOLDER=$(printf %04d $GLOBAL_BUILD_NUMBER)_ete_helmlist |
| 45 | DISPLAY_NUM=$(($GLOBAL_BUILD_NUMBER + 90)) |
| 46 | |
| 47 | VARIABLEFILES="-V /share/config/vm_properties.py -V /share/config/integration_robot_properties.py -V /share/config/integration_preload_parameters.py" |
| 48 | VARIABLES="-v GLOBAL_BUILD_NUMBER:$$" |
| 49 | |
| 50 | kubectl --namespace $NAMESPACE exec ${POD} -- ${ETEHOME}/runTags.sh ${VARIABLEFILES} ${VARIABLES} -d /share/logs/${OUTPUT_FOLDER} ${TAGS} --display $DISPLAY_NUM |