4
4
push :
5
5
branches :
6
6
- ' main'
7
- - ' feat**'
8
- delete :
9
- branches :
10
- - ' feat**'
11
7
12
8
env :
13
9
PIPELINE_USER_ACCESS_KEY_ID : ${{ secrets.PIPELINE_USER_ACCESS_KEY_ID}}
17
13
TESTING_PIPELINE_EXECUTION_ROLE : ${{ secrets.TESTING_PIPELINE_EXECUTION_ROLE }}
18
14
TESTING_CLOUDFORMATION_EXECUTION_ROLE : ${{ secrets.TESTING_CLOUDFORMATION_EXECUTION_ROLE }}
19
15
TESTING_ARTIFACTS_BUCKET : ${{ secrets.TESTING_ARTIFACTS_BUCKET }}
16
+ TESTING_PARAMETER_OVERRIDES : " TasksTableName=\" tasks\" CognitoCallbackURL=\" https://start.spring.io/\" UserPoolAdminGroupName=\" apiAdmins\" "
20
17
# If there are functions with "Image" PackageType in your template,
21
18
# uncomment the line below and add "--image-repository ${TESTING_IMAGE_REPOSITORY}" to
22
19
# testing "sam package" and "sam deploy" commands.
26
23
PROD_PIPELINE_EXECUTION_ROLE : ${{ secrets.PROD_PIPELINE_EXECUTION_ROLE }}
27
24
PROD_CLOUDFORMATION_EXECUTION_ROLE : ${{ secrets.PROD_CLOUDFORMATION_EXECUTION_ROLE }}
28
25
PROD_ARTIFACTS_BUCKET : ${{ secrets.PROD_ARTIFACTS_BUCKET }}
26
+ PRODUCTION_PARAMETER_OVERRIDES : " TasksTableName=\" tasks\" CognitoCallbackURL=\" https://django-rest-framework.org/tutorial/\" UserPoolAdminGroupName=\" apiAdmins\" "
29
27
# If there are functions with "Image" PackageType in your template,
30
28
# uncomment the line below and add "--image-repository ${PROD_IMAGE_REPOSITORY}" to
31
29
# prod "sam package" and "sam deploy" commands.
41
39
- run : |
42
40
# trigger the tests here
43
41
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
-
109
42
build-and-package :
110
43
if : github.ref == 'refs/heads/main'
111
44
needs : [test]
@@ -198,6 +131,7 @@ jobs:
198
131
--s3-bucket ${TESTING_ARTIFACTS_BUCKET} \
199
132
--no-fail-on-empty-changeset \
200
133
--role-arn ${TESTING_CLOUDFORMATION_EXECUTION_ROLE}
134
+ --parameter-overrides ${TESTING_PARAMETER_OVERRIDES}
201
135
202
136
integration-test :
203
137
if : github.ref == 'refs/heads/main'
@@ -244,3 +178,4 @@ jobs:
244
178
--s3-bucket ${PROD_ARTIFACTS_BUCKET} \
245
179
--no-fail-on-empty-changeset \
246
180
--role-arn ${PROD_CLOUDFORMATION_EXECUTION_ROLE}
181
+ --parameter-overrides ${PRODUCTION_PARAMETER_OVERRIDES}
0 commit comments