Skip to content

Commit e2144eb

Browse files
Add environment validation before rollbakc
1 parent 9b89df5 commit e2144eb

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/deploy_release.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from time import strftime, sleep
22
from botocore.exceptions import ClientError
33
import os
4+
import swap_environment
45

56
def main(BUCKET_KEY, S3_ARTIFACTS_BUCKET, BLUE_ENV_NAME, BEANSTALK_APP_NAME, boto_authenticated_client):
67
VERSION_LABEL = strftime("%Y%m%d%H%M%S")
@@ -96,6 +97,14 @@ def rollback_release(client, application_name, environment_name):
9697
except ClientError as err:
9798
print("Failed to create boto3 beanstalk client.\n" + str(err))
9899
return False
100+
environment_info, client = swap_environment.get_environment_information(
101+
beanstalkclient, environment_name)
102+
103+
while environment_info["Environments"][0]["Status"] != "Ready":
104+
sleep(10)
105+
environment_info, client = swap_environment.get_environment_information(
106+
beanstalkclient, environment_name)
107+
99108
response = beanstalkclient.describe_application_versions(
100109
ApplicationName=application_name,
101110
MaxRecords=2

0 commit comments

Comments
 (0)