Added conditions in azure-deploy to check for pending upgrade status
Azure Deploy job fails to deploy a newer version if the helm release is in pending upgrade status due to a previous failing job. The changes are done to check for the existing status of helm release and take the following action as per the status -
-
Failed status: rollback to the last successful release and then run helm upgrade. Tested with existing helm status=Failed with this job - https://community.opengroup.org/osdu/platform/system/reference/schema-upgrade/-/jobs/2842993
-
Pending upgrade: wait for 5 minutes before checking the status again. If the status is still pending upgrade/failed, it runs rollback and upgrade. If status is deployed, it proceeds to helm upgrade. Tested with existing helm status=Pending upgrade - https://community.opengroup.org/osdu/platform/system/reference/schema-upgrade/-/jobs/2843754. The upgrade is applied successfully here, the failure is only because there are no code changes because of which the existing pod is not replaced with a new pod while helm waits for the new pod to come up. This scenario will most likely not occur when there are actual code changes for each deployment.
-
Deployed: Applies Helm upgrade. Tested with the job - https://community.opengroup.org/osdu/platform/system/reference/schema-upgrade/-/jobs/2843866