forked from opensearch-project/dashboards-maps
-
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.
Add PR triggered CDK test actions and PUSH triggered CDK deployment actions Signed-off-by: Junqiu Lei <[email protected]>
- Loading branch information
1 parent
cf5af6a
commit e593117
Showing
4 changed files
with
109 additions
and
1 deletion.
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,43 @@ | ||
name: Planet Tiles Generation CDK CD | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'tiles-generation/**' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Use Node.js | ||
uses: actions/[email protected] | ||
with: | ||
node-version: '16.x' | ||
|
||
- name: Install cdk-cli & cdk-lib | ||
run: | | ||
npm install -g aws-cdk | ||
cd tiles-generation/cdk | ||
npm install aws-cdk-lib | ||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: ${{ secrets.AWS_REGION }} | ||
|
||
- name: Synth CDK | ||
run: | | ||
cd tiles-generation/cdk | ||
cdk synth PlanetTileGenerationStack --context TILE_S3_BUCKET=${{secrets.TILE_S3_BUCKET}} | ||
- name: Deploy CDK | ||
run: | | ||
cd tiles-generation/cdk | ||
cdk deploy PlanetTileGenerationStack --context TILE_S3_BUCKET=${{secrets.TILE_S3_BUCKET}} --require-approval never |
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,64 @@ | ||
name: Test tiles generation CDK CD and ECS task run | ||
|
||
on: | ||
pull_request_target: | ||
branches: | ||
- main | ||
paths: | ||
- 'tiles-generation/**' | ||
|
||
jobs: | ||
approve: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Approve | ||
run: echo With security reasons, pull request need to be approved before running actions. | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
|
||
needs: [approve] | ||
environment: | ||
name: Pull Request | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
fetch-depth: 2 | ||
|
||
- name: Use Node.js | ||
uses: actions/[email protected] | ||
with: | ||
node-version: '16.x' | ||
|
||
- name: Install cdk-cli & cdk-lib | ||
run: | | ||
npm install -g aws-cdk | ||
cd tiles-generation/cdk | ||
npm install aws-cdk-lib | ||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: ${{ secrets.AWS_REGION }} | ||
|
||
- name: Synth CDK | ||
run: | | ||
cd tiles-generation/cdk | ||
cdk synth TestTileGenerationStack --context TILE_S3_BUCKET=${{secrets.TILE_S3_BUCKET}} | ||
- name: Deploy CDK | ||
run: | | ||
cd tiles-generation/cdk | ||
cdk deploy TestTileGenerationStack --context TILE_S3_BUCKET=${{secrets.TILE_S3_BUCKET}} --outputs-file ./cdk-outputs.json --require-approval never | ||
- name: Run ECS task | ||
run: | | ||
ClusterName=`jq -r '.TestTileGenerationStack .ClusterName' tiles-generation/cdk/cdk-outputs.json` | ||
CapacityProviderName=`jq -r '.TestTileGenerationStack .CapacityProviderName' tiles-generation/cdk/cdk-outputs.json` | ||
TaskDefinitionArn=`jq -r '.TestTileGenerationStack .TaskDefinitionArn' tiles-generation/cdk/cdk-outputs.json` | ||
aws ecs run-task --cluster $ClusterName --task-definition $TaskDefinitionArn --capacity-provider-strategy capacityProvider=$CapacityProviderName |
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 |
---|---|---|
|
@@ -7,3 +7,4 @@ node_modules | |
cdk.context.json | ||
.cdk.staging | ||
cdk.out | ||
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