-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4d1c7a1
commit 0faa63f
Showing
8 changed files
with
161 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
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 |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// This file contains the configuration for the SDC AWS Pipeline | ||
|
||
# AWS Deployment Region | ||
# Region that the pipeline will be deployed to | ||
deployment_region = "us-east-1" | ||
|
||
# Mission Name | ||
# This is the name of the mission that will be used to dynamically create the instrument buckets | ||
mission_name = "padre" | ||
|
||
# Instrument Names Used in the Mission. | ||
# The names are used to dynamically create the instrument bucket | ||
instrument_names = ["meddea", "sharp"] | ||
|
||
# Valid Data Levels | ||
# This is a list of the valid data levels for the mission | ||
valid_data_levels = ["l0", "l1", "ql"] | ||
|
||
# Timestream Database and Table Names for Logs | ||
# The names of the timestream database and table that will be created to store logs | ||
timestream_database_name = "padre_sdc_aws_logs" | ||
timestream_s3_logs_table_name = "padre_sdc_aws_s3_bucket_log_table" | ||
|
||
# S3 Instrument Bucket Name | ||
# The names of the buckets that will be created for the mission | ||
incoming_bucket_name = "padre-swsoc-incoming" | ||
|
||
# S3 Sorting Lambda ECR Repository Name | ||
# The name of the ECR repository that will be created to store the sorting lambda image | ||
sorting_function_private_ecr_name = "padre_sdc_aws_sorting_lambda" | ||
|
||
# S3 Artifacts Lambda ECR Repository Name | ||
# The name of the ECR repository that will be created to store the artifacts lambda image | ||
artifacts_function_private_ecr_name = "padre_sdc_aws_artifacts_lambda" | ||
|
||
# S3 Server Access Logs Bucket | ||
# The name of the bucket that will be created to store the s3 server access logs | ||
s3_server_access_logs_bucket_name = "padre-swsoc-s3-server-access-logs" | ||
|
||
# Processing Lambda ECR Repository Name | ||
# The name of the ECR repository that will be created to store the processing lambda image | ||
processing_function_private_ecr_name = "padre_sdc_aws_processing_lambda" | ||
|
||
# Docker Base ECR Repository Name | ||
# The name of the ECR repository that will be created to store the docker base image | ||
docker_base_public_ecr_name = "padre-swsoc-docker-lambda-base" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.