-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from NASA-IMPACT/feature/deploy-action
Include veda deploy action
- Loading branch information
Showing
10 changed files
with
214 additions
and
97 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,59 @@ | ||
name: Deploy | ||
|
||
inputs: | ||
env_aws_secret_name: | ||
required: true | ||
type: string | ||
dir: | ||
required: false | ||
type: string | ||
default: "." | ||
script_path: | ||
required: true | ||
type: string | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Install node and related deps | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 17.3.0 | ||
|
||
- uses: actions/cache@v3 | ||
with: | ||
path: ~/.npm | ||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | ||
|
||
- name: Install AWS CDK | ||
shell: bash | ||
run: npm install -g aws-cdk@2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.10" | ||
cache: "pip" | ||
cache-dependency-path: | | ||
${{ inputs.dir }}/requirements.txt | ||
- name: Install python dependencies | ||
shell: bash | ||
working-directory: ${{ inputs.dir }} | ||
run: | | ||
pip install \ | ||
-r requirements.txt \ | ||
- name: Get relevant environment configuration from aws secrets | ||
shell: bash | ||
working-directory: ${{ inputs.dir }} | ||
env: | ||
AWS_DEFAULT_REGION: us-west-2 | ||
run: ./scripts/get-env.sh ${{ inputs.env_aws_secret_name }} | ||
|
||
- name: Deploy | ||
id: deploy_auth_stack | ||
shell: bash | ||
working-directory: ${{ inputs.dir }} | ||
run: | | ||
cdk deploy --all --require-approval never --outputs-file ${HOME}/cdk-outputs.json |
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,50 @@ | ||
name: Pull Request - Preview CDK Diff | ||
|
||
on: [pull_request] | ||
|
||
jobs: | ||
predeploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.9' | ||
|
||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 17 | ||
|
||
- name: Configure awscli | ||
uses: aws-actions/configure-aws-credentials@v3 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: us-west-2 | ||
|
||
- uses: actions/cache@v3 | ||
with: | ||
path: ~/.npm | ||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | ||
|
||
- name: Install CDK | ||
run: npm install -g aws-cdk@2 | ||
|
||
- uses: actions/cache@v3 | ||
with: | ||
path: ${{ env.pythonLocation }} | ||
key: ${{ env.pythonLocation }}-${{ hashFiles('setup.py') }} | ||
|
||
- name: Install python dependencies | ||
run: | | ||
pip install -r requirements.txt | ||
- name: Get environment configuration for target branch | ||
run: | | ||
./scripts/get-env.sh "veda-auth-uah-env" | ||
- name: Pre deployment CDK diff | ||
run: | | ||
echo $STAGE | ||
cdk diff --outputs-file ${HOME}/cdk-outputs.json |
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 |
---|---|---|
|
@@ -9,3 +9,5 @@ __pycache__ | |
.cdk.staging | ||
cdk.out | ||
*.env | ||
.ipynb_checkpoints | ||
|
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 |
---|---|---|
@@ -1,31 +1,3 @@ | ||
{ | ||
"app": "python3 app.py", | ||
"watch": { | ||
"include": [ | ||
"**" | ||
], | ||
"exclude": [ | ||
"README.md", | ||
"cdk*.json", | ||
"requirements*.txt", | ||
"source.bat", | ||
"**/*.pyc", | ||
"**/*.tmp", | ||
"**/__pycache__", | ||
"tests", | ||
"scripts" | ||
] | ||
}, | ||
"context": { | ||
"@aws-cdk/aws-apigateway:usagePlanKeyOrderInsensitiveId": true, | ||
"@aws-cdk/core:stackRelativeExports": true, | ||
"@aws-cdk/aws-rds:lowercaseDbIdentifier": true, | ||
"@aws-cdk/aws-lambda:recognizeVersionProps": true, | ||
"@aws-cdk/aws-cloudfront:defaultSecurityPolicyTLSv1.2_2021": true, | ||
"@aws-cdk-containers/ecs-service-extensions:enableDefaultLogDriver": true, | ||
"@aws-cdk/core:target-partitions": [ | ||
"aws", | ||
"aws-cn" | ||
] | ||
} | ||
"app": "python3 app.py" | ||
} |
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.