Skip to content

Commit d6660fe

Browse files
committed
update workflow with parameters
1 parent 7e3034f commit d6660fe

File tree

1 file changed

+4
-69
lines changed

1 file changed

+4
-69
lines changed

.github/workflows/pipeline.yaml

Lines changed: 4 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@ on:
44
push:
55
branches:
66
- 'main'
7-
- 'feat**'
8-
delete:
9-
branches:
10-
- 'feat**'
117

128
env:
139
PIPELINE_USER_ACCESS_KEY_ID: ${{ secrets.PIPELINE_USER_ACCESS_KEY_ID}}
@@ -17,6 +13,7 @@ env:
1713
TESTING_PIPELINE_EXECUTION_ROLE: ${{ secrets.TESTING_PIPELINE_EXECUTION_ROLE }}
1814
TESTING_CLOUDFORMATION_EXECUTION_ROLE: ${{ secrets.TESTING_CLOUDFORMATION_EXECUTION_ROLE }}
1915
TESTING_ARTIFACTS_BUCKET: ${{ secrets.TESTING_ARTIFACTS_BUCKET }}
16+
TESTING_PARAMETER_OVERRIDES: "TasksTableName=\"tasks\" CognitoCallbackURL=\"https://start.spring.io/\" UserPoolAdminGroupName=\"apiAdmins\""
2017
# If there are functions with "Image" PackageType in your template,
2118
# uncomment the line below and add "--image-repository ${TESTING_IMAGE_REPOSITORY}" to
2219
# testing "sam package" and "sam deploy" commands.
@@ -26,6 +23,7 @@ env:
2623
PROD_PIPELINE_EXECUTION_ROLE: ${{ secrets.PROD_PIPELINE_EXECUTION_ROLE }}
2724
PROD_CLOUDFORMATION_EXECUTION_ROLE: ${{ secrets.PROD_CLOUDFORMATION_EXECUTION_ROLE }}
2825
PROD_ARTIFACTS_BUCKET: ${{ secrets.PROD_ARTIFACTS_BUCKET }}
26+
PRODUCTION_PARAMETER_OVERRIDES: "TasksTableName=\"tasks\" CognitoCallbackURL=\"https://django-rest-framework.org/tutorial/\" UserPoolAdminGroupName=\"apiAdmins\""
2927
# If there are functions with "Image" PackageType in your template,
3028
# uncomment the line below and add "--image-repository ${PROD_IMAGE_REPOSITORY}" to
3129
# prod "sam package" and "sam deploy" commands.
@@ -41,71 +39,6 @@ jobs:
4139
- run: |
4240
# trigger the tests here
4341
44-
delete-feature:
45-
if: startsWith(github.event.ref, 'feat') && github.event_name == 'delete'
46-
runs-on: ubuntu-latest
47-
steps:
48-
- uses: actions/checkout@v3
49-
- uses: aws-actions/setup-sam@v2
50-
with:
51-
use-installer: true
52-
53-
- name: Assume the testing pipeline user role
54-
uses: aws-actions/configure-aws-credentials@v4
55-
with:
56-
aws-access-key-id: ${{ env.PIPELINE_USER_ACCESS_KEY_ID }}
57-
aws-secret-access-key: ${{ env.PIPELINE_USER_SECRET_ACCESS_KEY }}
58-
aws-region: ${{ env.TESTING_REGION }}
59-
role-to-assume: ${{ env.TESTING_PIPELINE_EXECUTION_ROLE }}
60-
role-session-name: testing-packaging
61-
role-duration-seconds: 3600
62-
role-skip-session-tagging: true
63-
64-
- name: Delete feature branch stack
65-
env:
66-
FEATURE_BRANCH_NAME: ${{ github.event.ref }}
67-
run: |
68-
sam delete \
69-
--stack-name $(echo ${FEATURE_BRANCH_NAME##*/} | tr -cd '[a-zA-Z0-9-]') \
70-
--region ${TESTING_REGION} \
71-
--no-prompts
72-
73-
build-and-deploy-feature:
74-
# this stage is triggered only for feature branches (feature*),
75-
# which will build the stack and deploy to a stack named with branch name.
76-
# https://github.com/actions/setup-python
77-
# https://github.com/aws-actions/configure-aws-credentials#notice-node12-deprecation-warning
78-
if: startsWith(github.ref, 'refs/heads/feat')
79-
needs: [test]
80-
runs-on: ubuntu-latest
81-
steps:
82-
- uses: actions/checkout@v3
83-
- uses: aws-actions/setup-sam@v2
84-
with:
85-
use-installer: true
86-
- run: sam build --template ${SAM_TEMPLATE} --use-container
87-
88-
- name: Assume the testing pipeline user role
89-
uses: aws-actions/configure-aws-credentials@v4
90-
with:
91-
aws-access-key-id: ${{ env.PIPELINE_USER_ACCESS_KEY_ID }}
92-
aws-secret-access-key: ${{ env.PIPELINE_USER_SECRET_ACCESS_KEY }}
93-
aws-region: ${{ env.TESTING_REGION }}
94-
role-to-assume: ${{ env.TESTING_PIPELINE_EXECUTION_ROLE }}
95-
role-session-name: feature-deployment
96-
role-duration-seconds: 3600
97-
role-skip-session-tagging: true
98-
99-
- name: Deploy to feature stack in the testing account
100-
shell: bash
101-
run: |
102-
sam deploy --stack-name $(echo ${GITHUB_REF##*/} | tr -cd '[a-zA-Z0-9-]') \
103-
--capabilities CAPABILITY_IAM \
104-
--region ${TESTING_REGION} \
105-
--s3-bucket ${TESTING_ARTIFACTS_BUCKET} \
106-
--no-fail-on-empty-changeset \
107-
--role-arn ${TESTING_CLOUDFORMATION_EXECUTION_ROLE}
108-
10942
build-and-package:
11043
if: github.ref == 'refs/heads/main'
11144
needs: [test]
@@ -198,6 +131,7 @@ jobs:
198131
--s3-bucket ${TESTING_ARTIFACTS_BUCKET} \
199132
--no-fail-on-empty-changeset \
200133
--role-arn ${TESTING_CLOUDFORMATION_EXECUTION_ROLE}
134+
--parameter-overrides ${TESTING_PARAMETER_OVERRIDES}
201135
202136
integration-test:
203137
if: github.ref == 'refs/heads/main'
@@ -244,3 +178,4 @@ jobs:
244178
--s3-bucket ${PROD_ARTIFACTS_BUCKET} \
245179
--no-fail-on-empty-changeset \
246180
--role-arn ${PROD_CLOUDFORMATION_EXECUTION_ROLE}
181+
--parameter-overrides ${PRODUCTION_PARAMETER_OVERRIDES}

0 commit comments

Comments
 (0)