Skip to content

Commit

Permalink
Merge pull request #18 from ryanrigato/dev
Browse files Browse the repository at this point in the history
bundle upload in vm
  • Loading branch information
rrigato authored Jun 1, 2024
2 parents f8dc72d + f45a6d9 commit ad2f1d2
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 34 deletions.
1 change: 1 addition & 0 deletions .github/workflows/tvratings_pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,5 @@ jobs:
shell: bash
env:
AWS_ACCOUNT_ID: ${{secrets.AWS_ACCOUNT_ID}}
PROJECT_NAME: ${{vars.PROJECT_NAME}}
run: 'scripts/tvratings_build_test.sh'
36 changes: 3 additions & 33 deletions scripts/app_deployment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,6 @@ if [ -z "$1" ]; then
exit 1
fi


git add -A

git commit -m "$1"


export PROJECT_NAME="tvratings"
export BUCKET_NAME="${PROJECT_NAME}-app-artifacts"
export DEPLOYMENT_PACKAGE="${PROJECT_NAME}_deployment_package.zip"
export FUNCTION_NAME="${PROJECT_NAME}-alexa-skill"


source avenv/bin/activate

secret_scan_results=$(detect-secrets scan | \
Expand All @@ -31,31 +19,13 @@ fi

python -m unittest

# removes the deployment .zip package locally if it exists
if [ -e $DEPLOYMENT_PACKAGE ]; then
rm $DEPLOYMENT_PACKAGE
fi

zip $DEPLOYMENT_PACKAGE -r tvratings externals \
-x *__pycache__* --quiet


#add tvratings_skill.py to root of project
zip -u $DEPLOYMENT_PACKAGE -j handlers/tvratings_skill.py \
-x *__pycache__* --quiet
deactivate

aws s3api put-object --bucket $BUCKET_NAME \
--key $DEPLOYMENT_PACKAGE \
--body $DEPLOYMENT_PACKAGE \
--tagging "cloudformation_managed=no&project=${PROJECT_NAME}&prod=yes"
git add -A

git commit -m "$1"

aws lambda update-function-code --function-name $FUNCTION_NAME \
--s3-bucket $BUCKET_NAME \
--s3-key $DEPLOYMENT_PACKAGE \
--no-cli-pager

deactivate

git push origin dev

Expand Down
34 changes: 34 additions & 0 deletions scripts/tvratings_build_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ set -e

export BUCKET_NAME="${PROJECT_NAME}-app-artifacts"
export DEPLOYMENT_PACKAGE="${PROJECT_NAME}_deployment_package.zip"
export FUNCTION_NAME="${PROJECT_NAME}-alexa-skill"




python -m venv avenv
Expand All @@ -25,3 +28,34 @@ python -m unittest
deactivate

echo "--------beginning bundle--------"

# removes the deployment .zip package locally if it exists
if [ -e $DEPLOYMENT_PACKAGE ]; then
rm $DEPLOYMENT_PACKAGE
fi

zip $DEPLOYMENT_PACKAGE -r tvratings externals \
-x *__pycache__* --quiet


#add tvratings_skill.py to root of project
zip -u $DEPLOYMENT_PACKAGE -j handlers/tvratings_skill.py \
-x *__pycache__* --quiet

echo "--------bundle complete--------"

aws s3api put-object --bucket $BUCKET_NAME \
--key $DEPLOYMENT_PACKAGE \
--body $DEPLOYMENT_PACKAGE \
--tagging "cloudformation_managed=no&project=${PROJECT_NAME}&prod=yes"


aws lambda update-function-code --function-name $FUNCTION_NAME \
--s3-bucket $BUCKET_NAME \
--s3-key $DEPLOYMENT_PACKAGE \
--no-cli-pager



echo "----------------------"
echo "deployment successful"
2 changes: 1 addition & 1 deletion templates/tvratings_alexa_skill.template
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Parameters:
Default: tvratings_skill.alexa_lambda_handler

githubUser:
Default: rrigato
Default: ryanrigato
Description: 'GitHub organization name'
Type: String

Expand Down

0 comments on commit ad2f1d2

Please sign in to comment.