add ability to ignore container image updates

This commit is contained in:
Heavybullets8 2022-09-08 15:02:54 -06:00
parent 233ecc1820
commit 93bd47acc9
4 changed files with 18 additions and 5 deletions

View File

@ -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"

View File

@ -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")
;;

View File

@ -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

View File

@ -52,6 +52,9 @@ do
delete-backup)
deleteBackup="true"
;;
ignore-img)
ignore_image_update="true"
;;
*)
echo -e "Invalid Option \"--$OPTARG\"\n"
help