-
Notifications
You must be signed in to change notification settings - Fork 27
/
lambda-deploy.yml
174 lines (174 loc) · 7.52 KB
/
lambda-deploy.yml
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
version: v1
kind: lambda
application: potatolessFacts
targets: #This section defines the targets to which you are deploying, and their constraints.
Production-1:
account: arn:aws:iam::957626022434:role/ArmoryRole
constraints:
dependsOn:
- staging
deployAsIamRole: arn:aws:iam::957626022434:role/ArmoryRole
region: us-east-2
strategy: allAtOnce
Production-2:
account: arn:aws:iam::957626022434:role/ArmoryRole
constraints:
dependsOn:
- staging
deployAsIamRole: arn:aws:iam::957626022434:role/ArmoryRole
region: us-west-1
strategy: allAtOnce
staging:
account: arn:aws:iam::957626022434:role/ArmoryRole
constraints:
afterDeployment:
- runWebhook:
name: Integration_Tests
beforeDeployment:
- runWebhook:
name: Send_Slack_Deployment_Approval_Required
deployAsIamRole: arn:aws:iam::957626022434:role/ArmoryRole
region: us-east-1
strategy: allAtOnce
artifacts: #This section defines the artifacts you are deploying, by default they reach all targets, but you can specify certain targets if needed.
- functionName: potatolessFacts-satwell
path: s3://armory-product-demos-potatoless-facts-us-east-2/potatolessfacts-justsweetpotatoes.zip
type: zipFile
- functionName: potatolessLies-satwell
path: s3://armory-product-demos-potatoless-facts-us-east-2/potatolessfacts-justsweetpotatoes.zip
type: zipFile
- functionName: potatolessFacts-staging-satwell
path: s3://armory-product-demos-potatoless-facts-us-east-1/potatolessfacts-justsweetpotatoes.zip
type: zipFile
- functionName: potatolessLies-staging-satwell
path: s3://armory-product-demos-potatoless-facts-us-east-1/potatolessfacts-justsweetpotatoes.zip
type: zipFile
- functionName: potatolessFacts-prod2-satwell
path: s3://armory-product-demos-potatoless-facts-us-west-1/potatolessfacts-justsweetpotatoes.zip
type: zipFile
- functionName: potatolessLies-prod2-satwell
path: s3://armory-product-demos-potatoless-facts-us-west-1/potatolessfacts-justsweetpotatoes.zip
type: zipFile
providerOptions: #This section defines options specific to the cloud provider to which we are deploying.
lambda:
- handler: index.handler
name: potatolessFacts-satwell
runAsIamRole: arn:aws:iam::957626022434:role/CdkSandboxStack-WidgetsWidgetHandlerServiceRole8C2-14A5P01L3VA1Q
runtime: nodejs18.x
target: Production-1
- handler: index.handler
name: potatolessLies-satwell
runAsIamRole: arn:aws:iam::957626022434:role/CdkSandboxStack-WidgetsWidgetHandlerServiceRole8C2-14A5P01L3VA1Q
runtime: nodejs18.x
target: Production-1
- handler: index.handler
name: potatolessFacts-prod2-satwell
runAsIamRole: arn:aws:iam::957626022434:role/CdkSandboxStack-WidgetsWidgetHandlerServiceRole8C2-14A5P01L3VA1Q
runtime: nodejs18.x
target: Production-2
- handler: index.handler
name: potatolessLies-prod2-satwell
runAsIamRole: arn:aws:iam::957626022434:role/CdkSandboxStack-WidgetsWidgetHandlerServiceRole8C2-14A5P01L3VA1Q
runtime: nodejs18.x
target: Production-2
- handler: index.handler
name: potatolessFacts-staging-satwell
runAsIamRole: arn:aws:iam::957626022434:role/CdkSandboxStack-WidgetsWidgetHandlerServiceRole8C2-14A5P01L3VA1Q
runtime: nodejs18.x
target: staging
- handler: index.handler
name: potatolessLies-staging-satwell
runAsIamRole: arn:aws:iam::957626022434:role/CdkSandboxStack-WidgetsWidgetHandlerServiceRole8C2-14A5P01L3VA1Q
runtime: nodejs18.x
target: staging
strategies: #This section defines the strategies environments can use to deploy.
allAtOnce:
canary:
steps:
- setWeight:
weight: 100
- runWebhook:
name: Send_Slack_Deployment_Approval_Required
analysis: #This section defines queries against your monitoring system that can be used for automated canary analysis.
defaultMetricProviderName: Stephen-Prometheus
queries:
- lowerLimit: 0.0
name: avgCPUUsage-pass
queryTemplate: avg (avg_over_time(container_cpu_system_seconds_total{job="kubelet"}[{{armory.promQlStepInterval}}]) * on (pod) group_left (annotation_app) sum(kube_pod_annotations{job="kube-state-metrics",annotation_deploy_armory_io_replica_set_name="{{armory.replicaSetName}}"}) by (annotation_app, pod)) by (annotation_app) OR on() vector(0)
upperLimit: 10000.1
- lowerLimit: 0.0
name: avgCPUUsage-fail
queryTemplate: "avg (avg_over_time(container_cpu_system_seconds_total{job=\"kubelet\"}[{{armory.promQlStepInterval}}]) * on (pod) group_left (annotation_app)\n sum(kube_pod_annotations{job=\"kube-state-metrics\",annotation_deploy_armory_io_replica_set_name=\"{{armory.replicaSetName}}\"})\n by (annotation_app, pod)) by (annotation_app) "
upperLimit: 0.001
webhooks: #Webhooks can be used to run external automation.
- bodyTemplate:
inline: |-
{ "event_type": "webhookCallback", "client_payload": {
"callbackUri": "{{armory.callbackUri}}/callback"
}
}
headers:
- key: Authorization
value: token {{secrets.github_token}}
- key: Content-Type
value: application/json
method: POST
name: Check_Logs
retryCount: 3
uriTemplate: https://api.github.com/repos/{{secrets.github_org}}/{{secrets.github_repository}}/dispatches
- bodyTemplate:
inline: |-
{ "event_type": "checkLogs", "client_payload": {
"callbackUri": "{{armory.callbackUri}}/callback"
}
}
headers:
- key: Authorization
value: token {{secrets.github_token}}
- key: Content-Type
value: application/json
method: POST
name: Security_Scanners
retryCount: 3
uriTemplate: https://api.github.com/repos/{{secrets.github_org}}/{{secrets.github_repository}}/dispatches
- bodyTemplate:
inline: |-
{ "event_type": "checkLogs", "client_payload": {
"callbackUri": "{{armory.callbackUri}}/callback"
}
}
headers:
- key: Authorization
value: token {{secrets.github_token}}
- key: Content-Type
value: application/json
method: POST
name: Integration_Tests
retryCount: 3
uriTemplate: https://api.github.com/repos/{{secrets.github_org}}/{{secrets.github_repository}}/dispatches
- bodyTemplate:
inline: '{ "status_url": "https://console.cloud.armory.io/deployments/{{armory.deploymentId}}", "message": "Deployment of {{armory.applicationName}} to {{armory.environmentName}} is starting." }'
disableCallback: true
method: POST
name: Send_Slack_Deployment_Starting
retryCount: 3
uriTemplate: '{{secrets.slackwebhookURL}}'
- bodyTemplate:
inline: '{ "status_url": "https://console.cloud.armory.io/deployments/{{armory.deploymentId}}", "message": "Deployment of {{armory.applicationName}} to {{armory.environmentName}} is complete." }'
disableCallback: true
method: POST
name: Send_Slack_Deployment_Complete
retryCount: 3
uriTemplate: '{{secrets.slackwebhookURL}}'
- bodyTemplate:
inline: '{ "status_url": "https://console.cloud.armory.io/deployments/{{armory.deploymentId}}", "message": "Deployment of {{armory.applicationName}} to {{armory.environmentName}} requires a manual approval." }'
disableCallback: true
method: POST
name: Send_Slack_Deployment_Approval_Required
retryCount: 3
uriTemplate: '{{secrets.slackwebhookURL}}'
deploymentConfig:
keepDeploymentObject: true
timeout:
duration: 30
unit: minutes