From 93bd47acc9f68529f59cb9d2d3d3820142324c4c Mon Sep 17 00:00:00 2001 From: Heavybullets8 Date: Thu, 8 Sep 2022 15:02:54 -0600 Subject: [PATCH] add ability to ignore container image updates --- functions/misc.sh | 1 + functions/script_create.sh | 11 ++++++++--- functions/update_apps.sh | 8 ++++++-- heavy_script.sh | 3 +++ 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/functions/misc.sh b/functions/misc.sh index 3812e72a..407c1c41 100644 --- a/functions/misc.sh +++ b/functions/misc.sh @@ -74,6 +74,7 @@ echo "------------------" echo "-b 14 | Back-up your ix-applications dataset, specify a number after -b" echo "-s | sync catalog" echo "-p | Prune unused/old docker images" +echo "--ignore-img | Ignore container image updates" echo "--self-update | Updates HeavyScript prior to running any other commands" echo echo "Examples" diff --git a/functions/script_create.sh b/functions/script_create.sh index de761cc6..63802e63 100644 --- a/functions/script_create.sh +++ b/functions/script_create.sh @@ -83,10 +83,11 @@ do echo echo "Additional Options" echo "------------------" - echo "6) -b | Back-up your ix-applications dataset, specify a number after -b" + echo "6) -b | Back-up your ix-applications dataset" echo "7) -s | sync catalog" echo "8) -p | Prune unused/old docker images" - echo "9) --self-update | Updates HeavyScript prior to running any other commands" + echo "9) --ignore-img | Ignore container image updates" + echo "10) --self-update | Updates HeavyScript prior to running any other commands" echo echo "99) Remove Update Options, Restart" echo "00) Done making selections, proceed with update" @@ -150,7 +151,11 @@ do printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "-p" && echo -e "\"-p\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it update_selection+=("-p") ;; - 9 | --self-update ) + 9 | --ignore-img ) + printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "--ignore-img" && echo -e "\"--ignore-img\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it + update_selection+=("--ignore-img") + ;; + 10 | --self-update ) printf '%s\0' "${update_selection[@]}" | grep -Fxqz -- "--self-update" && echo -e "\"--self-update\" is already on here, skipping" && sleep 3 && continue #If option is already on there, skip it update_selection+=("--self-update") ;; diff --git a/functions/update_apps.sh b/functions/update_apps.sh index 58cb332f..40dbdee3 100644 --- a/functions/update_apps.sh +++ b/functions/update_apps.sh @@ -8,6 +8,7 @@ echo -e "🅄 🄿 🄳 🄰 🅃 🄴 🅂" echo "Asynchronous Updates: $update_limit" [[ -z $timeout ]] && echo "Default Timeout: 500" && timeout=500 || echo "Custom Timeout: $timeout" [[ "$timeout" -le 120 ]] && echo "Warning: Your timeout is set low and may lead to premature rollbacks or skips" +[[ $ignore_image_update == "true" ]] && echo "Image Updates: Disabled" || echo "Image Updates: Enabled" pool=$(cli -c 'app kubernetes config' | grep -E "dataset\s\|" | awk -F '|' '{print $3}' | awk -F '/' '{print $1}' | tr -d " \t\n\r") index=0 @@ -33,12 +34,15 @@ do elif grep -qs "^$app_name," failed 2>/dev/null; then failed_ver=$(grep "^$app_name," failed | awk -F ',' '{print $2}') if [[ "$failed_ver" == "$new_full_ver" ]] ; then - echo -e "\n$app_name" - echo -e "Skipping previously failed version:\n$new_full_ver" + echo -e "\n$app_name\nSkipping previously failed version:\n$new_full_ver" unset "array[$index]" else sed -i /"$app_name",/d failed fi + #Skip Image updates if ignore image updates is set to true + elif [[ $old_full_ver == "$new_full_ver" && $ignore_image_update == "true" ]]; then + echo -e "\n$app_name\nImage update, skipping.." + unset "array[$index]" fi ((index++)) done diff --git a/heavy_script.sh b/heavy_script.sh index d669aac8..0d39316f 100644 --- a/heavy_script.sh +++ b/heavy_script.sh @@ -52,6 +52,9 @@ do delete-backup) deleteBackup="true" ;; + ignore-img) + ignore_image_update="true" + ;; *) echo -e "Invalid Option \"--$OPTARG\"\n" help