-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcircle.yml
More file actions
99 lines (87 loc) · 3.16 KB
/
circle.yml
File metadata and controls
99 lines (87 loc) · 3.16 KB
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
machine:
environment:
# Which version of the parser you want to deploy into qa/prod
RELEASED_PARSER: v1.0.0
dependencies:
override:
- npm i -g npm
- pip install -r requirements.txt
- npm --version
# - npm install -g slack-cli
test:
override:
- make test
deployment:
release:
tag: /v[0-9]+(\.[0-9]+)*/
commands:
# Zip and deploy lambda code to S3
- bash publish codesplain-lambda-functions/$CIRCLE_TAG
# Package template for deloying prod
- >
aws cloudformation package --template-file codesplainTemplate.yaml
--s3-bucket codesplain-lambda-functions
--output-template-file serverless-output.yaml
# Deploy a new stack for this version
- >
EnvVersion=$CIRCLE_TAG && EnvVersion=${EnvVersion//./_} &&
CloudFormationVersion=$CIRCLE_TAG && CloudFormationVersion=${CloudFormationVersion//./-} &&
aws cloudformation deploy
--stack-name "Codesplain-Prod-$CloudFormationVersion"
--template-file ./serverless-output.yaml
--parameter-overrides
EnvVersion="$EnvVersion"
S3Version="$CIRCLE_TAG"
ClientSecret="$CLIENT_SECRET_PROD"
ClientID="$CLIENT_ID_PROD"
Title="CodesplainAPI: $CIRCLE_TAG"
CircleBuild="$CIRCLE_BUILD_NUM"
ParserPath="$RELEASED_PARSER"
IgnoreWhitelist="true"
Bucket="codesplain-snippets-prod"
Role="arn:aws:iam::296636357169:role/CodesplainProd"
--region us-west-2
master:
branch: master
commands:
# Zip and deploy lambda code to S3
- bash publish codesplain-lambda-functions/dev/$CIRCLE_SHA1
# Package template for deloying Dev/Sandbox
- >
aws cloudformation package --template-file codesplainTemplate.yaml
--s3-bucket codesplain-lambda-functions
--output-template-file serverless-output.yaml
# Update Dev stack wtih current template and code changes
- >
aws cloudformation deploy
--stack-name "CodesplainDev"
--template-file ./serverless-output.yaml
--parameter-overrides
EnvVersion="dev"
S3Version="dev/$CIRCLE_SHA1"
ClientSecret="$CLIENT_SECRET_DEV"
ClientID="$CLIENT_ID_DEV"
Title="Codesplain API: Dev Environment"
CircleBuild="$CIRCLE_BUILD_NUM"
--region us-west-2
# Update Sandbox/Localhost stack with current template and code changes
- >
aws cloudformation deploy
--stack-name "Codesplain-Local"
--template-file ./serverless-output.yaml
--parameter-overrides
EnvVersion="sandbox"
S3Version="dev/$CIRCLE_SHA1"
ClientSecret="$CLIENT_SECRET_LOCAL"
ClientID="$CLIENT_ID_LOCAL"
Title="Codesplain API:Localhost"
CircleBuild="$CIRCLE_BUILD_NUM"
--region us-west-2
# Remove Cloudformation Stack from merged Feature Branch
- bash scripts/cleanup $CIRCLE_SHA1
feature:
branch: /^((?!master).)*$/ # not master
commands:
# Zip and push lambda code to S3 bucket under sandbox/branch
- bash publish codesplain-lambda-functions/sandbox/$CIRCLE_BRANCH/$CIRCLE_SHA1
- bash scripts/deployfeature