parent shell updates status
This commit is contained in:
parent
e38c9c65d4
commit
d340f3164d
@ -13,6 +13,7 @@ echo "Asynchronous Updates: $update_limit"
|
|||||||
it=0
|
it=0
|
||||||
while [[ $it -lt ${#array[@]} ]]
|
while [[ $it -lt ${#array[@]} ]]
|
||||||
do
|
do
|
||||||
|
status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status')
|
||||||
proc_count=${#processes[@]}
|
proc_count=${#processes[@]}
|
||||||
count=0
|
count=0
|
||||||
for proc in "${processes[@]}"
|
for proc in "${processes[@]}"
|
||||||
@ -20,7 +21,7 @@ do
|
|||||||
kill -0 "$proc" &> /dev/null || { unset "processes[$count]"; ((proc_count--)); }
|
kill -0 "$proc" &> /dev/null || { unset "processes[$count]"; ((proc_count--)); }
|
||||||
done
|
done
|
||||||
if [[ "$proc_count" -ge "$update_limit" ]]; then
|
if [[ "$proc_count" -ge "$update_limit" ]]; then
|
||||||
sleep 1
|
sleep 3
|
||||||
else
|
else
|
||||||
update_apps "${array[$it]}" &
|
update_apps "${array[$it]}" &
|
||||||
processes+=($!)
|
processes+=($!)
|
||||||
@ -43,8 +44,7 @@ old_app_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{prin
|
|||||||
new_app_ver=$(echo "${array[$it]}" | awk -F ',' '{print $5}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #new Application MAJOR Version
|
new_app_ver=$(echo "${array[$it]}" | awk -F ',' '{print $5}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #new Application MAJOR Version
|
||||||
old_chart_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # Old Chart MAJOR version
|
old_chart_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # Old Chart MAJOR version
|
||||||
new_chart_ver=$(echo "${array[$it]}" | awk -F ',' '{print $5}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # New Chart MAJOR version
|
new_chart_ver=$(echo "${array[$it]}" | awk -F ',' '{print $5}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # New Chart MAJOR version
|
||||||
status=$(echo "${array[$it]}" | awk -F ',' '{print $2}') #status of the app: STOPPED / DEPLOYING / ACTIVE
|
startstatus=$(echo "${array[$it]}" | awk -F ',' '{print $2}') #status of the app: STOPPED / DEPLOYING / ACTIVE
|
||||||
startstatus=$status
|
|
||||||
diff_app=$(diff <(echo "$old_app_ver") <(echo "$new_app_ver")) #caluclating difference in major app versions
|
diff_app=$(diff <(echo "$old_app_ver") <(echo "$new_app_ver")) #caluclating difference in major app versions
|
||||||
diff_chart=$(diff <(echo "$old_chart_ver") <(echo "$new_chart_ver")) #caluclating difference in Chart versions
|
diff_chart=$(diff <(echo "$old_chart_ver") <(echo "$new_chart_ver")) #caluclating difference in Chart versions
|
||||||
old_full_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}') #Upgraded From
|
old_full_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}') #Upgraded From
|
||||||
@ -52,7 +52,7 @@ new_full_ver=$(echo "${array[$it]}" | awk -F ',' '{print $5}') #Upraded To
|
|||||||
rollback_version=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}')
|
rollback_version=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}')
|
||||||
if [[ "$diff_app" == "$diff_chart" || "$update_all_apps" == "true" ]]; then #continue to update
|
if [[ "$diff_app" == "$diff_chart" || "$update_all_apps" == "true" ]]; then #continue to update
|
||||||
if [[ $stop_before_update == "true" ]]; then # Check to see if user is using -S or not
|
if [[ $stop_before_update == "true" ]]; then # Check to see if user is using -S or not
|
||||||
if [[ "$status" == "STOPPED" ]]; then # if status is already stopped, skip while loop
|
if [[ "$startstatus" == "STOPPED" ]]; then # if status is already stopped, skip while loop
|
||||||
echo_array+=("\n$app_name")
|
echo_array+=("\n$app_name")
|
||||||
[[ "$verbose" == "true" ]] && echo_array+=("Updating..")
|
[[ "$verbose" == "true" ]] && echo_array+=("Updating..")
|
||||||
cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo_array+=("Updated\n$old_full_ver\n$new_full_ver") && after_update_actions || echo_array+=("FAILED")
|
cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo_array+=("Updated\n$old_full_ver\n$new_full_ver") && after_update_actions || echo_array+=("FAILED")
|
||||||
@ -61,9 +61,9 @@ rollback_version=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '
|
|||||||
echo_array+=("\n$app_name")
|
echo_array+=("\n$app_name")
|
||||||
[[ "$verbose" == "true" ]] && echo_array+=("Stopping prior to update..")
|
[[ "$verbose" == "true" ]] && echo_array+=("Stopping prior to update..")
|
||||||
midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null && SECONDS=0 || echo_array+=("FAILED")
|
midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null && SECONDS=0 || echo_array+=("FAILED")
|
||||||
while [[ "$status" != "STOPPED" ]]
|
while [[ "$startstatus" != "STOPPED" ]]
|
||||||
do
|
do
|
||||||
status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep "^$app_name," | awk -F ',' '{print $2}')
|
#status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep "^$app_name," | awk -F ',' '{print $2}')
|
||||||
if [[ "$status" == "STOPPED" ]]; then
|
if [[ "$status" == "STOPPED" ]]; then
|
||||||
echo_array+=("Stopped")
|
echo_array+=("Stopped")
|
||||||
[[ "$verbose" == "true" ]] && echo_array+=("Updating..")
|
[[ "$verbose" == "true" ]] && echo_array+=("Updating..")
|
||||||
@ -98,7 +98,7 @@ if [[ $rollback == "true" ]]; then
|
|||||||
while true
|
while true
|
||||||
do
|
do
|
||||||
(( count++ ))
|
(( count++ ))
|
||||||
status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep "^$app_name," | awk -F ',' '{print $2}')
|
status=$(echo "$status" | grep "^$app_name," | awk -F ',' '{print $2}')
|
||||||
if [[ "$status" == "ACTIVE" && "$startstatus" == "STOPPED" ]]; then
|
if [[ "$status" == "ACTIVE" && "$startstatus" == "STOPPED" ]]; then
|
||||||
[[ "$verbose" == "true" ]] && echo_array+=("Returing to STOPPED state..")
|
[[ "$verbose" == "true" ]] && echo_array+=("Returing to STOPPED state..")
|
||||||
midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null && echo_array+=("Stopped")|| echo_array+=("FAILED")
|
midclt call chart.release.scale "$app_name" '{"replica_count": 0}' &> /dev/null && echo_array+=("Stopped")|| echo_array+=("FAILED")
|
||||||
@ -130,7 +130,7 @@ else
|
|||||||
while true #using a constant while loop, then breaking out of the loop with break commands below.
|
while true #using a constant while loop, then breaking out of the loop with break commands below.
|
||||||
do
|
do
|
||||||
(( count++ ))
|
(( count++ ))
|
||||||
status=$(cli -m csv -c 'app chart_release query name,update_available,human_version,human_latest_version,status' | grep "^$app_name," | awk -F ',' '{print $2}')
|
status=$(echo "$status" | grep "^$app_name," | awk -F ',' '{print $2}')
|
||||||
if [[ "$status" == "STOPPED" ]]; then
|
if [[ "$status" == "STOPPED" ]]; then
|
||||||
[[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Stopped..") && sleep 15 && continue #if reports stopped on FIRST time through loop, double check
|
[[ "$count" -le 1 && "$verbose" == "true" ]] && echo_array+=("Verifying Stopped..") && sleep 15 && continue #if reports stopped on FIRST time through loop, double check
|
||||||
[[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports stopped on FIRST time through loop, double check
|
[[ "$count" -le 1 && -z "$verbose" ]] && sleep 15 && continue #if reports stopped on FIRST time through loop, double check
|
||||||
|
Loading…
Reference in New Issue
Block a user