diff --git a/src/deploy_release.py b/src/deploy_release.py index 3a9bfae..09965ae 100644 --- a/src/deploy_release.py +++ b/src/deploy_release.py @@ -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: @@ -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) diff --git a/src/main.py b/src/main.py index 9be2003..2637702 100644 --- a/src/main.py +++ b/src/main.py @@ -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( @@ -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: @@ -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")