diff --git a/cdk_deployment/sdc_aws_processing_lambda.py b/cdk_deployment/sdc_aws_processing_lambda.py index 70106c6..81c5570 100755 --- a/cdk_deployment/sdc_aws_processing_lambda.py +++ b/cdk_deployment/sdc_aws_processing_lambda.py @@ -65,12 +65,16 @@ def __init__( code=aws_lambda.DockerImageCode.from_ecr(ecr_repository, tag_or_digest=TAG), environment={ "LAMBDA_ENVIRONMENT": config["DEPLOYMENT_ENVIRONMENT"], - "RDS_SECRET_ARN": rds_credentials_secret.secret_arn - if not os.getenv("DRY_RUN") - else "", - "RDS_HOST": db_instance.db_instance_endpoint_address - if not os.getenv("DRY_RUN") - else "", + "RDS_SECRET_ARN": ( + rds_credentials_secret.secret_arn + if not os.getenv("DRY_RUN") + else "" + ), + "RDS_HOST": ( + db_instance.db_instance_endpoint_address + if not os.getenv("DRY_RUN") + else "" + ), "RDS_PORT": str( db_instance.db_instance_endpoint_port if not os.getenv("DRY_RUN") diff --git a/terraform/buildspec.yml b/terraform/buildspec.yml deleted file mode 100644 index 4306e9d..0000000 --- a/terraform/buildspec.yml +++ /dev/null @@ -1,66 +0,0 @@ -version: 0.2 - -phases: - pre_build: - commands: - - echo Installing CI/CD Dependencies... - - python -m venv venv - - echo "source venv/bin/activate" > activate.sh - - bash activate.sh - - pip3 install --upgrade pip setuptools wheel - - pip3 install -r requirements.txt - - echo ________________________________ - - - echo Linting with Black... - - black --check --diff lambda_function/ - - echo ________________________________ - - - echo Linting with Flake... - - flake8 --count --max-line-length 100 lambda_function/ - - echo ________________________________ - - build: - commands: - - REGION=us-east-1 - - echo Login to Private ECR $REGION - - aws ecr get-login-password --region $REGION | docker login --username AWS --password-stdin 351967858401.dkr.ecr.$REGION.amazonaws.com - - echo ________________________________ - - ACCOUNT_ID=$(aws sts get-caller-identity --query 'Account' --output text) - - - | - if git describe --tags --exact-match > /dev/null 2>&1; then - echo "This is a tag push event" - ECR_REPO="$ACCOUNT_ID.dkr.ecr.$REGION.amazonaws.com/sdc_aws_artifacts_lambda" - CDK_ENVIRONMENT=PRODUCTION - VERSION=`git describe --tags --exact-match` - elif [[ "${CDK_ENVIRONMENT}" == "PRODUCTION" ]]; then - echo "This is a production environment" - ECR_REPO="$ACCOUNT_ID.dkr.ecr.$REGION.amazonaws.com/sdc_aws_artifacts_lambda" - CDK_ENVIRONMENT=PRODUCTION - VERSION=`date -u +"%Y%m%d%H%M%S"` - else - echo "This is a development environment" - ECR_REPO="$ACCOUNT_ID.dkr.ecr.$REGION.amazonaws.com/dev-sdc_aws_artifacts_lambda" - CDK_ENVIRONMENT=DEVELOPMENT - VERSION=`date -u +"%Y%m%d%H%M%S"` - fi - - echo ________________________________ - - echo Build Docker Image - - docker build --build-arg PUBLIC_ECR_REPO=$PUBLIC_ECR_REPO -t $ECR_REPO:latest lambda_function/. - - - - echo Tagging Docker Image... - - docker tag $ECR_REPO:latest $ECR_REPO:$VERSION - - - echo Pushing the Docker image with Tags... - - docker push $ECR_REPO:latest - - docker push $ECR_REPO:$VERSION - - echo ________________________________ - - - echo Updating Deployment - - echo ________________________________ - # - aws codebuild start-build --project-name arn:aws:codebuild:us-east-2:351967858401:project/build_sdc_aws_pipeline_architecture --environment-variables-override name=CDK_ENVIRONMENT,value=$CDK_ENVIRONMENT,type=PLAINTEXT - - post_build: - commands: - - echo Build Successful - Lambda Successfully Built and Pushed to ECR \ No newline at end of file