Skip to content

Commit

Permalink
Remove redeploy feature
Browse files Browse the repository at this point in the history
  • Loading branch information
caiovfernandes committed Jul 24, 2023
1 parent 82e3c9b commit 0232681
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 22 deletions.
6 changes: 1 addition & 5 deletions src/deploy_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import os
import swap_environment

def release_deployment(BUCKET_KEY, S3_ARTIFACTS_BUCKET, BLUE_ENV_NAME, BEANSTALK_APP_NAME, boto_authenticated_client, create_app_version = True):
def release_deployment(BLUE_ENV_NAME, BEANSTALK_APP_NAME, boto_authenticated_client):
VERSION_LABEL = strftime("%Y%m%d%H%M%S")

if "VERSION_LABEL" in os.environ:
Expand All @@ -15,10 +15,6 @@ def release_deployment(BUCKET_KEY, S3_ARTIFACTS_BUCKET, BLUE_ENV_NAME, BEANSTALK
print("Failed to create boto3 beanstalk client.\n" + str(err))
return False

if create_app_version:
if not create_new_version(beanstalkclient, VERSION_LABEL, BUCKET_KEY, S3_ARTIFACTS_BUCKET, BEANSTALK_APP_NAME):
raise Exception("Failed to create beanstalk release.")

# Wait for the new version to be consistent before deploying
wait_until_env_be_ready(beanstalkclient, BLUE_ENV_NAME)

Expand Down
20 changes: 3 additions & 17 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ def main():
print(f"S3_ARTIFACTS_BUCKET = {S3_ARTIFACTS_BUCKET}\n")
print(f"S3_ARTIFACTS_OBJECT {S3_ARTIFACTS_OBJECT}\n")

available_execution_types = ["deploy", "cutover", "full", "rollback", "redeploy"]
available_execution_types = ["deploy", "cutover", "full", "rollback"]
execution_type: str = str(sys.argv[1])


if execution_type not in available_execution_types:
print("Not valid execution type argument: " + execution_type)
print(
Expand Down Expand Up @@ -101,8 +102,7 @@ def main():
try:
print("New release deployment initiated.")
start_3 = time.time()
deploy_release.release_deployment(S3_ARTIFACTS_OBJECT, S3_ARTIFACTS_BUCKET, BLUE_ENV_NAME,
BEANSTALK_APP_NAME, boto_authenticated_client)
deploy_release.release_deployment(BLUE_ENV_NAME, BEANSTALK_APP_NAME, boto_authenticated_client)
print(f"New release deployment has finished successfully!\n\
\tIt took: {time.time() - start_3} seconds\n")
except Exception as err:
Expand Down Expand Up @@ -189,20 +189,6 @@ def main():
sys.exit(1)
print("Rollback has finished successfully!")

# Start redeploy phase
if execution_type == "redeploy":
try:
print("Initiating Re-Deployment of the previous version.")
deploy_release.release_deployment(S3_ARTIFACTS_OBJECT, S3_ARTIFACTS_BUCKET, BLUE_ENV_NAME,
BEANSTALK_APP_NAME, boto_authenticated_client, create_app_version=False)
except Exception as err:
print("Re-Deployment of the previous version has failed!")
print(("Error: " + str(err)))
e = sys.exc_info()[0]
print(e)
traceback.print_exc()
sys.exit(1)

print("Deployment has finished successfully!")
print(f"The process took: {round((time.time() - starting_time), 2)} seconds")

Expand Down

0 comments on commit 0232681

Please sign in to comment.