1 # Copyright (c) 2017 AT&T Intellectual Property. All rights reserved.
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
7 # http://www.apache.org/licenses/LICENSE-2.0
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.
18 # Run the health-check testsuites for the tags discovered by helm list
19 # Please clean up logs when you are done...
21 if [ "$1" == "" ] ; then
22 echo "Usage: eteHelm-k8s.sh [namespace] [execscript]"
23 echo " list projects via helm list and runs health-check with those tags except dev and dev-consul"
24 echo " [execscript] - optional parameter to execute user custom scripts located in scripts/helmscript directory"
32 POD=$(kubectl --namespace $NAMESPACE get pods | sed 's/ .*//'| grep robot)
34 PROJECTS=$(helm list | tail -n +3 | grep '-' | cut -d' ' -f1 | sed -E 's/\w+-(\w+)/health-\1/g' | grep -v consul | grep -v nfs-provision)
37 for project in $PROJECTS ;
39 TAGS="$TAGS -i $project"
43 SCRIPTDIR=scripts/helmscript
47 if [[ "${!#}" == "execscript" ]]; then
48 for script in $(ls -1 "$DIR/$SCRIPTDIR"); do
49 [ -f "$DIR/$SCRIPTDIR/$script" ] && [ -x "$DIR/$SCRIPTDIR/$script" ] && source "$DIR/$SCRIPTDIR/$script"
53 export GLOBAL_BUILD_NUMBER=$(kubectl --namespace $NAMESPACE exec ${POD} -- bash -c "ls -1q /share/logs/ | wc -l")
54 OUTPUT_FOLDER=$(printf %04d $GLOBAL_BUILD_NUMBER)_ete_helmlist
55 DISPLAY_NUM=$(($GLOBAL_BUILD_NUMBER + 90))
57 VARIABLEFILES="-V /share/config/robot_properties.py"
58 VARIABLES="-v GLOBAL_BUILD_NUMBER:$$"
60 kubectl --namespace $NAMESPACE exec ${POD} -- ${ETEHOME}/runTags.sh ${VARIABLEFILES} ${VARIABLES} -d /share/logs/${OUTPUT_FOLDER} ${TAGS} --display $DISPLAY_NUM