-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
244 lines (207 loc) · 15.1 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
guard-%:
@ if [ "${${*}}" = "" ]; then \
echo "Environment variable $* not set"; \
exit 1; \
fi
install-python:
poetry install
install-hooks: install-python
poetry run pre-commit install --install-hooks --overwrite
install: install-python install-hooks
publish-pfp-aws-release-notes-int:
dev_tag=$$(aws cloudformation describe-stacks --stack-name dev-ci --profile prescription-dev --query "Stacks[0].Tags[?Key=='version'].Value" --output text); \
int_tag=$$(aws cloudformation describe-stacks --stack-name int-ci --profile prescription-int --query "Stacks[0].Tags[?Key=='version'].Value" --output text); \
echo { \"currentTag\": \"$$int_tag\", \"targetTag\": \"$$dev_tag\", \"repoName\": \"prescriptionsforpatients\", \"targetEnvironment\": \"INT\", \"productName\": \"Prescriptions for Patients AWS layer\", \"releaseNotesPageId\": \"734733361\", \"releaseNotesPageTitle\": \"Current PfP AWS layer release notes - INT\" } > /tmp/payload.json
aws lambda invoke \
--function-name "release-notes$${pull_request}-createReleaseNotes" \
--cli-binary-format raw-in-base64-out \
--payload file:///tmp/payload.json /tmp/out.txt
cat /tmp/out.txt
test-publish-pfp-aws-release-notes-int:
echo { \"currentTag\": \"$$int_tag\", \"targetTag\": \"$$dev_tag\", \"repoName\": \"prescriptionsforpatients\", \"targetEnvironment\": \"INT\", \"productName\": \"Prescriptions for Patients AWS layer\", \"releaseNotesPageId\": \"768063755\", \"releaseNotesPageTitle\": \"Current PfP AWS layer release notes - TESTING\" } > /tmp/payload.json
aws lambda invoke \
--function-name "release-notes$${pull_request}-createReleaseNotes" \
--cli-binary-format raw-in-base64-out \
--payload file:///tmp/payload.json /tmp/out.txt
cat /tmp/out.txt
publish-pfp-aws-rc-release-notes-int:
dev_tag=$$(aws cloudformation describe-stacks --stack-name dev-ci --profile prescription-dev --query "Stacks[0].Tags[?Key=='version'].Value" --output text); \
int_tag=$$(aws cloudformation describe-stacks --stack-name int-ci --profile prescription-int --query "Stacks[0].Tags[?Key=='version'].Value" --output text); \
echo { \"createReleaseCandidate\": \"true\", \"releasePrefix\": \"PfP-AWS-\", \"currentTag\": \"$$int_tag\", \"targetTag\": \"$$dev_tag\", \"repoName\": \"prescriptionsforpatients\", \"targetEnvironment\": \"INT\", \"productName\": \"Prescriptions for Patients AWS layer\", \"releaseNotesPageId\": \"734733361\", \"releaseNotesPageTitle\": \"WITHOUT RUN LINK PfP-AWS-$$dev_tag - Deployed to [INT] on $$(date +'%d-%m-%y')\"} > /tmp/payload.json
aws lambda invoke \
--function-name "release-notes$${pull_request}-createReleaseNotes" \
--cli-binary-format raw-in-base64-out \
--payload file:///tmp/payload.json /tmp/out.txt
cat /tmp/out.txt
publish-pfp-aws-release-notes-prod:
dev_tag=$$(aws cloudformation describe-stacks --stack-name dev-ci --profile prescription-dev --query "Stacks[0].Tags[?Key=='version'].Value" --output text); \
prod_tag=$$(aws cloudformation describe-stacks --stack-name prod-ci --profile prescription-prod --query "Stacks[0].Tags[?Key=='version'].Value" --output text); \
echo { \"currentTag\": \"$$prod_tag\", \"targetTag\": \"$$dev_tag\", \"repoName\": \"prescriptionsforpatients\", \"targetEnvironment\": \"PROD\", \"productName\": \"Prescriptions for Patients AWS layer\", \"releaseNotesPageId\": \"693750029\", \"releaseNotesPageTitle\": \"Current PfP AWS layer release notes - PROD\" } > /tmp/payload.json
aws lambda invoke \
--function-name "release-notes$${pull_request}-createReleaseNotes" \
--cli-binary-format raw-in-base64-out \
--payload file:///tmp/payload.json /tmp/out.txt
cat /tmp/out.txt
publish-pfp-apigee-release-notes-int:
dev_tag=$$(curl -s "https://internal-dev.api.service.nhs.uk/prescriptions-for-patients/_ping" | jq --raw-output ".version"); \
int_tag=$$(curl -s "https://int.api.service.nhs.uk/prescriptions-for-patients/_ping" | jq --raw-output ".version"); \
echo { \"currentTag\": \"$$int_tag\", \"targetTag\": \"$$dev_tag\", \"repoName\": \"prescriptions-for-patients\", \"targetEnvironment\": \"INT\", \"productName\": \"Prescriptions for Patients Apigee layer\", \"releaseNotesPageId\": \"693750035\", \"releaseNotesPageTitle\": \"Current PfP Apigee layer release notes - INT\" } > /tmp/payload.json
aws lambda invoke \
--function-name "release-notes$${pull_request}-createReleaseNotes" \
--cli-binary-format raw-in-base64-out \
--payload file:///tmp/payload.json /tmp/out.txt
cat /tmp/out.txt
test-publish-pfp-apigee-release-notes-int:
echo { \"currentTag\": \"$$int_tag\", \"targetTag\": \"$$dev_tag\", \"repoName\": \"prescriptions-for-patients\", \"targetEnvironment\": \"INT\", \"productName\": \"Prescriptions for Patients Apigee layer\", \"releaseNotesPageId\": \"768063758\", \"releaseNotesPageTitle\": \"Current PfP Apigee layer release notes - TESTING\" } > /tmp/payload.json
aws lambda invoke \
--function-name "release-notes$${pull_request}-createReleaseNotes" \
--cli-binary-format raw-in-base64-out \
--payload file:///tmp/payload.json /tmp/out.txt
cat /tmp/out.txt
publish-pfp-apigee-rc-release-notes-int:
dev_tag=$$(curl -s "https://internal-dev.api.service.nhs.uk/prescriptions-for-patients/_ping" | jq --raw-output ".version"); \
int_tag=$$(curl -s "https://int.api.service.nhs.uk/prescriptions-for-patients/_ping" | jq --raw-output ".version"); \
echo { \"createReleaseCandidate\": \"true\", \"releasePrefix\": \"PfP-Apigee-\", \"currentTag\": \"$$int_tag\", \"targetTag\": \"$$dev_tag\", \"repoName\": \"prescriptions-for-patients\", \"targetEnvironment\": \"INT\", \"productName\": \"Prescriptions for Patients Apigee layer\", \"releaseNotesPageId\": \"710051478\", \"releaseNotesPageTitle\": \"PfP-APigee-$$dev_tag - Deployed to [INT] on $$(date +'%d-%m-%y')\" } > /tmp/payload.json
aws lambda invoke \
--function-name "release-notes$${pull_request}-createReleaseNotes" \
--cli-binary-format raw-in-base64-out \
--payload file:///tmp/payload.json /tmp/out.txt
cat /tmp/out.txt
publish-pfp-apigee-release-notes-prod:
dev_tag=$$(curl -s "https://internal-dev.api.service.nhs.uk/prescriptions-for-patients/_ping" | jq --raw-output ".version"); \
prod_tag=$$(curl -s "https://api.service.nhs.uk/prescriptions-for-patients/_ping" | jq --raw-output ".version"); \
echo { \"currentTag\": \"$$prod_tag\", \"targetTag\": \"$$dev_tag\", \"repoName\": \"prescriptions-for-patients\", \"targetEnvironment\": \"PROD\", \"productName\": \"Prescriptions for Patients Apigee layer\", \"releaseNotesPageId\": \"693750032\", \"releaseNotesPageTitle\": \"Current PfP Apigee layer release notes - PROD\" } > /tmp/payload.json
aws lambda invoke \
--function-name "release-notes$${pull_request}-createReleaseNotes" \
--cli-binary-format raw-in-base64-out \
--payload file:///tmp/payload.json /tmp/out.txt
cat /tmp/out.txt
publish-fhir-release-notes-int:
dev_tag=$$(curl -s "https://internal-dev.api.service.nhs.uk/electronic-prescriptions/_ping" | jq --raw-output ".version"); \
int_tag=$$(curl -s "https://int.api.service.nhs.uk/electronic-prescriptions/_ping" | jq --raw-output ".version"); \
echo { \"currentTag\": \"$$int_tag\", \"targetTag\": \"$$dev_tag\", \"repoName\": \"electronic-prescription-service-api\", \"targetEnvironment\": \"INT\", \"productName\": \"FHIR API\", \"releaseNotesPageId\": \"587367089\", \"releaseNotesPageTitle\": \"Current FHIR API release notes - INT\" } > /tmp/payload.json
aws lambda invoke \
--function-name "release-notes$${pull_request}-createReleaseNotes" \
--cli-binary-format raw-in-base64-out \
--payload file:///tmp/payload.json /tmp/out.txt
cat /tmp/out.txt
test-publish-fhir-release-notes-int:
echo { \"currentTag\": \"$$int_tag\", \"targetTag\": \"$$dev_tag\", \"repoName\": \"electronic-prescription-service-api\", \"targetEnvironment\": \"INT\", \"productName\": \"FHIR API\", \"releaseNotesPageId\": \"734403724\", \"releaseNotesPageTitle\": \"Current FHIR API release notes - TESTING\" } > /tmp/payload.json
aws lambda invoke \
--function-name "release-notes$${pull_request}-createReleaseNotes" \
--cli-binary-format raw-in-base64-out \
--payload file:///tmp/payload.json /tmp/out.txt
cat /tmp/out.txt
publish-fhir-rc-release-notes-int:
dev_tag=$$(curl -s "https://internal-dev.api.service.nhs.uk/electronic-prescriptions/_ping" | jq --raw-output ".version"); \
int_tag=$$(curl -s "https://int.api.service.nhs.uk/electronic-prescriptions/_ping" | jq --raw-output ".version"); \
echo { \"createReleaseCandidate\": \"true\", \"releasePrefix\": \"FHIR-\", \"currentTag\": \"$$int_tag\", \"targetTag\": \"$$dev_tag\", \"repoName\": \"electronic-prescription-service-api\", \"targetEnvironment\": \"INT\", \"productName\": \"FHIR API\", \"releaseNotesPageId\": \"587372008\", \"releaseNotesPageTitle\": \"FHIR-$$dev_tag - Deployed to [INT] on $$(date +'%d-%m-%y')\" } > /tmp/payload.json
aws lambda invoke \
--function-name "release-notes$${pull_request}-createReleaseNotes" \
--cli-binary-format raw-in-base64-out \
--payload file:///tmp/payload.json /tmp/out.txt
cat /tmp/out.txt
publish-fhir-release-notes-prod:
dev_tag=$$(curl -s "https://internal-dev.api.service.nhs.uk/electronic-prescriptions/_ping" | jq --raw-output ".version"); \
prod_tag=$$(curl -s "https://api.service.nhs.uk/electronic-prescriptions/_ping" | jq --raw-output ".version"); \
echo { \"currentTag\": \"$$prod_tag\", \"targetTag\": \"$$dev_tag\", \"repoName\": \"electronic-prescription-service-api\", \"targetEnvironment\": \"PROD\", \"productName\": \"FHIR API\", \"releaseNotesPageId\": \"587367100\", \"releaseNotesPageTitle\": \"Current FHIR API release notes - PROD\" } > /tmp/payload.json
aws lambda invoke \
--function-name "release-notes$${pull_request}-createReleaseNotes" \
--cli-binary-format raw-in-base64-out \
--payload file:///tmp/payload.json /tmp/out.txt
cat /tmp/out.txt
publish-account-resources-release-notes-int:
dev_tag=$$(curl -s "https://internal-dev.api.service.nhs.uk/electronic-prescriptions/_ping" | jq --raw-output ".version"); \
int_tag=$$(curl -s "https://int.api.service.nhs.uk/electronic-prescriptions/_ping" | jq --raw-output ".version"); \
echo { \"currentTag\": \"$$int_tag\", \"targetTag\": \"$$dev_tag\", \"repoName\": \"electronic-prescription-service-account-resources\", \"targetEnvironment\": \"INT\", \"productName\": \"AWS account resources\", \"releaseNotesPageId\": \"749733665\", \"releaseNotesPageTitle\": \"Current AWS account resources release notes - INT\" } > /tmp/payload.json
aws lambda invoke \
--function-name "release-notes$${pull_request}-createReleaseNotes" \
--cli-binary-format raw-in-base64-out \
--payload file:///tmp/payload.json /tmp/out.txt
cat /tmp/out.txt
test-publish-account-resources-release-notes-int:
echo { \"currentTag\": \"$$int_tag\", \"targetTag\": \"$$dev_tag\", \"repoName\": \"electronic-prescription-service-account-resources\", \"targetEnvironment\": \"INT\", \"productName\": \"AWS account resources\", \"releaseNotesPageId\": \"768063770\", \"releaseNotesPageTitle\": \"Current AWS account resources release notes - TESTING\" } > /tmp/payload.json
aws lambda invoke \
--function-name "release-notes$${pull_request}-createReleaseNotes" \
--cli-binary-format raw-in-base64-out \
--payload file:///tmp/payload.json /tmp/out.txt
cat /tmp/out.txt
publish-account-resources-rc-release-notes-int:
dev_tag=$$(curl -s "https://internal-dev.api.service.nhs.uk/electronic-prescriptions/_ping" | jq --raw-output ".version"); \
int_tag=$$(curl -s "https://int.api.service.nhs.uk/electronic-prescriptions/_ping" | jq --raw-output ".version"); \
echo { \"createReleaseCandidate\": \"true\", \"releasePrefix\": \"AWS-account-resources-\", \"currentTag\": \"$$int_tag\", \"targetTag\": \"$$dev_tag\", \"repoName\": \"electronic-prescription-service-account-resources\", \"targetEnvironment\": \"INT\", \"productName\": \"AWS account resources\", \"releaseNotesPageId\": \"749733675\", \"releaseNotesPageTitle\": \"AWS-account-resources-$$dev_tag - Deployed to [INT] on $$(date +'%d-%m-%y')\" } > /tmp/payload.json
aws lambda invoke \
--function-name "release-notes$${pull_request}-createReleaseNotes" \
--cli-binary-format raw-in-base64-out \
--payload file:///tmp/payload.json /tmp/out.txt
cat /tmp/out.txt
publish-account-resources-release-notes-prod:
dev_tag=$$(curl -s "https://internal-dev.api.service.nhs.uk/electronic-prescriptions/_ping" | jq --raw-output ".version"); \
prod_tag=$$(curl -s "https://api.service.nhs.uk/electronic-prescriptions/_ping" | jq --raw-output ".version"); \
echo { \"currentTag\": \"$$prod_tag\", \"targetTag\": \"$$dev_tag\", \"repoName\": \"electronic-prescription-service-account-resources\", \"targetEnvironment\": \"PROD\", \"productName\": \"AWS account resources\", \"releaseNotesPageId\": \"749733670\", \"releaseNotesPageTitle\": \"Current AWS account resources release notes - PROD\" } > /tmp/payload.json
aws lambda invoke \
--function-name "release-notes$${pull_request}-createReleaseNotes" \
--cli-binary-format raw-in-base64-out \
--payload file:///tmp/payload.json /tmp/out.txt
cat /tmp/out.txt
mark-jira-released: guard-release_version
echo { \"releaseVersion\": \"$$release_version\" } > /tmp/payload.json
aws lambda invoke \
--function-name "release-notes$${pull_request}-markJiraReleased" \
--cli-binary-format raw-in-base64-out \
--payload file:///tmp/payload.json /tmp/out.txt
cat /tmp/out.txt
aws-login:
aws sso login --sso-session sso-session
aws-configure:
aws configure sso --region eu-west-2
sam-build: sam-validate
poetry export --without-hashes --only release_notes > create_release_notes/requirements.txt
poetry export --without-hashes --only mark_released > mark_jira_released/requirements.txt
sam build --template-file SAMtemplates/main_template.yaml --region eu-west-2
sam-run-local: sam-build
sam local start-lambda
sam-deploy-package: guard-artifact_bucket guard-artifact_bucket_prefix guard-stack_name guard-template_file guard-cloud_formation_execution_role
sam deploy \
--template-file $$template_file \
--stack-name $$stack_name \
--capabilities CAPABILITY_NAMED_IAM CAPABILITY_AUTO_EXPAND \
--region eu-west-2 \
--s3-bucket $$artifact_bucket \
--s3-prefix $$artifact_bucket_prefix \
--config-file samconfig_package_and_deploy.toml \
--no-fail-on-empty-changeset \
--role-arn $$cloud_formation_execution_role \
--no-confirm-changeset \
--force-upload \
--tags "version=$$VERSION_NUMBER" \
--parameter-overrides \
GithubToken=$$PAT_GITHUB_TOKEN
sam-validate:
sam validate --template-file SAMtemplates/main_template.yaml --region eu-west-2
sam-sync: guard-AWS_DEFAULT_PROFILE guard-stack_name
poetry export --without-hashes > create_release_notes/requirements.txt
sam sync \
--stack-name $$stack_name \
--watch \
--template-file SAMtemplates/main_template.yaml
sam-delete: guard-AWS_DEFAULT_PROFILE guard-stack_name
sam delete --stack-name $$stack_name
lint-samtemplates:
poetry run cfn-lint -t SAMtemplates/*.yaml
lint-python:
poetry run black --check create_release_notes
poetry run flake8 create_release_notes
lint: lint-python lint-samtemplates
check-licenses:
scripts/check_python_licenses.sh
clean:
rm -rf .aws-sam
rm create_release_notes/requirements.txt
deep-clean: clean
rm -rf .venv
test:
poetry run python -m coverage run -m unittest
poetry run python -m coverage xml
cfn-guard:
./scripts/run_cfn_guard.sh