@@ -39,7 +39,7 @@ flow_choose() {
3939 local flow_index=$( _flow_get_index)
4040 if [ " $flow_index " -ge " ${# FLOW_QUEUE[@]} " ]; then
4141 echo " Flow complete." >&2
42- exit 0
42+ exit 1
4343 fi
4444 local idx=" ${FLOW_QUEUE[$flow_index]} "
4545 _flow_set_index $(( flow_index + 1 ))
@@ -103,7 +103,9 @@ run_prerequisite_commands(){
103103 helm repo add incubating-glueops-project-template https://incubating-helm.gpkg.io/project-template
104104 helm repo add projectcalico https://docs.tigera.io/calico/charts
105105 helm repo update
106- helm plugin install https://github.com/databus23/helm-diff
106+ if ! helm plugin list | grep -q ' ^diff' ; then
107+ helm plugin install https://github.com/databus23/helm-diff
108+ fi
107109}
108110
109111check_codespace_version_match (){
@@ -156,7 +158,7 @@ handle_platform_upgrades() {
156158 gum style --foreground 196 --bold " No Overrides.yaml detected"
157159 overrides_file=" platform.yaml"
158160 fi
159- version=$( flow_choose " ${versions[@]} " " Back" )
161+ version=$( flow_choose " ${versions[@]} " " Back" ) || exit 0
160162
161163 # Check if user wants to go back
162164 if [ " $version " = " Back" ]; then
@@ -201,7 +203,7 @@ handle_argocd() {
201203 target_file=" argocd.yaml"
202204 namespace=" glueops-core"
203205 chart_name=" argo/argo-cd"
204- version=$( flow_choose " ${versions[@]} " " Back" )
206+ version=$( flow_choose " ${versions[@]} " " Back" ) || exit 0
205207
206208 # Check if user wants to go back
207209 if [ " $version " = " Back" ]; then
@@ -218,7 +220,7 @@ handle_argocd() {
218220 else
219221 local argocd_crd_versions=` v($( helm search repo argo/argo-cd --versions -o json | jq --arg chart_helm_version " $version " -r ' .[] | select(.version == $chart_helm_version).app_version' | sed ' s/^v//' ) )`
220222 fi
221- chosen_crd_version=$( flow_choose " ${argocd_crd_versions[@]} " " Back" )
223+ chosen_crd_version=$( flow_choose " ${argocd_crd_versions[@]} " " Back" ) || exit 0
222224 pre_commands=" kubectl apply -k \" https://github.com/argoproj/argo-cd/manifests/crds?ref=$chosen_crd_version \" && helm repo update"
223225 # Check if user wants to go back
224226 if [ " $chosen_crd_version " = " Back" ]; then
@@ -302,7 +304,8 @@ handle_kubernetes_version() {
302304
303305
304306handle_aws_options () {
305- local aws_component=$( flow_choose " calico" " eks-addons" " upgrade-eks-nodepools" " upgrade-kubernetes" " Exit" )
307+ local aws_component
308+ aws_component=$( flow_choose " calico" " eks-addons" " upgrade-eks-nodepools" " upgrade-kubernetes" " Exit" ) || exit 0
306309 # Handle exit option
307310 if [ " $aws_component " = " Exit" ]; then
308311 echo " Goodbye!"
@@ -334,7 +337,7 @@ handle_inspect_pods() {
334337
335338show_production (){
336339 while true ; do
337- component=$( flow_choose " show_diff_table" " argocd" " glueops-platform" " aws" " inspect_pods" " Exit" )
340+ component=$( flow_choose " show_diff_table" " argocd" " glueops-platform" " aws" " inspect_pods" " Exit" ) || exit 0
338341
339342 # Handle exit option
340343 if [ " $component " = " Exit" ]; then
@@ -368,7 +371,7 @@ show_production(){
368371
369372show_dev (){
370373 while true ; do
371- component=$( flow_choose " argocd" " glueops-platform" " aws" " Exit" )
374+ component=$( flow_choose " argocd" " glueops-platform" " aws" " Exit" ) || exit 0
372375
373376 # Handle exit option
374377 if [ " $component " = " Exit" ]; then
@@ -397,7 +400,7 @@ run_prerequisite_commands
397400
398401while true ; do
399402 # Show main menu
400- environment=$( flow_choose " dev" " production" " Exit" )
403+ environment=$( flow_choose " dev" " production" " Exit" ) || exit 0
401404
402405 # Handle exit option
403406 if [ " $environment " = " Exit" ]; then
0 commit comments