This module goal is to deploy:
- CloudFormation Stacks
- Lambda Functions
###Function flow:
- Generate package: Finds recursively in each folder the file "package.json", if it's found, a deploy script is generated for that lambda function.
- Execute NPM Scripts: Executes the script generated in the previous process.
- Deploy Lambda Code: Generates a zip for each lambda function, then uploads it to S3 and finally deletes the zip.
- Deploy CloudFormation Stack: Find all .json files in the folder where the stacks are saved and uploads it to S3.
###Deploy script
- cd "Lambda folder": Move to the lambda function folder.
- npm install: Install every package.
- npm run cover: Execute tests and coverage report.
- npm prune --production: Remove dev dependencies.
###Configurable parameters All parameters are setted as environment variables
- ROOT_PATH: Path of the root folder.
- GIT_BRANCH: Current branch.
- DEPLOY_BRANCHES: Branches that will trigger the deploy process, seperated by comma and whitout white spaces.
- Default:
- "origin/development"
- "origin/staging"
- "origin/master"
- Default:
- NAME_BRANCHES: Names of the branches to be used in the deploy script, need to be in the same order as the DEPLOY_BRANCHES
- Default:
- "development"
- "staging"
- "production"
- Default:
- AWS_ACCESS_KEY_ID: AWS access key id.
- AWS_SECRET_ACCESS_KEY: AWS secret key.
- S3_BUCKET_CODE: Bucket to deploy the lambda functions.
- S3_BUCKET_CF: Bucket to deploy the CloudFormation stacks.
- REGION: AWS Region.
- LAMBDA_PATH: Folder containing the lambda functions.
- Default: ROOT_PATH + /lambda
- CF_PATH: Folder containing the CloudFormation stacks.
- Default: ROOT_PATH + /provisioning
- EXCLUDE_FOLDER: Folders that will'nt be checked for package.json, separated by comma and whitout white spaces.