Skip to content
Snippets Groups Projects
Commit 60db5c7a authored by Sebastian Kehr's avatar Sebastian Kehr 🚣🏼
Browse files

enable --set-file and --values arguments and retain order

parent 3a960861
1 merge request!2More options for setting/overriding values
This commit is part of merge request !2. Comments created here will be created in the context of that merge request.
......@@ -11,10 +11,9 @@ ca_file="${HOME}/k8s-ca.crt"
image_file=""
dockerconfig=""
tags=""
valueargs=""
buildargs=""
charts=""
sets=""
setstrings=""
name=""
certificate_authority=""
token=""
......@@ -29,7 +28,7 @@ if [[ ${PIPESTATUS[0]} -ne 4 ]]; then
fi
OPTIONS=
LONGOPTS=docker-config:,tag:,build-arg:,set:,set-string:,charts:,name:,token:,certificate-authority:,namespace:,cluster-url:,service-account:,output:,input:
LONGOPTS=docker-config:,tag:,build-arg:,values:,set:,set-string:,:set-file,charts:,name:,token:,certificate-authority:,namespace:,cluster-url:,service-account:,output:,input:
# -use ! and PIPESTATUS to get exit code with errexit set
# -temporarily store output to be able to check for errors
......@@ -59,14 +58,10 @@ while true; do
buildargs="${buildargs} $2"
shift 2
;;
-s|--set)
sets="${sets} $2"
shift 2
;;
--set-string)
setstrings="${setstrings} $2"
shift 2
;;
-f|--values|-s|--set|--set-string|--set-file)
valueargs="${valueargs} $1 $2"
shift 2
;;
-c|--charts)
charts="$2"
shift 2
......@@ -244,17 +239,9 @@ helm_deploy() {
fi
fi
cmd="helm upgrade --install --wait --timeout=60 --tiller-namespace=${namespace} --namespace=${namespace}"
for set in ${sets};do
cmd="$cmd --set ${set}"
done
for setstring in ${setstrings}; do
cmd="$cmd --set-string ${setstring}"
done
cmd="$cmd ${name} ${charts}"
valueargs=$(echo -e "$valueargs" | sed -E 's/(^[[:space:]]*)|([[:space:]]*$)//g')
cmd="helm upgrade --install --wait --timeout=60 --tiller-namespace=${namespace}"
cmd="$cmd --namespace=${namespace} ${name} ${charts} ${valueargs}"
out=`$cmd 2>&1`
if [ "$?" != "0" ];then
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment