async
This commit is contained in:
parent
26bfaf5306
commit
36cc4c1143
@ -31,27 +31,25 @@ done
|
||||
export -f commander
|
||||
|
||||
update_apps(){
|
||||
i=${array[$it]}
|
||||
app_name=$(echo "$i" | awk -F ',' '{print $1}') #print out first catagory, name.
|
||||
old_app_ver=$(echo "$i" | awk -F ',' '{print $4}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #previous/current Application MAJOR Version
|
||||
new_app_ver=$(echo "$i" | awk -F ',' '{print $5}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #new Application MAJOR Version
|
||||
old_chart_ver=$(echo "$i" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # Old Chart MAJOR version
|
||||
new_chart_ver=$(echo "$i" | awk -F ',' '{print $5}' | awk -F '_' '{print $2}' | awk -F '.' '{print $1}') # New Chart MAJOR version
|
||||
status=$(echo "$i" | awk -F ',' '{print $2}') #status of the app: STOPPED / DEPLOYING / ACTIVE
|
||||
app_name=$(echo "${array[$it]}" | awk -F ',' '{print $1}') #print out first catagory, name.
|
||||
old_app_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}' | awk -F '_' '{print $1}' | awk -F '.' '{print $1}') #previous/current 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
|
||||
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=$status
|
||||
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
|
||||
old_full_ver=$(echo "$i" | awk -F ',' '{print $4}') #Upgraded From
|
||||
new_full_ver=$(echo "$i" | awk -F ',' '{print $5}') #Upraded To
|
||||
rollback_version=$(echo "$i" | awk -F ',' '{print $4}' | awk -F '_' '{print $2}')
|
||||
printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo -e "\n$app_name\nIgnored, skipping" && (( current_updates-- )) && return #If application is on ignore list, skip
|
||||
old_full_ver=$(echo "${array[$it]}" | awk -F ',' '{print $4}') #Upgraded From
|
||||
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}')
|
||||
printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo -e "\n$app_name\nIgnored, skipping" && return #If application is on ignore list, skip
|
||||
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 [[ "$status" == "STOPPED" ]]; then # if status is already stopped, skip while loop
|
||||
echo -e "\n$app_name"
|
||||
[[ "$verbose" == "true" ]] && echo "Updating.."
|
||||
cli -c 'app chart_release upgrade release_name=''"'"$app_name"'"' &> /dev/null && echo -e "Updated\n$old_full_ver\n$new_full_ver" && after_update_actions || echo "FAILED"
|
||||
(( current_updates-- ))
|
||||
return
|
||||
else # if status was not STOPPED, stop the app prior to updating
|
||||
echo -e "\n$app_name"
|
||||
@ -81,10 +79,8 @@ printf '%s\0' "${ignore[@]}" | grep -iFxqz "${app_name}" && echo -e "\n$app_name
|
||||
fi
|
||||
else
|
||||
echo -e "\n$app_name\nMajor Release, update manually"
|
||||
(( current_updates-- ))
|
||||
return
|
||||
fi
|
||||
(( current_updates-- ))
|
||||
}
|
||||
export -f update_apps
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user