Add ways to handling alembic script failure
Is your idea related to a problem? Please describe. Now that the alembic script are run in a lambda and an alembic script fails the stack responsible for alembic script upgrade deosn't roll back properly and is stuck in "UPDATE_ROLLBACK_FAILED" state.
This happens because possibly because, While building the ECR image for lambda, the code with new alembic changes is used and then the stack fails. After the stack fails, the ECR image is reverted to the older image and then the alembic script runs again as a part of rollback This fails since the alembic version in the database is already upgraded to a new version and then the script associated with that version is not found. This causes an error This doesn't let the stack come to a proper state even after clicking on "Continue Update Rollback" on the main backend stack.
Describe the solution you'd like In case of failure in upgrading database or in case of updating permission, the rollback should be successfully pass.
P.S. Don't attach files. Please, prefer add code snippets directly in the message body.