Skip to content

Commit d4181c7

Browse files
authored
Zero landing page [zero-222] (#23)
* strict match for CloudFront dist id * require approval for production deployment * add CIRCLECI_API_KEY var to available build env vars
1 parent dbe300b commit d4181c7

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ run:
1010
@echo "Set CIRCLECI environment variables\n"
1111
export AWS_ACCESS_KEY_ID=$(shell aws secretsmanager get-secret-value --region ${region} --secret-id=ci-user-aws-keys${randomSeed} | jq -r '.SecretString'| jq -r .access_key_id)
1212
export AWS_SECRET_ACCESS_KEY=$(shell aws secretsmanager get-secret-value --region ${region} --secret-id=ci-user-aws-keys${randomSeed} | jq -r '.SecretString'| jq -r .secret_key)
13+
curl -X POST --header "Content-Type: application/json" -d '{"name":"CIRCLECI_API_KEY", "value":"${CIRCLECI_API_KEY}"}' https://circleci.com/api/v1.1/project/github/${GITHUB_ORG}/${GITHUB_REPO}/envvar?circle-token=${CIRCLECI_API_KEY}
1314
curl -X POST --header "Content-Type: application/json" -d '{"name":"AWS_ACCESS_KEY_ID", "value":"${AWS_ACCESS_KEY_ID}"}' https://circleci.com/api/v1.1/project/github/${GITHUB_ORG}/${GITHUB_REPO}/envvar?circle-token=${CIRCLECI_API_KEY}
1415
curl -X POST --header "Content-Type: application/json" -d '{"name":"AWS_SECRET_ACCESS_KEY", "value":"${AWS_SECRET_ACCESS_KEY}"}' https://circleci.com/api/v1.1/project/github/${GITHUB_ORG}/${GITHUB_REPO}/envvar?circle-token=${CIRCLECI_API_KEY}
1516
@echo "\nFollow CIRCLECI project"
@@ -22,4 +23,3 @@ summary:
2223
@echo "- Deployment Pipeline URL: https://app.circleci.com/pipelines/github/${GITHUB_ORG}/${GITHUB_REPO}"
2324
@echo $(shell echo ${ENVIRONMENT} | grep prod > /dev/null && echo "- Production Landing Page: ${productionFrontendSubdomain}${productionHostRoot}")
2425
@echo $(shell echo ${ENVIRONMENT} | grep stage > /dev/null && echo "- Staging Landing Page: ${stagingFrontendSubdomain}${stagingHostRoot}")
25-

templates/.circleci/config.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
version: 2.1
33
orbs:
44
aws-s3: circleci/aws-s3@1.0.15
5+
queue: eddiewebb/queue@1.3.0
56

67
variables:
78
- &workspace /home/circleci/project
@@ -182,7 +183,7 @@ jobs:
182183
- run:
183184
name: Invalidate Cloudfront
184185
command: |
185-
export DIST_ID=$(aws cloudfront list-distributions --query "DistributionList.Items[?Aliases.Items[?contains(@, '<< parameters.bucket >>')]].Id | [0]" | tr -d '"')
186+
export DIST_ID=$(aws cloudfront list-distributions --query "DistributionList.Items[?Aliases.Items[?@=='<< parameters.bucket >>']].Id | [0]" | tr -d '"')
186187
aws cloudfront create-invalidation --distribution-id ${DIST_ID} --paths "/*"
187188
188189
workflows:
@@ -220,12 +221,23 @@ workflows:
220221
# branches:
221222
# only: # only branches matching the below regex filters will run
222223
# - /^master$/
224+
225+
- wait_for_approval:
226+
type: approval
227+
requires:
228+
- deploy_staging
223229

230+
- queue/block_workflow:
231+
time: '30' # hold for 30 mins then abort
232+
requires:
233+
- wait_for_approval
234+
224235
- deploy:
225236
name: deploy_production
226237
requires:
227238
- unit_test
228239
- build_production
240+
- queue/block_workflow
229241
bucket: "<% index .Params `productionFrontendSubdomain` %><% index .Params `productionHostRoot` %>"
230242
region: "<% index .Params `region` %>"
231243
filters:

0 commit comments

Comments
 (0)