diff --git a/helm-preflights/preflights.sh b/helm-preflights/preflights.sh index c4ea17f..e2e0658 100755 --- a/helm-preflights/preflights.sh +++ b/helm-preflights/preflights.sh @@ -160,6 +160,9 @@ OPTIONS: --reuse Use existing templates if preflights have been played before + --save-local-preflights-output + Save the local preflights output in the current directory + --nosave Do not save results in-cluster (not recommended) @@ -190,6 +193,7 @@ REMOTE_CHECKS="yes" VALUES_FILES="" FORCE="yes" SAVE="yes" +SAVE_LOCAL_PREFLIGHTS_OUTPUT="no" DEBUG_MODE="no" INSTALL_JQ="no" INSTALL_HELM="no" @@ -225,6 +229,10 @@ while (("$#")); do FORCE="no" shift ;; + --save-local-preflights-output) + SAVE_LOCAL_PREFLIGHTS_OUTPUT="yes" + shift + ;; --install-jq) INSTALL_JQ="yes" shift @@ -386,11 +394,15 @@ then LOCAL_CHECKS_STATUS="error" exit_ko fi + if [[ "$SAVE_LOCAL_PREFLIGHTS_OUTPUT" == "no" ]]; + then + rm -f $script_dir/preflightbundle-*.tar.gz + fi fi if [[ "$REMOTE_CHECKS" == "yes" ]]; then - if ! run_hide_output "jq --version" "all"; + if ! jq --version &>/dev/null; then if [[ "$INSTALL_JQ" == "no" ]]; then @@ -455,7 +467,7 @@ then done # Print preflights output - output=`kubectl logs $NAMESPACE $pod` + output=`kubectl logs $NAMESPACE $pod -c remote-preflight` echo -e "$output" GLOBAL_OUTPUT+=" --- RUNNING REMOTE TESTS$output"