@pipeline-builder/pipeline-manager 6.5.5 → 6.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/agent/post-steps.d.ts +1 -1
- package/dist/agent/post-steps.d.ts.map +1 -1
- package/dist/agent/post-steps.js +27 -31
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +8 -9
- package/dist/commands/audit-stacks.d.ts +2 -1
- package/dist/commands/audit-stacks.d.ts.map +1 -1
- package/dist/commands/audit-stacks.js +12 -2
- package/dist/commands/provision-steps.d.ts +1 -1
- package/dist/commands/provision-steps.js +2 -2
- package/dist/commands/provision.js +2 -2
- package/dist/commands/redrive-events.d.ts +4 -3
- package/dist/commands/redrive-events.d.ts.map +1 -1
- package/dist/commands/redrive-events.js +51 -18
- package/dist/commands/runner-signing-key.js +2 -2
- package/dist/commands/{setup-runner.d.ts → setup-account.d.ts} +119 -71
- package/dist/commands/setup-account.d.ts.map +1 -0
- package/dist/commands/setup-account.js +1345 -0
- package/dist/commands/store-token.d.ts +6 -28
- package/dist/commands/store-token.d.ts.map +1 -1
- package/dist/commands/store-token.js +12 -139
- package/dist/config/cli.constants.d.ts +0 -8
- package/dist/config/cli.constants.d.ts.map +1 -1
- package/dist/config/cli.constants.js +1 -9
- package/dist/lambda/events-handler.js +1529 -0
- package/dist/lambda/runner-handler.d.ts +25 -1
- package/dist/lambda/runner-handler.d.ts.map +1 -1
- package/dist/lambda/runner-handler.js +390 -44
- package/dist/lambda/runner-inspect-connection.d.ts +32 -0
- package/dist/lambda/runner-inspect-connection.d.ts.map +1 -0
- package/dist/lambda/runner-inspect-connection.js +144 -0
- package/dist/lambda/runner-jws.d.ts.map +1 -1
- package/dist/lambda/runner-jws.js +57 -5
- package/dist/lambda/runner-sources.d.ts +12 -0
- package/dist/lambda/runner-sources.d.ts.map +1 -1
- package/dist/lambda/runner-sources.js +25 -16
- package/dist/lambda/token-renew-handler.d.ts +3 -2
- package/dist/lambda/token-renew-handler.d.ts.map +1 -1
- package/dist/lambda/token-renew-handler.js +17 -5
- package/dist/templates/account-stack.json +2049 -0
- package/dist/templates/forwarder-stack.json +133 -0
- package/dist/utils/{runner-template.d.ts → account-template.d.ts} +68 -17
- package/dist/utils/account-template.d.ts.map +1 -0
- package/dist/utils/account-template.js +316 -0
- package/dist/utils/inspect-buildspec.d.ts +9 -0
- package/dist/utils/inspect-buildspec.d.ts.map +1 -0
- package/dist/utils/inspect-buildspec.js +209 -0
- package/package.json +5 -4
- package/dist/commands/setup-events.d.ts +0 -15
- package/dist/commands/setup-events.d.ts.map +0 -1
- package/dist/commands/setup-events.js +0 -182
- package/dist/commands/setup-runner.d.ts.map +0 -1
- package/dist/commands/setup-runner.js +0 -1132
- package/dist/templates/events-stack.json +0 -192
- package/dist/templates/runner-stack.json +0 -960
- package/dist/templates/token-renew-stack.json +0 -115
- package/dist/utils/cron.d.ts +0 -28
- package/dist/utils/cron.d.ts.map +0 -1
- package/dist/utils/cron.js +0 -119
- package/dist/utils/runner-template.d.ts.map +0 -1
- package/dist/utils/runner-template.js +0 -238
|
@@ -0,0 +1,2049 @@
|
|
|
1
|
+
{
|
|
2
|
+
"AWSTemplateFormatVersion": "2010-09-09",
|
|
3
|
+
"Description": "Pipeline Builder ACCOUNT CONNECTOR — one stack per (AWS account, organization), deployed by pipeline-manager infra setup-account. RUNNER (EnableRunner): a Lambda that starts/stops this account's pipelines on platform-signed requests to its Function URL (or an IP-allowlisted, WAF rate-limited API Gateway), with an optional deploy CodeBuild project (EnableDeploy) and the inspect CodeBuild project + results bucket. REPORTING (EnableReporting): an EventBridge rule — filtered to the allowlisted pipeline-name prefixes — feeding an encrypted SQS queue (+ dead-letter queue) and the events Lambda that forwards CodePipeline state changes to the platform, stamping the SSM last-event parameter the runner's health ping reports. KEY RENEWAL (RenewSecretNames): a scheduled Lambda rotating this org's platform credentials in Secrets Manager. Every role takes the optional PermissionsBoundaryArn. setup-account renders the prefix-scoped grants and event pattern (utils/account-template.ts), uploads the template to the CDK bootstrap bucket and the Lambda code separately.",
|
|
4
|
+
"Parameters": {
|
|
5
|
+
"RunnerId": {
|
|
6
|
+
"Type": "String",
|
|
7
|
+
"Description": "The connector id (the platform's runner id: every signed request's aud). '' with EnableRunner=false.",
|
|
8
|
+
"Default": ""
|
|
9
|
+
},
|
|
10
|
+
"PlatformBaseUrl": {
|
|
11
|
+
"Type": "String",
|
|
12
|
+
"Description": "The platform's base URL (https). Signatures are verified against this runner's own key set, <PlatformBaseUrl>/api/pipelines/runner/runners/<RunnerId>/jwks.json (its owning organization's keys only)."
|
|
13
|
+
},
|
|
14
|
+
"EntryPoint": {
|
|
15
|
+
"Type": "String",
|
|
16
|
+
"Default": "function-url",
|
|
17
|
+
"AllowedValues": [
|
|
18
|
+
"function-url",
|
|
19
|
+
"api-gateway"
|
|
20
|
+
],
|
|
21
|
+
"Description": "A Lambda Function URL, or a REST API whose resource policy admits only AllowedIps."
|
|
22
|
+
},
|
|
23
|
+
"AllowedIps": {
|
|
24
|
+
"Type": "CommaDelimitedList",
|
|
25
|
+
"Default": "255.255.255.255/32",
|
|
26
|
+
"Description": "api-gateway entry point only: source CIDRs (the platform's egress IPs) the API admits."
|
|
27
|
+
},
|
|
28
|
+
"EnableWaf": {
|
|
29
|
+
"Type": "String",
|
|
30
|
+
"Default": "true",
|
|
31
|
+
"AllowedValues": [
|
|
32
|
+
"true",
|
|
33
|
+
"false"
|
|
34
|
+
],
|
|
35
|
+
"Description": "api-gateway entry point only: attach a WAFv2 web ACL with a per-IP rate-based rule to the API stage ('false' = setup-runner --no-waf). Ignored for the Function URL entry point."
|
|
36
|
+
},
|
|
37
|
+
"WafRateLimit": {
|
|
38
|
+
"Type": "Number",
|
|
39
|
+
"Default": 1000,
|
|
40
|
+
"MinValue": 10,
|
|
41
|
+
"MaxValue": 2000000000,
|
|
42
|
+
"Description": "api-gateway entry point with EnableWaf: requests one source IP may send in any 5-minute window before WAF blocks it (WAFv2 rate-based rule; setup-runner --waf-rate-limit)."
|
|
43
|
+
},
|
|
44
|
+
"AllowedRegions": {
|
|
45
|
+
"Type": "String",
|
|
46
|
+
"Description": "Regions the runner may act in and reporting covers (comma-separated); the first is this stack's home region."
|
|
47
|
+
},
|
|
48
|
+
"AllowedPipelinePrefixes": {
|
|
49
|
+
"Type": "String",
|
|
50
|
+
"Description": "Comma-separated CodePipeline name prefixes the runner may act on ('*' = every pipeline)."
|
|
51
|
+
},
|
|
52
|
+
"PipelinePrefix": {
|
|
53
|
+
"Type": "String",
|
|
54
|
+
"Default": "pipeline-builder-",
|
|
55
|
+
"Description": "Single-prefix fallback used only when this template is deployed as-is; setup-runner replaces the PipelineActions resources with every region x prefix."
|
|
56
|
+
},
|
|
57
|
+
"NameSuffix": {
|
|
58
|
+
"Type": "String",
|
|
59
|
+
"Default": "",
|
|
60
|
+
"Description": "Suffix on the role/function/API names: setup-runner passes '-<RunnerId>', so runners of different organizations never collide in one account (an organization has at most one runner per account)."
|
|
61
|
+
},
|
|
62
|
+
"PipelineManagerVersion": {
|
|
63
|
+
"Type": "String",
|
|
64
|
+
"Default": "0.0.0",
|
|
65
|
+
"Description": "The @pipeline-builder/pipeline-manager version whose runner bundle this stack runs (semver; reported as runnerVersion in every response and checked against the platform's MIN_RUNNER_VERSION). setup-runner always passes its own package version; 0.0.0 marks a hand-deployed stack as outdated."
|
|
66
|
+
},
|
|
67
|
+
"EnableDeploy": {
|
|
68
|
+
"Type": "String",
|
|
69
|
+
"Default": "false",
|
|
70
|
+
"AllowedValues": [
|
|
71
|
+
"true",
|
|
72
|
+
"false"
|
|
73
|
+
],
|
|
74
|
+
"Description": "Deploys through this runner (setup-runner --enable-deploy): the deploy CodeBuild project, its role, log group and grant key. The runner answers DEPLOY_NOT_ENABLED to a deploy request without it and reports the deploy:1 capability only with it."
|
|
75
|
+
},
|
|
76
|
+
"RegistryPullHost": {
|
|
77
|
+
"Type": "String",
|
|
78
|
+
"Default": "",
|
|
79
|
+
"AllowedPattern": "^$|^[A-Za-z0-9.-]+(:[0-9]{1,5})?$",
|
|
80
|
+
"Description": "EnableDeploy only: the platform registry host (and :port) the deploy build pulls the pipeline's system/cdk-synth image from, pinned by digest. Never taken from a request."
|
|
81
|
+
},
|
|
82
|
+
"RegistryCredentialSecretName": {
|
|
83
|
+
"Type": "String",
|
|
84
|
+
"Default": "",
|
|
85
|
+
"Description": "EnableDeploy only: the Secrets Manager secret (in the stack region) holding the registry:push key CodeBuild pulls the image with — pipeline-builder/<orgId>/registry-push (pipeline-manager infra store-token --scope registry:push)."
|
|
86
|
+
},
|
|
87
|
+
"CdkQualifier": {
|
|
88
|
+
"Type": "String",
|
|
89
|
+
"Default": "hnb659fds",
|
|
90
|
+
"AllowedPattern": "^[A-Za-z0-9]{1,10}$",
|
|
91
|
+
"Description": "EnableDeploy only: the CDK bootstrap qualifier of the regions deployed into (cdk-<qualifier>-*-role-<account>-<region> are the only roles the deploy job may assume)."
|
|
92
|
+
},
|
|
93
|
+
"DeployTimeoutMinutes": {
|
|
94
|
+
"Type": "Number",
|
|
95
|
+
"Default": 60,
|
|
96
|
+
"MinValue": 10,
|
|
97
|
+
"MaxValue": 120,
|
|
98
|
+
"Description": "EnableDeploy only: the deploy build's timeout (CodeBuild TimeoutInMinutes). At most 120: the platform's deploy deadline (RUNNER_DEPLOY_DEADLINE_MINUTES, default 120) cancels a longer deploy first, failing DEPLOY_TIMED_OUT."
|
|
99
|
+
},
|
|
100
|
+
"DeployConcurrency": {
|
|
101
|
+
"Type": "Number",
|
|
102
|
+
"Default": 2,
|
|
103
|
+
"MinValue": 1,
|
|
104
|
+
"MaxValue": 20,
|
|
105
|
+
"Description": "EnableDeploy only: deploy builds that may run at once (CodeBuild ConcurrentBuildLimit; the platform's MAX_ACTIVE_DEPLOYS_PER_RUNNER is the first limit)."
|
|
106
|
+
},
|
|
107
|
+
"EnableRunner": {
|
|
108
|
+
"Type": "String",
|
|
109
|
+
"Default": "true",
|
|
110
|
+
"AllowedValues": [
|
|
111
|
+
"true",
|
|
112
|
+
"false"
|
|
113
|
+
],
|
|
114
|
+
"Description": "The runner Lambda and its endpoint (setup-account --no-runner: false)."
|
|
115
|
+
},
|
|
116
|
+
"EnableReporting": {
|
|
117
|
+
"Type": "String",
|
|
118
|
+
"Default": "true",
|
|
119
|
+
"AllowedValues": [
|
|
120
|
+
"true",
|
|
121
|
+
"false"
|
|
122
|
+
],
|
|
123
|
+
"Description": "EventBridge reporting of CodePipeline state changes (setup-account --no-reporting: false)."
|
|
124
|
+
},
|
|
125
|
+
"OrgId": {
|
|
126
|
+
"Type": "String",
|
|
127
|
+
"AllowedPattern": "^[A-Za-z0-9_-]{1,64}$",
|
|
128
|
+
"Description": "The organization's id: scopes every Secrets Manager grant to pipeline-builder/<OrgId>/*."
|
|
129
|
+
},
|
|
130
|
+
"ReportingSecretName": {
|
|
131
|
+
"Type": "String",
|
|
132
|
+
"Default": "",
|
|
133
|
+
"Description": "EnableReporting: the reporting:ingest credential secret (pipeline-builder/<orgId>/reporting-ingest)."
|
|
134
|
+
},
|
|
135
|
+
"DoraEnabled": {
|
|
136
|
+
"Type": "String",
|
|
137
|
+
"Default": "false",
|
|
138
|
+
"AllowedValues": [
|
|
139
|
+
"false",
|
|
140
|
+
"true"
|
|
141
|
+
],
|
|
142
|
+
"Description": "EnableReporting: resolve commit timestamps in-account for DORA lead time (advanced_reporting add-on)."
|
|
143
|
+
},
|
|
144
|
+
"RenewSecretNames": {
|
|
145
|
+
"Type": "String",
|
|
146
|
+
"Default": "",
|
|
147
|
+
"Description": "Credential secrets the key renewal rotates (comma-separated, each pipeline-builder/<OrgId>/…); '' = no renewal."
|
|
148
|
+
},
|
|
149
|
+
"KeyLifetimeDays": {
|
|
150
|
+
"Type": "Number",
|
|
151
|
+
"Default": 30,
|
|
152
|
+
"MinValue": 1,
|
|
153
|
+
"MaxValue": 365,
|
|
154
|
+
"Description": "Lifetime in days of each rotated key."
|
|
155
|
+
},
|
|
156
|
+
"RenewSchedule": {
|
|
157
|
+
"Type": "String",
|
|
158
|
+
"Default": "cron(0 0 * * ? *)",
|
|
159
|
+
"Description": "EventBridge schedule of the key renewal (default daily 00:00 UTC)."
|
|
160
|
+
},
|
|
161
|
+
"PermissionsBoundaryArn": {
|
|
162
|
+
"Type": "String",
|
|
163
|
+
"Default": "",
|
|
164
|
+
"Description": "An IAM permissions boundary every role in the stack takes ('' = none)."
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
"Conditions": {
|
|
168
|
+
"UseFunctionUrl": {
|
|
169
|
+
"Fn::And": [
|
|
170
|
+
{
|
|
171
|
+
"Condition": "RunnerOn"
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
"Fn::Equals": [
|
|
175
|
+
{
|
|
176
|
+
"Ref": "EntryPoint"
|
|
177
|
+
},
|
|
178
|
+
"function-url"
|
|
179
|
+
]
|
|
180
|
+
}
|
|
181
|
+
]
|
|
182
|
+
},
|
|
183
|
+
"UseApiGateway": {
|
|
184
|
+
"Fn::And": [
|
|
185
|
+
{
|
|
186
|
+
"Condition": "RunnerOn"
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
"Fn::Equals": [
|
|
190
|
+
{
|
|
191
|
+
"Ref": "EntryPoint"
|
|
192
|
+
},
|
|
193
|
+
"api-gateway"
|
|
194
|
+
]
|
|
195
|
+
}
|
|
196
|
+
]
|
|
197
|
+
},
|
|
198
|
+
"UseWaf": {
|
|
199
|
+
"Fn::And": [
|
|
200
|
+
{
|
|
201
|
+
"Condition": "UseApiGateway"
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
"Fn::Equals": [
|
|
205
|
+
{
|
|
206
|
+
"Ref": "EnableWaf"
|
|
207
|
+
},
|
|
208
|
+
"true"
|
|
209
|
+
]
|
|
210
|
+
}
|
|
211
|
+
]
|
|
212
|
+
},
|
|
213
|
+
"UseDeploy": {
|
|
214
|
+
"Fn::And": [
|
|
215
|
+
{
|
|
216
|
+
"Condition": "RunnerOn"
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
"Fn::Equals": [
|
|
220
|
+
{
|
|
221
|
+
"Ref": "EnableDeploy"
|
|
222
|
+
},
|
|
223
|
+
"true"
|
|
224
|
+
]
|
|
225
|
+
}
|
|
226
|
+
]
|
|
227
|
+
},
|
|
228
|
+
"RunnerOn": {
|
|
229
|
+
"Fn::Equals": [
|
|
230
|
+
{
|
|
231
|
+
"Ref": "EnableRunner"
|
|
232
|
+
},
|
|
233
|
+
"true"
|
|
234
|
+
]
|
|
235
|
+
},
|
|
236
|
+
"ReportingOn": {
|
|
237
|
+
"Fn::Equals": [
|
|
238
|
+
{
|
|
239
|
+
"Ref": "EnableReporting"
|
|
240
|
+
},
|
|
241
|
+
"true"
|
|
242
|
+
]
|
|
243
|
+
},
|
|
244
|
+
"RunnerReporting": {
|
|
245
|
+
"Fn::And": [
|
|
246
|
+
{
|
|
247
|
+
"Condition": "RunnerOn"
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
"Condition": "ReportingOn"
|
|
251
|
+
}
|
|
252
|
+
]
|
|
253
|
+
},
|
|
254
|
+
"RenewOn": {
|
|
255
|
+
"Fn::Not": [
|
|
256
|
+
{
|
|
257
|
+
"Fn::Equals": [
|
|
258
|
+
{
|
|
259
|
+
"Ref": "RenewSecretNames"
|
|
260
|
+
},
|
|
261
|
+
""
|
|
262
|
+
]
|
|
263
|
+
}
|
|
264
|
+
]
|
|
265
|
+
},
|
|
266
|
+
"DoraOn": {
|
|
267
|
+
"Fn::And": [
|
|
268
|
+
{
|
|
269
|
+
"Condition": "ReportingOn"
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
"Fn::Equals": [
|
|
273
|
+
{
|
|
274
|
+
"Ref": "DoraEnabled"
|
|
275
|
+
},
|
|
276
|
+
"true"
|
|
277
|
+
]
|
|
278
|
+
}
|
|
279
|
+
]
|
|
280
|
+
},
|
|
281
|
+
"HasPermissionsBoundary": {
|
|
282
|
+
"Fn::Not": [
|
|
283
|
+
{
|
|
284
|
+
"Fn::Equals": [
|
|
285
|
+
{
|
|
286
|
+
"Ref": "PermissionsBoundaryArn"
|
|
287
|
+
},
|
|
288
|
+
""
|
|
289
|
+
]
|
|
290
|
+
}
|
|
291
|
+
]
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
"Resources": {
|
|
295
|
+
"RunnerRole": {
|
|
296
|
+
"Type": "AWS::IAM::Role",
|
|
297
|
+
"Properties": {
|
|
298
|
+
"RoleName": {
|
|
299
|
+
"Fn::Sub": "pipeline-builder-runner${NameSuffix}"
|
|
300
|
+
},
|
|
301
|
+
"AssumeRolePolicyDocument": {
|
|
302
|
+
"Version": "2012-10-17",
|
|
303
|
+
"Statement": [
|
|
304
|
+
{
|
|
305
|
+
"Effect": "Allow",
|
|
306
|
+
"Principal": {
|
|
307
|
+
"Service": "lambda.amazonaws.com"
|
|
308
|
+
},
|
|
309
|
+
"Action": "sts:AssumeRole"
|
|
310
|
+
}
|
|
311
|
+
]
|
|
312
|
+
},
|
|
313
|
+
"ManagedPolicyArns": [
|
|
314
|
+
{
|
|
315
|
+
"Fn::Sub": "arn:${AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
|
|
316
|
+
}
|
|
317
|
+
],
|
|
318
|
+
"Policies": [
|
|
319
|
+
{
|
|
320
|
+
"PolicyName": "pipeline-runner",
|
|
321
|
+
"PolicyDocument": {
|
|
322
|
+
"Version": "2012-10-17",
|
|
323
|
+
"Statement": [
|
|
324
|
+
{
|
|
325
|
+
"Sid": "FindPipelineByTag",
|
|
326
|
+
"Effect": "Allow",
|
|
327
|
+
"Action": [
|
|
328
|
+
"tag:GetResources"
|
|
329
|
+
],
|
|
330
|
+
"Resource": "*"
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
"Sid": "PipelineActions",
|
|
334
|
+
"Effect": "Allow",
|
|
335
|
+
"Action": [
|
|
336
|
+
"codepipeline:StartPipelineExecution",
|
|
337
|
+
"codepipeline:StopPipelineExecution",
|
|
338
|
+
"codepipeline:GetPipelineExecution",
|
|
339
|
+
"codepipeline:ListTagsForResource"
|
|
340
|
+
],
|
|
341
|
+
"Resource": [
|
|
342
|
+
{
|
|
343
|
+
"Fn::Sub": "arn:${AWS::Partition}:codepipeline:${AWS::Region}:${AWS::AccountId}:${PipelinePrefix}*"
|
|
344
|
+
}
|
|
345
|
+
]
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
"Sid": "ListSourceConnections",
|
|
349
|
+
"Effect": "Allow",
|
|
350
|
+
"Action": [
|
|
351
|
+
"codeconnections:ListConnections",
|
|
352
|
+
"codeconnections:ListHosts",
|
|
353
|
+
"codestar-connections:ListConnections",
|
|
354
|
+
"codestar-connections:ListHosts"
|
|
355
|
+
],
|
|
356
|
+
"Resource": "*"
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
"Sid": "ReadSourceConnections",
|
|
360
|
+
"Effect": "Allow",
|
|
361
|
+
"Action": [
|
|
362
|
+
"codeconnections:GetConnection",
|
|
363
|
+
"codeconnections:GetHost",
|
|
364
|
+
"codestar-connections:GetConnection",
|
|
365
|
+
"codestar-connections:GetHost"
|
|
366
|
+
],
|
|
367
|
+
"Resource": [
|
|
368
|
+
{
|
|
369
|
+
"Fn::Sub": "arn:${AWS::Partition}:codeconnections:${AWS::Region}:${AWS::AccountId}:connection/*"
|
|
370
|
+
},
|
|
371
|
+
{
|
|
372
|
+
"Fn::Sub": "arn:${AWS::Partition}:codeconnections:${AWS::Region}:${AWS::AccountId}:host/*"
|
|
373
|
+
},
|
|
374
|
+
{
|
|
375
|
+
"Fn::Sub": "arn:${AWS::Partition}:codestar-connections:${AWS::Region}:${AWS::AccountId}:connection/*"
|
|
376
|
+
},
|
|
377
|
+
{
|
|
378
|
+
"Fn::Sub": "arn:${AWS::Partition}:codestar-connections:${AWS::Region}:${AWS::AccountId}:host/*"
|
|
379
|
+
}
|
|
380
|
+
]
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
"Sid": "DescribeGitHubTokenSecrets",
|
|
384
|
+
"Effect": "Allow",
|
|
385
|
+
"Action": [
|
|
386
|
+
"secretsmanager:DescribeSecret"
|
|
387
|
+
],
|
|
388
|
+
"Resource": [
|
|
389
|
+
{
|
|
390
|
+
"Fn::Sub": "arn:${AWS::Partition}:secretsmanager:${AWS::Region}:${AWS::AccountId}:secret:pipeline-builder/*/github-token"
|
|
391
|
+
},
|
|
392
|
+
{
|
|
393
|
+
"Fn::Sub": "arn:${AWS::Partition}:secretsmanager:${AWS::Region}:${AWS::AccountId}:secret:pipeline-builder/*/github-token-??????"
|
|
394
|
+
},
|
|
395
|
+
{
|
|
396
|
+
"Fn::Sub": "arn:${AWS::Partition}:secretsmanager:${AWS::Region}:${AWS::AccountId}:secret:pipeline-builder/*/github-token/*"
|
|
397
|
+
}
|
|
398
|
+
]
|
|
399
|
+
},
|
|
400
|
+
{
|
|
401
|
+
"Sid": "ReadGitHubTokenSecrets",
|
|
402
|
+
"Effect": "Allow",
|
|
403
|
+
"Action": [
|
|
404
|
+
"secretsmanager:GetSecretValue"
|
|
405
|
+
],
|
|
406
|
+
"Resource": [
|
|
407
|
+
{
|
|
408
|
+
"Fn::Sub": "arn:${AWS::Partition}:secretsmanager:${AWS::Region}:${AWS::AccountId}:secret:pipeline-builder/*/github-token"
|
|
409
|
+
},
|
|
410
|
+
{
|
|
411
|
+
"Fn::Sub": "arn:${AWS::Partition}:secretsmanager:${AWS::Region}:${AWS::AccountId}:secret:pipeline-builder/*/github-token-??????"
|
|
412
|
+
},
|
|
413
|
+
{
|
|
414
|
+
"Fn::Sub": "arn:${AWS::Partition}:secretsmanager:${AWS::Region}:${AWS::AccountId}:secret:pipeline-builder/*/github-token/*"
|
|
415
|
+
}
|
|
416
|
+
]
|
|
417
|
+
},
|
|
418
|
+
{
|
|
419
|
+
"Sid": "InspectBuild",
|
|
420
|
+
"Effect": "Allow",
|
|
421
|
+
"Action": [
|
|
422
|
+
"codebuild:StartBuild",
|
|
423
|
+
"codebuild:BatchGetBuilds"
|
|
424
|
+
],
|
|
425
|
+
"Resource": {
|
|
426
|
+
"Fn::Sub": "arn:${AWS::Partition}:codebuild:${AWS::Region}:${AWS::AccountId}:project/pipeline-builder-inspect-${RunnerId}"
|
|
427
|
+
}
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
"Sid": "PassCodeConnectionToInspectBuild",
|
|
431
|
+
"Effect": "Allow",
|
|
432
|
+
"Action": [
|
|
433
|
+
"codeconnections:PassConnection"
|
|
434
|
+
],
|
|
435
|
+
"Resource": {
|
|
436
|
+
"Fn::Sub": "arn:${AWS::Partition}:codeconnections:${AWS::Region}:${AWS::AccountId}:connection/*"
|
|
437
|
+
},
|
|
438
|
+
"Condition": {
|
|
439
|
+
"StringEquals": {
|
|
440
|
+
"codeconnections:PassedToService": "codebuild.amazonaws.com"
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
},
|
|
444
|
+
{
|
|
445
|
+
"Sid": "PassCodeStarConnectionToInspectBuild",
|
|
446
|
+
"Effect": "Allow",
|
|
447
|
+
"Action": [
|
|
448
|
+
"codestar-connections:PassConnection"
|
|
449
|
+
],
|
|
450
|
+
"Resource": {
|
|
451
|
+
"Fn::Sub": "arn:${AWS::Partition}:codestar-connections:${AWS::Region}:${AWS::AccountId}:connection/*"
|
|
452
|
+
},
|
|
453
|
+
"Condition": {
|
|
454
|
+
"StringEquals": {
|
|
455
|
+
"codestar-connections:PassedToService": "codebuild.amazonaws.com"
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
},
|
|
459
|
+
{
|
|
460
|
+
"Sid": "ReadInspectResults",
|
|
461
|
+
"Effect": "Allow",
|
|
462
|
+
"Action": [
|
|
463
|
+
"s3:GetObject",
|
|
464
|
+
"s3:DeleteObject"
|
|
465
|
+
],
|
|
466
|
+
"Resource": {
|
|
467
|
+
"Fn::Sub": "${InspectResultsBucket.Arn}/*"
|
|
468
|
+
}
|
|
469
|
+
},
|
|
470
|
+
{
|
|
471
|
+
"Fn::If": [
|
|
472
|
+
"UseDeploy",
|
|
473
|
+
{
|
|
474
|
+
"Sid": "DeployBuild",
|
|
475
|
+
"Effect": "Allow",
|
|
476
|
+
"Action": [
|
|
477
|
+
"codebuild:StartBuild",
|
|
478
|
+
"codebuild:BatchGetBuilds",
|
|
479
|
+
"codebuild:StopBuild",
|
|
480
|
+
"codebuild:ListBuildsForProject"
|
|
481
|
+
],
|
|
482
|
+
"Resource": [
|
|
483
|
+
{
|
|
484
|
+
"Fn::Sub": "arn:${AWS::Partition}:codebuild:${AWS::Region}:${AWS::AccountId}:project/pipeline-builder-runner-deploy-${RunnerId}"
|
|
485
|
+
}
|
|
486
|
+
]
|
|
487
|
+
},
|
|
488
|
+
{
|
|
489
|
+
"Ref": "AWS::NoValue"
|
|
490
|
+
}
|
|
491
|
+
]
|
|
492
|
+
},
|
|
493
|
+
{
|
|
494
|
+
"Fn::If": [
|
|
495
|
+
"RunnerReporting",
|
|
496
|
+
{
|
|
497
|
+
"Sid": "ReportingHealth",
|
|
498
|
+
"Effect": "Allow",
|
|
499
|
+
"Action": [
|
|
500
|
+
"sqs:GetQueueAttributes",
|
|
501
|
+
"ssm:GetParameter"
|
|
502
|
+
],
|
|
503
|
+
"Resource": [
|
|
504
|
+
{
|
|
505
|
+
"Fn::GetAtt": [
|
|
506
|
+
"EventDeadLetterQueue",
|
|
507
|
+
"Arn"
|
|
508
|
+
]
|
|
509
|
+
},
|
|
510
|
+
{
|
|
511
|
+
"Fn::Sub": "arn:${AWS::Partition}:ssm:${AWS::Region}:${AWS::AccountId}:parameter/pipeline-builder/events${NameSuffix}/last-event"
|
|
512
|
+
}
|
|
513
|
+
]
|
|
514
|
+
},
|
|
515
|
+
{
|
|
516
|
+
"Ref": "AWS::NoValue"
|
|
517
|
+
}
|
|
518
|
+
]
|
|
519
|
+
}
|
|
520
|
+
]
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
],
|
|
524
|
+
"PermissionsBoundary": {
|
|
525
|
+
"Fn::If": [
|
|
526
|
+
"HasPermissionsBoundary",
|
|
527
|
+
{
|
|
528
|
+
"Ref": "PermissionsBoundaryArn"
|
|
529
|
+
},
|
|
530
|
+
{
|
|
531
|
+
"Ref": "AWS::NoValue"
|
|
532
|
+
}
|
|
533
|
+
]
|
|
534
|
+
}
|
|
535
|
+
},
|
|
536
|
+
"Condition": "RunnerOn"
|
|
537
|
+
},
|
|
538
|
+
"RunnerFunction": {
|
|
539
|
+
"Type": "AWS::Lambda::Function",
|
|
540
|
+
"Properties": {
|
|
541
|
+
"FunctionName": {
|
|
542
|
+
"Fn::Sub": "pipeline-builder-runner${NameSuffix}"
|
|
543
|
+
},
|
|
544
|
+
"Runtime": "nodejs26.x",
|
|
545
|
+
"Handler": "index.handler",
|
|
546
|
+
"Code": {
|
|
547
|
+
"ZipFile": "exports.handler=async()=>({statusCode:500,body:JSON.stringify({errorCode:'RUNNER_ERROR'})})"
|
|
548
|
+
},
|
|
549
|
+
"Role": {
|
|
550
|
+
"Fn::GetAtt": [
|
|
551
|
+
"RunnerRole",
|
|
552
|
+
"Arn"
|
|
553
|
+
]
|
|
554
|
+
},
|
|
555
|
+
"Timeout": 30,
|
|
556
|
+
"MemorySize": 256,
|
|
557
|
+
"ReservedConcurrentExecutions": 2,
|
|
558
|
+
"Environment": {
|
|
559
|
+
"Variables": {
|
|
560
|
+
"RUNNER_ID": {
|
|
561
|
+
"Ref": "RunnerId"
|
|
562
|
+
},
|
|
563
|
+
"PLATFORM_BASE_URL": {
|
|
564
|
+
"Ref": "PlatformBaseUrl"
|
|
565
|
+
},
|
|
566
|
+
"ALLOWED_REGIONS": {
|
|
567
|
+
"Ref": "AllowedRegions"
|
|
568
|
+
},
|
|
569
|
+
"ALLOWED_PIPELINE_PREFIXES": {
|
|
570
|
+
"Ref": "AllowedPipelinePrefixes"
|
|
571
|
+
},
|
|
572
|
+
"RUNNER_VERSION": {
|
|
573
|
+
"Ref": "PipelineManagerVersion"
|
|
574
|
+
},
|
|
575
|
+
"DEPLOY_ENABLED": {
|
|
576
|
+
"Ref": "EnableDeploy"
|
|
577
|
+
},
|
|
578
|
+
"DEPLOY_PROJECT_NAME": {
|
|
579
|
+
"Fn::If": [
|
|
580
|
+
"UseDeploy",
|
|
581
|
+
{
|
|
582
|
+
"Fn::Sub": "pipeline-builder-runner-deploy-${RunnerId}"
|
|
583
|
+
},
|
|
584
|
+
""
|
|
585
|
+
]
|
|
586
|
+
},
|
|
587
|
+
"REGISTRY_PULL_HOST": {
|
|
588
|
+
"Ref": "RegistryPullHost"
|
|
589
|
+
},
|
|
590
|
+
"REGISTRY_CREDENTIAL_SECRET": {
|
|
591
|
+
"Ref": "RegistryCredentialSecretName"
|
|
592
|
+
},
|
|
593
|
+
"DEPLOY_GRANT_KEY_ARN": {
|
|
594
|
+
"Fn::If": [
|
|
595
|
+
"UseDeploy",
|
|
596
|
+
{
|
|
597
|
+
"Fn::GetAtt": [
|
|
598
|
+
"DeployGrantKey",
|
|
599
|
+
"Arn"
|
|
600
|
+
]
|
|
601
|
+
},
|
|
602
|
+
""
|
|
603
|
+
]
|
|
604
|
+
},
|
|
605
|
+
"NODE_ENV": "production",
|
|
606
|
+
"INSPECT_PROJECT_NAME": {
|
|
607
|
+
"Fn::Sub": "pipeline-builder-inspect-${RunnerId}"
|
|
608
|
+
},
|
|
609
|
+
"INSPECT_RESULTS_BUCKET": {
|
|
610
|
+
"Ref": "InspectResultsBucket"
|
|
611
|
+
},
|
|
612
|
+
"REPORTING_DLQ_URL": {
|
|
613
|
+
"Fn::If": [
|
|
614
|
+
"RunnerReporting",
|
|
615
|
+
{
|
|
616
|
+
"Ref": "EventDeadLetterQueue"
|
|
617
|
+
},
|
|
618
|
+
{
|
|
619
|
+
"Ref": "AWS::NoValue"
|
|
620
|
+
}
|
|
621
|
+
]
|
|
622
|
+
},
|
|
623
|
+
"REPORTING_LAST_EVENT_PARAMETER": {
|
|
624
|
+
"Fn::If": [
|
|
625
|
+
"RunnerReporting",
|
|
626
|
+
{
|
|
627
|
+
"Ref": "LastEventParameter"
|
|
628
|
+
},
|
|
629
|
+
{
|
|
630
|
+
"Ref": "AWS::NoValue"
|
|
631
|
+
}
|
|
632
|
+
]
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
},
|
|
637
|
+
"Condition": "RunnerOn"
|
|
638
|
+
},
|
|
639
|
+
"RunnerLogGroup": {
|
|
640
|
+
"Type": "AWS::Logs::LogGroup",
|
|
641
|
+
"Properties": {
|
|
642
|
+
"LogGroupName": {
|
|
643
|
+
"Fn::Sub": "/aws/lambda/pipeline-builder-runner${NameSuffix}"
|
|
644
|
+
},
|
|
645
|
+
"RetentionInDays": 90
|
|
646
|
+
},
|
|
647
|
+
"Condition": "RunnerOn"
|
|
648
|
+
},
|
|
649
|
+
"DeployLogGroup": {
|
|
650
|
+
"Type": "AWS::Logs::LogGroup",
|
|
651
|
+
"Condition": "UseDeploy",
|
|
652
|
+
"Properties": {
|
|
653
|
+
"LogGroupName": {
|
|
654
|
+
"Fn::Sub": "/aws/codebuild/pipeline-builder-runner-deploy-${RunnerId}"
|
|
655
|
+
},
|
|
656
|
+
"RetentionInDays": 90
|
|
657
|
+
}
|
|
658
|
+
},
|
|
659
|
+
"DeployRole": {
|
|
660
|
+
"Type": "AWS::IAM::Role",
|
|
661
|
+
"Condition": "UseDeploy",
|
|
662
|
+
"Properties": {
|
|
663
|
+
"RoleName": {
|
|
664
|
+
"Fn::Sub": "pb-runner-deploy${NameSuffix}"
|
|
665
|
+
},
|
|
666
|
+
"Description": "Pipeline Builder runner deploy job: assumes only this account's CDK bootstrap roles in the allowlisted regions (cdk deploy), never IAM or CloudFormation directly.",
|
|
667
|
+
"AssumeRolePolicyDocument": {
|
|
668
|
+
"Version": "2012-10-17",
|
|
669
|
+
"Statement": [
|
|
670
|
+
{
|
|
671
|
+
"Effect": "Allow",
|
|
672
|
+
"Principal": {
|
|
673
|
+
"Service": "codebuild.amazonaws.com"
|
|
674
|
+
},
|
|
675
|
+
"Action": "sts:AssumeRole",
|
|
676
|
+
"Condition": {
|
|
677
|
+
"StringEquals": {
|
|
678
|
+
"aws:SourceAccount": {
|
|
679
|
+
"Ref": "AWS::AccountId"
|
|
680
|
+
}
|
|
681
|
+
},
|
|
682
|
+
"ArnLike": {
|
|
683
|
+
"aws:SourceArn": {
|
|
684
|
+
"Fn::Sub": "arn:${AWS::Partition}:codebuild:${AWS::Region}:${AWS::AccountId}:project/pipeline-builder-runner-deploy-${RunnerId}"
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
]
|
|
690
|
+
},
|
|
691
|
+
"PermissionsBoundary": {
|
|
692
|
+
"Fn::If": [
|
|
693
|
+
"HasPermissionsBoundary",
|
|
694
|
+
{
|
|
695
|
+
"Ref": "PermissionsBoundaryArn"
|
|
696
|
+
},
|
|
697
|
+
{
|
|
698
|
+
"Ref": "AWS::NoValue"
|
|
699
|
+
}
|
|
700
|
+
]
|
|
701
|
+
},
|
|
702
|
+
"Policies": [
|
|
703
|
+
{
|
|
704
|
+
"PolicyName": "pipeline-runner-deploy",
|
|
705
|
+
"PolicyDocument": {
|
|
706
|
+
"Version": "2012-10-17",
|
|
707
|
+
"Statement": [
|
|
708
|
+
{
|
|
709
|
+
"Sid": "AssumeCdkBootstrapRoles",
|
|
710
|
+
"Effect": "Allow",
|
|
711
|
+
"Action": [
|
|
712
|
+
"sts:AssumeRole"
|
|
713
|
+
],
|
|
714
|
+
"Resource": [
|
|
715
|
+
{
|
|
716
|
+
"Fn::Sub": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-${CdkQualifier}-deploy-role-${AWS::AccountId}-${AWS::Region}"
|
|
717
|
+
},
|
|
718
|
+
{
|
|
719
|
+
"Fn::Sub": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-${CdkQualifier}-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
|
|
720
|
+
},
|
|
721
|
+
{
|
|
722
|
+
"Fn::Sub": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-${CdkQualifier}-image-publishing-role-${AWS::AccountId}-${AWS::Region}"
|
|
723
|
+
},
|
|
724
|
+
{
|
|
725
|
+
"Fn::Sub": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-${CdkQualifier}-lookup-role-${AWS::AccountId}-${AWS::Region}"
|
|
726
|
+
}
|
|
727
|
+
]
|
|
728
|
+
},
|
|
729
|
+
{
|
|
730
|
+
"Sid": "ReadCdkBootstrapVersion",
|
|
731
|
+
"Effect": "Allow",
|
|
732
|
+
"Action": [
|
|
733
|
+
"ssm:GetParameter"
|
|
734
|
+
],
|
|
735
|
+
"Resource": [
|
|
736
|
+
{
|
|
737
|
+
"Fn::Sub": "arn:${AWS::Partition}:ssm:${AWS::Region}:${AWS::AccountId}:parameter/cdk-bootstrap/${CdkQualifier}/version"
|
|
738
|
+
}
|
|
739
|
+
]
|
|
740
|
+
},
|
|
741
|
+
{
|
|
742
|
+
"Sid": "DescribeAccountSecrets",
|
|
743
|
+
"Effect": "Allow",
|
|
744
|
+
"Action": [
|
|
745
|
+
"secretsmanager:DescribeSecret"
|
|
746
|
+
],
|
|
747
|
+
"Resource": [
|
|
748
|
+
{
|
|
749
|
+
"Fn::Sub": "arn:${AWS::Partition}:secretsmanager:${AWS::Region}:${AWS::AccountId}:secret:pipeline-builder/*"
|
|
750
|
+
}
|
|
751
|
+
]
|
|
752
|
+
},
|
|
753
|
+
{
|
|
754
|
+
"Sid": "ReadRegistryPullCredential",
|
|
755
|
+
"Effect": "Allow",
|
|
756
|
+
"Action": [
|
|
757
|
+
"secretsmanager:GetSecretValue"
|
|
758
|
+
],
|
|
759
|
+
"Resource": [
|
|
760
|
+
{
|
|
761
|
+
"Fn::Sub": "arn:${AWS::Partition}:secretsmanager:${AWS::Region}:${AWS::AccountId}:secret:${RegistryCredentialSecretName}-??????"
|
|
762
|
+
}
|
|
763
|
+
]
|
|
764
|
+
},
|
|
765
|
+
{
|
|
766
|
+
"Sid": "WriteDeployLogs",
|
|
767
|
+
"Effect": "Allow",
|
|
768
|
+
"Action": [
|
|
769
|
+
"logs:CreateLogStream",
|
|
770
|
+
"logs:PutLogEvents"
|
|
771
|
+
],
|
|
772
|
+
"Resource": [
|
|
773
|
+
{
|
|
774
|
+
"Fn::Sub": "arn:${AWS::Partition}:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/codebuild/pipeline-builder-runner-deploy-${RunnerId}:*"
|
|
775
|
+
}
|
|
776
|
+
]
|
|
777
|
+
}
|
|
778
|
+
]
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
]
|
|
782
|
+
}
|
|
783
|
+
},
|
|
784
|
+
"DeployGrantKey": {
|
|
785
|
+
"Type": "AWS::KMS::Key",
|
|
786
|
+
"Condition": "UseDeploy",
|
|
787
|
+
"Properties": {
|
|
788
|
+
"Description": {
|
|
789
|
+
"Fn::Sub": "Pipeline Builder runner ${RunnerId}: wraps each deploy job's single-use platform grant under {runnerId, purpose, requestId} (the runner role encrypts, the deploy role decrypts; a ciphertext decrypts for its own request only)."
|
|
790
|
+
},
|
|
791
|
+
"EnableKeyRotation": true,
|
|
792
|
+
"PendingWindowInDays": 7,
|
|
793
|
+
"KeyPolicy": {
|
|
794
|
+
"Version": "2012-10-17",
|
|
795
|
+
"Statement": [
|
|
796
|
+
{
|
|
797
|
+
"Sid": "KeyAdministration",
|
|
798
|
+
"Effect": "Allow",
|
|
799
|
+
"Principal": {
|
|
800
|
+
"AWS": {
|
|
801
|
+
"Fn::Sub": "arn:${AWS::Partition}:iam::${AWS::AccountId}:root"
|
|
802
|
+
}
|
|
803
|
+
},
|
|
804
|
+
"Action": [
|
|
805
|
+
"kms:DescribeKey",
|
|
806
|
+
"kms:GetKeyPolicy",
|
|
807
|
+
"kms:GetKeyRotationStatus",
|
|
808
|
+
"kms:ListResourceTags",
|
|
809
|
+
"kms:PutKeyPolicy",
|
|
810
|
+
"kms:EnableKeyRotation",
|
|
811
|
+
"kms:DisableKeyRotation",
|
|
812
|
+
"kms:EnableKey",
|
|
813
|
+
"kms:DisableKey",
|
|
814
|
+
"kms:TagResource",
|
|
815
|
+
"kms:UntagResource",
|
|
816
|
+
"kms:UpdateKeyDescription",
|
|
817
|
+
"kms:ScheduleKeyDeletion",
|
|
818
|
+
"kms:CancelKeyDeletion"
|
|
819
|
+
],
|
|
820
|
+
"Resource": "*"
|
|
821
|
+
},
|
|
822
|
+
{
|
|
823
|
+
"Sid": "RunnerEncryptsGrants",
|
|
824
|
+
"Effect": "Allow",
|
|
825
|
+
"Principal": {
|
|
826
|
+
"AWS": {
|
|
827
|
+
"Fn::GetAtt": [
|
|
828
|
+
"RunnerRole",
|
|
829
|
+
"Arn"
|
|
830
|
+
]
|
|
831
|
+
}
|
|
832
|
+
},
|
|
833
|
+
"Action": "kms:Encrypt",
|
|
834
|
+
"Resource": "*",
|
|
835
|
+
"Condition": {
|
|
836
|
+
"StringEquals": {
|
|
837
|
+
"kms:EncryptionContext:runnerId": {
|
|
838
|
+
"Ref": "RunnerId"
|
|
839
|
+
},
|
|
840
|
+
"kms:EncryptionContext:purpose": "deploy-grant"
|
|
841
|
+
},
|
|
842
|
+
"Null": {
|
|
843
|
+
"kms:EncryptionContext:requestId": "false"
|
|
844
|
+
},
|
|
845
|
+
"ForAllValues:StringEquals": {
|
|
846
|
+
"kms:EncryptionContextKeys": [
|
|
847
|
+
"runnerId",
|
|
848
|
+
"purpose",
|
|
849
|
+
"requestId"
|
|
850
|
+
]
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
},
|
|
854
|
+
{
|
|
855
|
+
"Sid": "DeployJobDecryptsGrants",
|
|
856
|
+
"Effect": "Allow",
|
|
857
|
+
"Principal": {
|
|
858
|
+
"AWS": {
|
|
859
|
+
"Fn::GetAtt": [
|
|
860
|
+
"DeployRole",
|
|
861
|
+
"Arn"
|
|
862
|
+
]
|
|
863
|
+
}
|
|
864
|
+
},
|
|
865
|
+
"Action": "kms:Decrypt",
|
|
866
|
+
"Resource": "*",
|
|
867
|
+
"Condition": {
|
|
868
|
+
"StringEquals": {
|
|
869
|
+
"kms:EncryptionContext:runnerId": {
|
|
870
|
+
"Ref": "RunnerId"
|
|
871
|
+
},
|
|
872
|
+
"kms:EncryptionContext:purpose": "deploy-grant"
|
|
873
|
+
},
|
|
874
|
+
"Null": {
|
|
875
|
+
"kms:EncryptionContext:requestId": "false"
|
|
876
|
+
},
|
|
877
|
+
"ForAllValues:StringEquals": {
|
|
878
|
+
"kms:EncryptionContextKeys": [
|
|
879
|
+
"runnerId",
|
|
880
|
+
"purpose",
|
|
881
|
+
"requestId"
|
|
882
|
+
]
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
]
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
},
|
|
890
|
+
"DeployProject": {
|
|
891
|
+
"Type": "AWS::CodeBuild::Project",
|
|
892
|
+
"Condition": "UseDeploy",
|
|
893
|
+
"DependsOn": "DeployLogGroup",
|
|
894
|
+
"Properties": {
|
|
895
|
+
"Name": {
|
|
896
|
+
"Fn::Sub": "pipeline-builder-runner-deploy-${RunnerId}"
|
|
897
|
+
},
|
|
898
|
+
"Description": "Pipeline Builder runner deploy job: pipeline-manager pipeline deploy-job on the pipeline's managed cdk-synth image (StartBuild overrides only the image digest and the request's PB_* values).",
|
|
899
|
+
"ServiceRole": {
|
|
900
|
+
"Fn::GetAtt": [
|
|
901
|
+
"DeployRole",
|
|
902
|
+
"Arn"
|
|
903
|
+
]
|
|
904
|
+
},
|
|
905
|
+
"Source": {
|
|
906
|
+
"Type": "NO_SOURCE",
|
|
907
|
+
"BuildSpec": "version: 0.2\nenv:\n shell: bash\n exported-variables:\n - PB_DEPLOY_RESULT\n - PB_DEPLOY_STAGE\nphases:\n build:\n commands:\n - pipeline-manager pipeline deploy-job --result-file /tmp/pb-deploy-result.env\n post_build:\n commands:\n - 'export PB_DEPLOY_RESULT=\"$(grep -E ''^PB_DEPLOY_RESULT=[A-Z_]{1,64}$'' /tmp/pb-deploy-result.env 2>/dev/null | cut -d= -f2)\"'\n - 'export PB_DEPLOY_STAGE=\"$(grep -E ''^PB_DEPLOY_STAGE=[a-z_]{1,32}$'' /tmp/pb-deploy-result.env 2>/dev/null | cut -d= -f2)\"'\n"
|
|
908
|
+
},
|
|
909
|
+
"Artifacts": {
|
|
910
|
+
"Type": "NO_ARTIFACTS"
|
|
911
|
+
},
|
|
912
|
+
"Environment": {
|
|
913
|
+
"Type": "LINUX_CONTAINER",
|
|
914
|
+
"ComputeType": "BUILD_GENERAL1_MEDIUM",
|
|
915
|
+
"Image": {
|
|
916
|
+
"Fn::Sub": "${RegistryPullHost}/system/cdk-synth:set-per-build"
|
|
917
|
+
},
|
|
918
|
+
"ImagePullCredentialsType": "SERVICE_ROLE",
|
|
919
|
+
"RegistryCredential": {
|
|
920
|
+
"Credential": {
|
|
921
|
+
"Ref": "RegistryCredentialSecretName"
|
|
922
|
+
},
|
|
923
|
+
"CredentialProvider": "SECRETS_MANAGER"
|
|
924
|
+
},
|
|
925
|
+
"PrivilegedMode": false,
|
|
926
|
+
"EnvironmentVariables": [
|
|
927
|
+
{
|
|
928
|
+
"Name": "PLATFORM_BASE_URL",
|
|
929
|
+
"Type": "PLAINTEXT",
|
|
930
|
+
"Value": {
|
|
931
|
+
"Ref": "PlatformBaseUrl"
|
|
932
|
+
}
|
|
933
|
+
},
|
|
934
|
+
{
|
|
935
|
+
"Name": "PB_RUNNER_ID",
|
|
936
|
+
"Type": "PLAINTEXT",
|
|
937
|
+
"Value": {
|
|
938
|
+
"Ref": "RunnerId"
|
|
939
|
+
}
|
|
940
|
+
},
|
|
941
|
+
{
|
|
942
|
+
"Name": "PB_CDK_QUALIFIER",
|
|
943
|
+
"Type": "PLAINTEXT",
|
|
944
|
+
"Value": {
|
|
945
|
+
"Ref": "CdkQualifier"
|
|
946
|
+
}
|
|
947
|
+
},
|
|
948
|
+
{
|
|
949
|
+
"Name": "NODE_ENV",
|
|
950
|
+
"Type": "PLAINTEXT",
|
|
951
|
+
"Value": "production"
|
|
952
|
+
}
|
|
953
|
+
]
|
|
954
|
+
},
|
|
955
|
+
"TimeoutInMinutes": {
|
|
956
|
+
"Ref": "DeployTimeoutMinutes"
|
|
957
|
+
},
|
|
958
|
+
"QueuedTimeoutInMinutes": 30,
|
|
959
|
+
"ConcurrentBuildLimit": {
|
|
960
|
+
"Ref": "DeployConcurrency"
|
|
961
|
+
},
|
|
962
|
+
"LogsConfig": {
|
|
963
|
+
"CloudWatchLogs": {
|
|
964
|
+
"Status": "ENABLED",
|
|
965
|
+
"GroupName": {
|
|
966
|
+
"Fn::Sub": "/aws/codebuild/pipeline-builder-runner-deploy-${RunnerId}"
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
},
|
|
972
|
+
"InspectResultsBucket": {
|
|
973
|
+
"Type": "AWS::S3::Bucket",
|
|
974
|
+
"Properties": {
|
|
975
|
+
"BucketEncryption": {
|
|
976
|
+
"ServerSideEncryptionConfiguration": [
|
|
977
|
+
{
|
|
978
|
+
"ServerSideEncryptionByDefault": {
|
|
979
|
+
"SSEAlgorithm": "AES256"
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
|
+
]
|
|
983
|
+
},
|
|
984
|
+
"PublicAccessBlockConfiguration": {
|
|
985
|
+
"BlockPublicAcls": true,
|
|
986
|
+
"BlockPublicPolicy": true,
|
|
987
|
+
"IgnorePublicAcls": true,
|
|
988
|
+
"RestrictPublicBuckets": true
|
|
989
|
+
},
|
|
990
|
+
"OwnershipControls": {
|
|
991
|
+
"Rules": [
|
|
992
|
+
{
|
|
993
|
+
"ObjectOwnership": "BucketOwnerEnforced"
|
|
994
|
+
}
|
|
995
|
+
]
|
|
996
|
+
},
|
|
997
|
+
"LifecycleConfiguration": {
|
|
998
|
+
"Rules": [
|
|
999
|
+
{
|
|
1000
|
+
"Id": "ExpireInspectSnapshots",
|
|
1001
|
+
"Status": "Enabled",
|
|
1002
|
+
"ExpirationInDays": 1,
|
|
1003
|
+
"AbortIncompleteMultipartUpload": {
|
|
1004
|
+
"DaysAfterInitiation": 1
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
]
|
|
1008
|
+
}
|
|
1009
|
+
},
|
|
1010
|
+
"Condition": "RunnerOn"
|
|
1011
|
+
},
|
|
1012
|
+
"InspectResultsBucketPolicy": {
|
|
1013
|
+
"Type": "AWS::S3::BucketPolicy",
|
|
1014
|
+
"Properties": {
|
|
1015
|
+
"Bucket": {
|
|
1016
|
+
"Ref": "InspectResultsBucket"
|
|
1017
|
+
},
|
|
1018
|
+
"PolicyDocument": {
|
|
1019
|
+
"Version": "2012-10-17",
|
|
1020
|
+
"Statement": [
|
|
1021
|
+
{
|
|
1022
|
+
"Sid": "DenyInsecureTransport",
|
|
1023
|
+
"Effect": "Deny",
|
|
1024
|
+
"Principal": "*",
|
|
1025
|
+
"Action": "s3:*",
|
|
1026
|
+
"Resource": [
|
|
1027
|
+
{
|
|
1028
|
+
"Fn::GetAtt": [
|
|
1029
|
+
"InspectResultsBucket",
|
|
1030
|
+
"Arn"
|
|
1031
|
+
]
|
|
1032
|
+
},
|
|
1033
|
+
{
|
|
1034
|
+
"Fn::Sub": "${InspectResultsBucket.Arn}/*"
|
|
1035
|
+
}
|
|
1036
|
+
],
|
|
1037
|
+
"Condition": {
|
|
1038
|
+
"Bool": {
|
|
1039
|
+
"aws:SecureTransport": "false"
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
},
|
|
1043
|
+
{
|
|
1044
|
+
"Sid": "OnlyTheInspectBuildWrites",
|
|
1045
|
+
"Effect": "Deny",
|
|
1046
|
+
"Principal": "*",
|
|
1047
|
+
"Action": "s3:PutObject",
|
|
1048
|
+
"Resource": {
|
|
1049
|
+
"Fn::Sub": "${InspectResultsBucket.Arn}/*"
|
|
1050
|
+
},
|
|
1051
|
+
"Condition": {
|
|
1052
|
+
"ArnNotEquals": {
|
|
1053
|
+
"aws:PrincipalArn": {
|
|
1054
|
+
"Fn::GetAtt": [
|
|
1055
|
+
"InspectBuildRole",
|
|
1056
|
+
"Arn"
|
|
1057
|
+
]
|
|
1058
|
+
}
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
},
|
|
1062
|
+
{
|
|
1063
|
+
"Sid": "OnlyTheRunnerReads",
|
|
1064
|
+
"Effect": "Deny",
|
|
1065
|
+
"Principal": "*",
|
|
1066
|
+
"Action": [
|
|
1067
|
+
"s3:GetObject",
|
|
1068
|
+
"s3:DeleteObject"
|
|
1069
|
+
],
|
|
1070
|
+
"Resource": {
|
|
1071
|
+
"Fn::Sub": "${InspectResultsBucket.Arn}/*"
|
|
1072
|
+
},
|
|
1073
|
+
"Condition": {
|
|
1074
|
+
"ArnNotEquals": {
|
|
1075
|
+
"aws:PrincipalArn": {
|
|
1076
|
+
"Fn::GetAtt": [
|
|
1077
|
+
"RunnerRole",
|
|
1078
|
+
"Arn"
|
|
1079
|
+
]
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
]
|
|
1085
|
+
}
|
|
1086
|
+
},
|
|
1087
|
+
"Condition": "RunnerOn"
|
|
1088
|
+
},
|
|
1089
|
+
"InspectLogGroup": {
|
|
1090
|
+
"Type": "AWS::Logs::LogGroup",
|
|
1091
|
+
"Properties": {
|
|
1092
|
+
"LogGroupName": {
|
|
1093
|
+
"Fn::Sub": "/aws/codebuild/pipeline-builder-inspect-${RunnerId}"
|
|
1094
|
+
},
|
|
1095
|
+
"RetentionInDays": 14
|
|
1096
|
+
},
|
|
1097
|
+
"Condition": "RunnerOn"
|
|
1098
|
+
},
|
|
1099
|
+
"InspectBuildRole": {
|
|
1100
|
+
"Type": "AWS::IAM::Role",
|
|
1101
|
+
"Properties": {
|
|
1102
|
+
"RoleName": {
|
|
1103
|
+
"Fn::Sub": "pipeline-builder-inspect-${RunnerId}"
|
|
1104
|
+
},
|
|
1105
|
+
"Description": "Pipeline Builder runner inspect build: clones one repository through a CodeConnections connection and writes a bounded snapshot to the results bucket.",
|
|
1106
|
+
"AssumeRolePolicyDocument": {
|
|
1107
|
+
"Version": "2012-10-17",
|
|
1108
|
+
"Statement": [
|
|
1109
|
+
{
|
|
1110
|
+
"Effect": "Allow",
|
|
1111
|
+
"Principal": {
|
|
1112
|
+
"Service": "codebuild.amazonaws.com"
|
|
1113
|
+
},
|
|
1114
|
+
"Action": "sts:AssumeRole",
|
|
1115
|
+
"Condition": {
|
|
1116
|
+
"StringEquals": {
|
|
1117
|
+
"aws:SourceAccount": {
|
|
1118
|
+
"Ref": "AWS::AccountId"
|
|
1119
|
+
}
|
|
1120
|
+
},
|
|
1121
|
+
"ArnLike": {
|
|
1122
|
+
"aws:SourceArn": {
|
|
1123
|
+
"Fn::Sub": "arn:${AWS::Partition}:codebuild:${AWS::Region}:${AWS::AccountId}:project/pipeline-builder-inspect-${RunnerId}"
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
]
|
|
1129
|
+
},
|
|
1130
|
+
"Policies": [
|
|
1131
|
+
{
|
|
1132
|
+
"PolicyName": "inspect-build",
|
|
1133
|
+
"PolicyDocument": {
|
|
1134
|
+
"Version": "2012-10-17",
|
|
1135
|
+
"Statement": [
|
|
1136
|
+
{
|
|
1137
|
+
"Sid": "UseConnections",
|
|
1138
|
+
"Effect": "Allow",
|
|
1139
|
+
"Action": [
|
|
1140
|
+
"codeconnections:GetConnection",
|
|
1141
|
+
"codeconnections:GetConnectionToken",
|
|
1142
|
+
"codeconnections:UseConnection",
|
|
1143
|
+
"codestar-connections:GetConnection",
|
|
1144
|
+
"codestar-connections:GetConnectionToken",
|
|
1145
|
+
"codestar-connections:UseConnection"
|
|
1146
|
+
],
|
|
1147
|
+
"Resource": [
|
|
1148
|
+
{
|
|
1149
|
+
"Fn::Sub": "arn:${AWS::Partition}:codeconnections:${AWS::Region}:${AWS::AccountId}:connection/*"
|
|
1150
|
+
},
|
|
1151
|
+
{
|
|
1152
|
+
"Fn::Sub": "arn:${AWS::Partition}:codestar-connections:${AWS::Region}:${AWS::AccountId}:connection/*"
|
|
1153
|
+
}
|
|
1154
|
+
]
|
|
1155
|
+
},
|
|
1156
|
+
{
|
|
1157
|
+
"Sid": "WriteResults",
|
|
1158
|
+
"Effect": "Allow",
|
|
1159
|
+
"Action": [
|
|
1160
|
+
"s3:PutObject"
|
|
1161
|
+
],
|
|
1162
|
+
"Resource": {
|
|
1163
|
+
"Fn::Sub": "${InspectResultsBucket.Arn}/*"
|
|
1164
|
+
}
|
|
1165
|
+
},
|
|
1166
|
+
{
|
|
1167
|
+
"Sid": "WriteLogs",
|
|
1168
|
+
"Effect": "Allow",
|
|
1169
|
+
"Action": [
|
|
1170
|
+
"logs:CreateLogStream",
|
|
1171
|
+
"logs:PutLogEvents"
|
|
1172
|
+
],
|
|
1173
|
+
"Resource": [
|
|
1174
|
+
{
|
|
1175
|
+
"Fn::Sub": "arn:${AWS::Partition}:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/codebuild/pipeline-builder-inspect-${RunnerId}:*"
|
|
1176
|
+
}
|
|
1177
|
+
]
|
|
1178
|
+
}
|
|
1179
|
+
]
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1182
|
+
],
|
|
1183
|
+
"PermissionsBoundary": {
|
|
1184
|
+
"Fn::If": [
|
|
1185
|
+
"HasPermissionsBoundary",
|
|
1186
|
+
{
|
|
1187
|
+
"Ref": "PermissionsBoundaryArn"
|
|
1188
|
+
},
|
|
1189
|
+
{
|
|
1190
|
+
"Ref": "AWS::NoValue"
|
|
1191
|
+
}
|
|
1192
|
+
]
|
|
1193
|
+
}
|
|
1194
|
+
},
|
|
1195
|
+
"Condition": "RunnerOn"
|
|
1196
|
+
},
|
|
1197
|
+
"InspectProject": {
|
|
1198
|
+
"Type": "AWS::CodeBuild::Project",
|
|
1199
|
+
"DependsOn": "InspectLogGroup",
|
|
1200
|
+
"Properties": {
|
|
1201
|
+
"Name": {
|
|
1202
|
+
"Fn::Sub": "pipeline-builder-inspect-${RunnerId}"
|
|
1203
|
+
},
|
|
1204
|
+
"Description": "Pipeline Builder runner inspect build (Generate from Git): the runner starts it with the repository as a CodeConnections source override; it writes what an analysis reads to the results bucket.",
|
|
1205
|
+
"ServiceRole": {
|
|
1206
|
+
"Fn::GetAtt": [
|
|
1207
|
+
"InspectBuildRole",
|
|
1208
|
+
"Arn"
|
|
1209
|
+
]
|
|
1210
|
+
},
|
|
1211
|
+
"Source": {
|
|
1212
|
+
"Type": "NO_SOURCE",
|
|
1213
|
+
"BuildSpec": "version: 0.2\nphases:\n build:\n commands:\n - echo 'Deploy this stack with pipeline-manager infra setup-runner, which fills in the inspect buildspec.' && exit 1\n"
|
|
1214
|
+
},
|
|
1215
|
+
"Artifacts": {
|
|
1216
|
+
"Type": "NO_ARTIFACTS"
|
|
1217
|
+
},
|
|
1218
|
+
"Environment": {
|
|
1219
|
+
"Type": "LINUX_CONTAINER",
|
|
1220
|
+
"ComputeType": "BUILD_GENERAL1_SMALL",
|
|
1221
|
+
"Image": "aws/codebuild/amazonlinux-x86_64-standard:5.0",
|
|
1222
|
+
"PrivilegedMode": false,
|
|
1223
|
+
"EnvironmentVariables": [
|
|
1224
|
+
{
|
|
1225
|
+
"Name": "INSPECT_RESULTS_BUCKET",
|
|
1226
|
+
"Type": "PLAINTEXT",
|
|
1227
|
+
"Value": {
|
|
1228
|
+
"Ref": "InspectResultsBucket"
|
|
1229
|
+
}
|
|
1230
|
+
}
|
|
1231
|
+
]
|
|
1232
|
+
},
|
|
1233
|
+
"TimeoutInMinutes": 10,
|
|
1234
|
+
"QueuedTimeoutInMinutes": 5,
|
|
1235
|
+
"ConcurrentBuildLimit": 2,
|
|
1236
|
+
"LogsConfig": {
|
|
1237
|
+
"CloudWatchLogs": {
|
|
1238
|
+
"Status": "ENABLED",
|
|
1239
|
+
"GroupName": {
|
|
1240
|
+
"Fn::Sub": "/aws/codebuild/pipeline-builder-inspect-${RunnerId}"
|
|
1241
|
+
}
|
|
1242
|
+
}
|
|
1243
|
+
}
|
|
1244
|
+
},
|
|
1245
|
+
"Condition": "RunnerOn"
|
|
1246
|
+
},
|
|
1247
|
+
"FunctionUrl": {
|
|
1248
|
+
"Type": "AWS::Lambda::Url",
|
|
1249
|
+
"Condition": "UseFunctionUrl",
|
|
1250
|
+
"Properties": {
|
|
1251
|
+
"AuthType": "NONE",
|
|
1252
|
+
"TargetFunctionArn": {
|
|
1253
|
+
"Fn::GetAtt": [
|
|
1254
|
+
"RunnerFunction",
|
|
1255
|
+
"Arn"
|
|
1256
|
+
]
|
|
1257
|
+
}
|
|
1258
|
+
}
|
|
1259
|
+
},
|
|
1260
|
+
"FunctionUrlPermission": {
|
|
1261
|
+
"Type": "AWS::Lambda::Permission",
|
|
1262
|
+
"Condition": "UseFunctionUrl",
|
|
1263
|
+
"Properties": {
|
|
1264
|
+
"FunctionName": {
|
|
1265
|
+
"Ref": "RunnerFunction"
|
|
1266
|
+
},
|
|
1267
|
+
"Action": "lambda:InvokeFunctionUrl",
|
|
1268
|
+
"Principal": "*",
|
|
1269
|
+
"FunctionUrlAuthType": "NONE"
|
|
1270
|
+
}
|
|
1271
|
+
},
|
|
1272
|
+
"FunctionUrlInvokePermission": {
|
|
1273
|
+
"Type": "AWS::Lambda::Permission",
|
|
1274
|
+
"Condition": "UseFunctionUrl",
|
|
1275
|
+
"Properties": {
|
|
1276
|
+
"FunctionName": {
|
|
1277
|
+
"Ref": "RunnerFunction"
|
|
1278
|
+
},
|
|
1279
|
+
"Action": "lambda:InvokeFunction",
|
|
1280
|
+
"Principal": "*",
|
|
1281
|
+
"InvokedViaFunctionUrl": true
|
|
1282
|
+
}
|
|
1283
|
+
},
|
|
1284
|
+
"RunnerApi": {
|
|
1285
|
+
"Type": "AWS::ApiGateway::RestApi",
|
|
1286
|
+
"Condition": "UseApiGateway",
|
|
1287
|
+
"Properties": {
|
|
1288
|
+
"Name": {
|
|
1289
|
+
"Fn::Sub": "pipeline-builder-runner${NameSuffix}"
|
|
1290
|
+
},
|
|
1291
|
+
"Description": "Pipeline Builder runner entry point, admitting only the platform's egress IPs",
|
|
1292
|
+
"EndpointConfiguration": {
|
|
1293
|
+
"Types": [
|
|
1294
|
+
"REGIONAL"
|
|
1295
|
+
]
|
|
1296
|
+
},
|
|
1297
|
+
"Policy": {
|
|
1298
|
+
"Version": "2012-10-17",
|
|
1299
|
+
"Statement": [
|
|
1300
|
+
{
|
|
1301
|
+
"Effect": "Allow",
|
|
1302
|
+
"Principal": "*",
|
|
1303
|
+
"Action": "execute-api:Invoke",
|
|
1304
|
+
"Resource": "execute-api:/*",
|
|
1305
|
+
"Condition": {
|
|
1306
|
+
"IpAddress": {
|
|
1307
|
+
"aws:SourceIp": {
|
|
1308
|
+
"Ref": "AllowedIps"
|
|
1309
|
+
}
|
|
1310
|
+
}
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
]
|
|
1314
|
+
}
|
|
1315
|
+
}
|
|
1316
|
+
},
|
|
1317
|
+
"RunnerApiMethod": {
|
|
1318
|
+
"Type": "AWS::ApiGateway::Method",
|
|
1319
|
+
"Condition": "UseApiGateway",
|
|
1320
|
+
"Properties": {
|
|
1321
|
+
"RestApiId": {
|
|
1322
|
+
"Ref": "RunnerApi"
|
|
1323
|
+
},
|
|
1324
|
+
"ResourceId": {
|
|
1325
|
+
"Fn::GetAtt": [
|
|
1326
|
+
"RunnerApi",
|
|
1327
|
+
"RootResourceId"
|
|
1328
|
+
]
|
|
1329
|
+
},
|
|
1330
|
+
"HttpMethod": "POST",
|
|
1331
|
+
"AuthorizationType": "NONE",
|
|
1332
|
+
"Integration": {
|
|
1333
|
+
"Type": "AWS_PROXY",
|
|
1334
|
+
"IntegrationHttpMethod": "POST",
|
|
1335
|
+
"Uri": {
|
|
1336
|
+
"Fn::Sub": "arn:${AWS::Partition}:apigateway:${AWS::Region}:lambda:path/2015-03-31/functions/${RunnerFunction.Arn}/invocations"
|
|
1337
|
+
}
|
|
1338
|
+
}
|
|
1339
|
+
}
|
|
1340
|
+
},
|
|
1341
|
+
"RunnerApiDeployment": {
|
|
1342
|
+
"Type": "AWS::ApiGateway::Deployment",
|
|
1343
|
+
"Condition": "UseApiGateway",
|
|
1344
|
+
"DependsOn": "RunnerApiMethod",
|
|
1345
|
+
"Properties": {
|
|
1346
|
+
"RestApiId": {
|
|
1347
|
+
"Ref": "RunnerApi"
|
|
1348
|
+
}
|
|
1349
|
+
}
|
|
1350
|
+
},
|
|
1351
|
+
"RunnerApiStage": {
|
|
1352
|
+
"Type": "AWS::ApiGateway::Stage",
|
|
1353
|
+
"Condition": "UseApiGateway",
|
|
1354
|
+
"Properties": {
|
|
1355
|
+
"RestApiId": {
|
|
1356
|
+
"Ref": "RunnerApi"
|
|
1357
|
+
},
|
|
1358
|
+
"DeploymentId": {
|
|
1359
|
+
"Ref": "RunnerApiDeployment"
|
|
1360
|
+
},
|
|
1361
|
+
"StageName": "runner",
|
|
1362
|
+
"MethodSettings": [
|
|
1363
|
+
{
|
|
1364
|
+
"ResourcePath": "/*",
|
|
1365
|
+
"HttpMethod": "*",
|
|
1366
|
+
"ThrottlingRateLimit": 5,
|
|
1367
|
+
"ThrottlingBurstLimit": 10
|
|
1368
|
+
}
|
|
1369
|
+
]
|
|
1370
|
+
}
|
|
1371
|
+
},
|
|
1372
|
+
"RunnerApiPermission": {
|
|
1373
|
+
"Type": "AWS::Lambda::Permission",
|
|
1374
|
+
"Condition": "UseApiGateway",
|
|
1375
|
+
"Properties": {
|
|
1376
|
+
"FunctionName": {
|
|
1377
|
+
"Ref": "RunnerFunction"
|
|
1378
|
+
},
|
|
1379
|
+
"Action": "lambda:InvokeFunction",
|
|
1380
|
+
"Principal": "apigateway.amazonaws.com",
|
|
1381
|
+
"SourceArn": {
|
|
1382
|
+
"Fn::Sub": "arn:${AWS::Partition}:execute-api:${AWS::Region}:${AWS::AccountId}:${RunnerApi}/*/POST/"
|
|
1383
|
+
}
|
|
1384
|
+
}
|
|
1385
|
+
},
|
|
1386
|
+
"RunnerWebAcl": {
|
|
1387
|
+
"Type": "AWS::WAFv2::WebACL",
|
|
1388
|
+
"Condition": "UseWaf",
|
|
1389
|
+
"Properties": {
|
|
1390
|
+
"Name": {
|
|
1391
|
+
"Fn::Sub": "pipeline-builder-runner${NameSuffix}"
|
|
1392
|
+
},
|
|
1393
|
+
"Description": "Pipeline Builder runner API: per-source-IP rate limit (in front of the resource-policy IP allowlist and the stage throttle)",
|
|
1394
|
+
"Scope": "REGIONAL",
|
|
1395
|
+
"DefaultAction": {
|
|
1396
|
+
"Allow": {}
|
|
1397
|
+
},
|
|
1398
|
+
"Rules": [
|
|
1399
|
+
{
|
|
1400
|
+
"Name": "per-ip-rate-limit",
|
|
1401
|
+
"Priority": 0,
|
|
1402
|
+
"Action": {
|
|
1403
|
+
"Block": {}
|
|
1404
|
+
},
|
|
1405
|
+
"Statement": {
|
|
1406
|
+
"RateBasedStatement": {
|
|
1407
|
+
"Limit": {
|
|
1408
|
+
"Ref": "WafRateLimit"
|
|
1409
|
+
},
|
|
1410
|
+
"AggregateKeyType": "IP",
|
|
1411
|
+
"EvaluationWindowSec": 300
|
|
1412
|
+
}
|
|
1413
|
+
},
|
|
1414
|
+
"VisibilityConfig": {
|
|
1415
|
+
"SampledRequestsEnabled": true,
|
|
1416
|
+
"CloudWatchMetricsEnabled": true,
|
|
1417
|
+
"MetricName": {
|
|
1418
|
+
"Fn::Sub": "pipeline-builder-runner${NameSuffix}-rate-limit"
|
|
1419
|
+
}
|
|
1420
|
+
}
|
|
1421
|
+
}
|
|
1422
|
+
],
|
|
1423
|
+
"VisibilityConfig": {
|
|
1424
|
+
"SampledRequestsEnabled": true,
|
|
1425
|
+
"CloudWatchMetricsEnabled": true,
|
|
1426
|
+
"MetricName": {
|
|
1427
|
+
"Fn::Sub": "pipeline-builder-runner${NameSuffix}"
|
|
1428
|
+
}
|
|
1429
|
+
}
|
|
1430
|
+
}
|
|
1431
|
+
},
|
|
1432
|
+
"RunnerWebAclAssociation": {
|
|
1433
|
+
"Type": "AWS::WAFv2::WebACLAssociation",
|
|
1434
|
+
"Condition": "UseWaf",
|
|
1435
|
+
"Properties": {
|
|
1436
|
+
"ResourceArn": {
|
|
1437
|
+
"Fn::Sub": "arn:${AWS::Partition}:apigateway:${AWS::Region}::/restapis/${RunnerApi}/stages/${RunnerApiStage}"
|
|
1438
|
+
},
|
|
1439
|
+
"WebACLArn": {
|
|
1440
|
+
"Fn::GetAtt": [
|
|
1441
|
+
"RunnerWebAcl",
|
|
1442
|
+
"Arn"
|
|
1443
|
+
]
|
|
1444
|
+
}
|
|
1445
|
+
}
|
|
1446
|
+
},
|
|
1447
|
+
"EventQueue": {
|
|
1448
|
+
"Type": "AWS::SQS::Queue",
|
|
1449
|
+
"Condition": "ReportingOn",
|
|
1450
|
+
"Properties": {
|
|
1451
|
+
"QueueName": {
|
|
1452
|
+
"Fn::Sub": "pipeline-builder-events${NameSuffix}"
|
|
1453
|
+
},
|
|
1454
|
+
"VisibilityTimeout": 300,
|
|
1455
|
+
"MessageRetentionPeriod": 1209600,
|
|
1456
|
+
"SqsManagedSseEnabled": true,
|
|
1457
|
+
"RedrivePolicy": {
|
|
1458
|
+
"deadLetterTargetArn": {
|
|
1459
|
+
"Fn::GetAtt": [
|
|
1460
|
+
"EventDeadLetterQueue",
|
|
1461
|
+
"Arn"
|
|
1462
|
+
]
|
|
1463
|
+
},
|
|
1464
|
+
"maxReceiveCount": 3
|
|
1465
|
+
}
|
|
1466
|
+
}
|
|
1467
|
+
},
|
|
1468
|
+
"EventDeadLetterQueue": {
|
|
1469
|
+
"Type": "AWS::SQS::Queue",
|
|
1470
|
+
"Condition": "ReportingOn",
|
|
1471
|
+
"Properties": {
|
|
1472
|
+
"QueueName": {
|
|
1473
|
+
"Fn::Sub": "pipeline-builder-events${NameSuffix}-dlq"
|
|
1474
|
+
},
|
|
1475
|
+
"MessageRetentionPeriod": 1209600,
|
|
1476
|
+
"SqsManagedSseEnabled": true
|
|
1477
|
+
}
|
|
1478
|
+
},
|
|
1479
|
+
"EventQueuePolicy": {
|
|
1480
|
+
"Type": "AWS::SQS::QueuePolicy",
|
|
1481
|
+
"Condition": "ReportingOn",
|
|
1482
|
+
"Properties": {
|
|
1483
|
+
"Queues": [
|
|
1484
|
+
{
|
|
1485
|
+
"Ref": "EventQueue"
|
|
1486
|
+
}
|
|
1487
|
+
],
|
|
1488
|
+
"PolicyDocument": {
|
|
1489
|
+
"Version": "2012-10-17",
|
|
1490
|
+
"Statement": [
|
|
1491
|
+
{
|
|
1492
|
+
"Sid": "FromTheRule",
|
|
1493
|
+
"Effect": "Allow",
|
|
1494
|
+
"Principal": {
|
|
1495
|
+
"Service": "events.amazonaws.com"
|
|
1496
|
+
},
|
|
1497
|
+
"Action": "sqs:SendMessage",
|
|
1498
|
+
"Resource": {
|
|
1499
|
+
"Fn::GetAtt": [
|
|
1500
|
+
"EventQueue",
|
|
1501
|
+
"Arn"
|
|
1502
|
+
]
|
|
1503
|
+
},
|
|
1504
|
+
"Condition": {
|
|
1505
|
+
"ArnEquals": {
|
|
1506
|
+
"aws:SourceArn": {
|
|
1507
|
+
"Fn::GetAtt": [
|
|
1508
|
+
"EventRule",
|
|
1509
|
+
"Arn"
|
|
1510
|
+
]
|
|
1511
|
+
}
|
|
1512
|
+
}
|
|
1513
|
+
}
|
|
1514
|
+
},
|
|
1515
|
+
{
|
|
1516
|
+
"Sid": "TlsOnly",
|
|
1517
|
+
"Effect": "Deny",
|
|
1518
|
+
"Principal": "*",
|
|
1519
|
+
"Action": "sqs:*",
|
|
1520
|
+
"Resource": {
|
|
1521
|
+
"Fn::GetAtt": [
|
|
1522
|
+
"EventQueue",
|
|
1523
|
+
"Arn"
|
|
1524
|
+
]
|
|
1525
|
+
},
|
|
1526
|
+
"Condition": {
|
|
1527
|
+
"Bool": {
|
|
1528
|
+
"aws:SecureTransport": "false"
|
|
1529
|
+
}
|
|
1530
|
+
}
|
|
1531
|
+
}
|
|
1532
|
+
]
|
|
1533
|
+
}
|
|
1534
|
+
}
|
|
1535
|
+
},
|
|
1536
|
+
"EventRule": {
|
|
1537
|
+
"Type": "AWS::Events::Rule",
|
|
1538
|
+
"Condition": "ReportingOn",
|
|
1539
|
+
"Properties": {
|
|
1540
|
+
"Name": {
|
|
1541
|
+
"Fn::Sub": "pipeline-builder-events${NameSuffix}"
|
|
1542
|
+
},
|
|
1543
|
+
"Description": "CodePipeline state changes of the allowlisted pipelines (this region's, and the regional forwarders')",
|
|
1544
|
+
"State": "ENABLED",
|
|
1545
|
+
"EventPattern": {
|
|
1546
|
+
"source": [
|
|
1547
|
+
"aws.codepipeline"
|
|
1548
|
+
],
|
|
1549
|
+
"detail-type": [
|
|
1550
|
+
"CodePipeline Pipeline Execution State Change",
|
|
1551
|
+
"CodePipeline Stage Execution State Change",
|
|
1552
|
+
"CodePipeline Action Execution State Change"
|
|
1553
|
+
]
|
|
1554
|
+
},
|
|
1555
|
+
"Targets": [
|
|
1556
|
+
{
|
|
1557
|
+
"Id": "pipeline-events-queue",
|
|
1558
|
+
"Arn": {
|
|
1559
|
+
"Fn::GetAtt": [
|
|
1560
|
+
"EventQueue",
|
|
1561
|
+
"Arn"
|
|
1562
|
+
]
|
|
1563
|
+
}
|
|
1564
|
+
}
|
|
1565
|
+
]
|
|
1566
|
+
}
|
|
1567
|
+
},
|
|
1568
|
+
"LastEventParameter": {
|
|
1569
|
+
"Type": "AWS::SSM::Parameter",
|
|
1570
|
+
"Condition": "ReportingOn",
|
|
1571
|
+
"Properties": {
|
|
1572
|
+
"Name": {
|
|
1573
|
+
"Fn::Sub": "/pipeline-builder/events${NameSuffix}/last-event"
|
|
1574
|
+
},
|
|
1575
|
+
"Type": "String",
|
|
1576
|
+
"Value": "never",
|
|
1577
|
+
"Description": "When the events Lambda last delivered an event to the platform (ISO time); the runner health ping reports it."
|
|
1578
|
+
}
|
|
1579
|
+
},
|
|
1580
|
+
"EventsRole": {
|
|
1581
|
+
"Type": "AWS::IAM::Role",
|
|
1582
|
+
"Properties": {
|
|
1583
|
+
"RoleName": {
|
|
1584
|
+
"Fn::Sub": "pipeline-builder-events${NameSuffix}"
|
|
1585
|
+
},
|
|
1586
|
+
"AssumeRolePolicyDocument": {
|
|
1587
|
+
"Version": "2012-10-17",
|
|
1588
|
+
"Statement": [
|
|
1589
|
+
{
|
|
1590
|
+
"Effect": "Allow",
|
|
1591
|
+
"Principal": {
|
|
1592
|
+
"Service": "lambda.amazonaws.com"
|
|
1593
|
+
},
|
|
1594
|
+
"Action": "sts:AssumeRole"
|
|
1595
|
+
}
|
|
1596
|
+
]
|
|
1597
|
+
},
|
|
1598
|
+
"ManagedPolicyArns": [
|
|
1599
|
+
{
|
|
1600
|
+
"Fn::Sub": "arn:${AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
|
|
1601
|
+
}
|
|
1602
|
+
],
|
|
1603
|
+
"Policies": [
|
|
1604
|
+
{
|
|
1605
|
+
"PolicyName": "events",
|
|
1606
|
+
"PolicyDocument": {
|
|
1607
|
+
"Statement": [
|
|
1608
|
+
{
|
|
1609
|
+
"Effect": "Allow",
|
|
1610
|
+
"Action": [
|
|
1611
|
+
"sqs:ReceiveMessage",
|
|
1612
|
+
"sqs:DeleteMessage",
|
|
1613
|
+
"sqs:GetQueueAttributes"
|
|
1614
|
+
],
|
|
1615
|
+
"Resource": {
|
|
1616
|
+
"Fn::GetAtt": [
|
|
1617
|
+
"EventQueue",
|
|
1618
|
+
"Arn"
|
|
1619
|
+
]
|
|
1620
|
+
}
|
|
1621
|
+
},
|
|
1622
|
+
{
|
|
1623
|
+
"Effect": "Allow",
|
|
1624
|
+
"Action": [
|
|
1625
|
+
"sqs:StartMessageMoveTask",
|
|
1626
|
+
"sqs:ListMessageMoveTasks",
|
|
1627
|
+
"sqs:GetQueueAttributes"
|
|
1628
|
+
],
|
|
1629
|
+
"Resource": [
|
|
1630
|
+
{
|
|
1631
|
+
"Fn::GetAtt": [
|
|
1632
|
+
"EventQueue",
|
|
1633
|
+
"Arn"
|
|
1634
|
+
]
|
|
1635
|
+
},
|
|
1636
|
+
{
|
|
1637
|
+
"Fn::GetAtt": [
|
|
1638
|
+
"EventDeadLetterQueue",
|
|
1639
|
+
"Arn"
|
|
1640
|
+
]
|
|
1641
|
+
}
|
|
1642
|
+
]
|
|
1643
|
+
},
|
|
1644
|
+
{
|
|
1645
|
+
"Effect": "Allow",
|
|
1646
|
+
"Action": "cloudwatch:GetMetricStatistics",
|
|
1647
|
+
"Resource": "*"
|
|
1648
|
+
},
|
|
1649
|
+
{
|
|
1650
|
+
"Effect": "Allow",
|
|
1651
|
+
"Action": "secretsmanager:GetSecretValue",
|
|
1652
|
+
"Resource": [
|
|
1653
|
+
{
|
|
1654
|
+
"Fn::Sub": "arn:${AWS::Partition}:secretsmanager:${AWS::Region}:${AWS::AccountId}:secret:pipeline-builder/${OrgId}/reporting-ingest-*"
|
|
1655
|
+
},
|
|
1656
|
+
{
|
|
1657
|
+
"Fn::If": [
|
|
1658
|
+
"DoraOn",
|
|
1659
|
+
{
|
|
1660
|
+
"Fn::Sub": "arn:${AWS::Partition}:secretsmanager:${AWS::Region}:${AWS::AccountId}:secret:pipeline-builder/${OrgId}/github-token-*"
|
|
1661
|
+
},
|
|
1662
|
+
{
|
|
1663
|
+
"Ref": "AWS::NoValue"
|
|
1664
|
+
}
|
|
1665
|
+
]
|
|
1666
|
+
},
|
|
1667
|
+
{
|
|
1668
|
+
"Fn::If": [
|
|
1669
|
+
"DoraOn",
|
|
1670
|
+
{
|
|
1671
|
+
"Fn::Sub": "arn:${AWS::Partition}:secretsmanager:${AWS::Region}:${AWS::AccountId}:secret:pipeline-builder/${OrgId}/github-token/*"
|
|
1672
|
+
},
|
|
1673
|
+
{
|
|
1674
|
+
"Ref": "AWS::NoValue"
|
|
1675
|
+
}
|
|
1676
|
+
]
|
|
1677
|
+
}
|
|
1678
|
+
]
|
|
1679
|
+
},
|
|
1680
|
+
{
|
|
1681
|
+
"Effect": "Allow",
|
|
1682
|
+
"Action": "codepipeline:ListTagsForResource",
|
|
1683
|
+
"Resource": {
|
|
1684
|
+
"Fn::Sub": "arn:${AWS::Partition}:codepipeline:${AWS::Region}:${AWS::AccountId}:*"
|
|
1685
|
+
}
|
|
1686
|
+
},
|
|
1687
|
+
{
|
|
1688
|
+
"Effect": "Allow",
|
|
1689
|
+
"Action": "codebuild:BatchGetBuilds",
|
|
1690
|
+
"Resource": {
|
|
1691
|
+
"Fn::Sub": "arn:${AWS::Partition}:codebuild:${AWS::Region}:${AWS::AccountId}:project/*"
|
|
1692
|
+
}
|
|
1693
|
+
},
|
|
1694
|
+
{
|
|
1695
|
+
"Effect": "Allow",
|
|
1696
|
+
"Action": "logs:FilterLogEvents",
|
|
1697
|
+
"Resource": {
|
|
1698
|
+
"Fn::Sub": "arn:${AWS::Partition}:logs:${AWS::Region}:${AWS::AccountId}:log-group:/aws/codebuild/*:*"
|
|
1699
|
+
}
|
|
1700
|
+
},
|
|
1701
|
+
{
|
|
1702
|
+
"Fn::If": [
|
|
1703
|
+
"DoraOn",
|
|
1704
|
+
{
|
|
1705
|
+
"Effect": "Allow",
|
|
1706
|
+
"Action": "codecommit:GetCommit",
|
|
1707
|
+
"Resource": {
|
|
1708
|
+
"Fn::Sub": "arn:${AWS::Partition}:codecommit:${AWS::Region}:${AWS::AccountId}:*"
|
|
1709
|
+
}
|
|
1710
|
+
},
|
|
1711
|
+
{
|
|
1712
|
+
"Ref": "AWS::NoValue"
|
|
1713
|
+
}
|
|
1714
|
+
]
|
|
1715
|
+
},
|
|
1716
|
+
{
|
|
1717
|
+
"Sid": "StampLastEvent",
|
|
1718
|
+
"Effect": "Allow",
|
|
1719
|
+
"Action": "ssm:PutParameter",
|
|
1720
|
+
"Resource": {
|
|
1721
|
+
"Fn::Sub": "arn:${AWS::Partition}:ssm:${AWS::Region}:${AWS::AccountId}:parameter/pipeline-builder/events${NameSuffix}/last-event"
|
|
1722
|
+
}
|
|
1723
|
+
}
|
|
1724
|
+
]
|
|
1725
|
+
}
|
|
1726
|
+
}
|
|
1727
|
+
],
|
|
1728
|
+
"PermissionsBoundary": {
|
|
1729
|
+
"Fn::If": [
|
|
1730
|
+
"HasPermissionsBoundary",
|
|
1731
|
+
{
|
|
1732
|
+
"Ref": "PermissionsBoundaryArn"
|
|
1733
|
+
},
|
|
1734
|
+
{
|
|
1735
|
+
"Ref": "AWS::NoValue"
|
|
1736
|
+
}
|
|
1737
|
+
]
|
|
1738
|
+
}
|
|
1739
|
+
},
|
|
1740
|
+
"Condition": "ReportingOn"
|
|
1741
|
+
},
|
|
1742
|
+
"EventsFunction": {
|
|
1743
|
+
"Type": "AWS::Lambda::Function",
|
|
1744
|
+
"Properties": {
|
|
1745
|
+
"FunctionName": {
|
|
1746
|
+
"Fn::Sub": "pipeline-builder-events${NameSuffix}"
|
|
1747
|
+
},
|
|
1748
|
+
"Runtime": "nodejs26.x",
|
|
1749
|
+
"Handler": "index.handler",
|
|
1750
|
+
"Code": {
|
|
1751
|
+
"ZipFile": "exports.handler=async()=>{throw new Error('Placeholder — pipeline-manager infra setup-account uploads the events handler')}"
|
|
1752
|
+
},
|
|
1753
|
+
"Role": {
|
|
1754
|
+
"Fn::GetAtt": [
|
|
1755
|
+
"EventsRole",
|
|
1756
|
+
"Arn"
|
|
1757
|
+
]
|
|
1758
|
+
},
|
|
1759
|
+
"Timeout": 60,
|
|
1760
|
+
"MemorySize": 256,
|
|
1761
|
+
"Environment": {
|
|
1762
|
+
"Variables": {
|
|
1763
|
+
"PLATFORM_BASE_URL": {
|
|
1764
|
+
"Ref": "PlatformBaseUrl"
|
|
1765
|
+
},
|
|
1766
|
+
"PLATFORM_SECRET_NAME": {
|
|
1767
|
+
"Ref": "ReportingSecretName"
|
|
1768
|
+
},
|
|
1769
|
+
"DORA_ENABLED": {
|
|
1770
|
+
"Ref": "DoraEnabled"
|
|
1771
|
+
},
|
|
1772
|
+
"EVENT_DLQ_ARN": {
|
|
1773
|
+
"Fn::GetAtt": [
|
|
1774
|
+
"EventDeadLetterQueue",
|
|
1775
|
+
"Arn"
|
|
1776
|
+
]
|
|
1777
|
+
},
|
|
1778
|
+
"LAST_EVENT_PARAMETER": {
|
|
1779
|
+
"Ref": "LastEventParameter"
|
|
1780
|
+
}
|
|
1781
|
+
}
|
|
1782
|
+
},
|
|
1783
|
+
"ReservedConcurrentExecutions": 5
|
|
1784
|
+
},
|
|
1785
|
+
"Condition": "ReportingOn"
|
|
1786
|
+
},
|
|
1787
|
+
"EventSourceMapping": {
|
|
1788
|
+
"Type": "AWS::Lambda::EventSourceMapping",
|
|
1789
|
+
"Properties": {
|
|
1790
|
+
"EventSourceArn": {
|
|
1791
|
+
"Fn::GetAtt": [
|
|
1792
|
+
"EventQueue",
|
|
1793
|
+
"Arn"
|
|
1794
|
+
]
|
|
1795
|
+
},
|
|
1796
|
+
"FunctionName": {
|
|
1797
|
+
"Ref": "EventsFunction"
|
|
1798
|
+
},
|
|
1799
|
+
"BatchSize": 10,
|
|
1800
|
+
"MaximumBatchingWindowInSeconds": 5,
|
|
1801
|
+
"Enabled": true,
|
|
1802
|
+
"FunctionResponseTypes": [
|
|
1803
|
+
"ReportBatchItemFailures"
|
|
1804
|
+
]
|
|
1805
|
+
},
|
|
1806
|
+
"Condition": "ReportingOn"
|
|
1807
|
+
},
|
|
1808
|
+
"EventsLogGroup": {
|
|
1809
|
+
"Type": "AWS::Logs::LogGroup",
|
|
1810
|
+
"Condition": "ReportingOn",
|
|
1811
|
+
"Properties": {
|
|
1812
|
+
"LogGroupName": {
|
|
1813
|
+
"Fn::Sub": "/aws/lambda/pipeline-builder-events${NameSuffix}"
|
|
1814
|
+
},
|
|
1815
|
+
"RetentionInDays": 30
|
|
1816
|
+
}
|
|
1817
|
+
},
|
|
1818
|
+
"RenewRole": {
|
|
1819
|
+
"Type": "AWS::IAM::Role",
|
|
1820
|
+
"Properties": {
|
|
1821
|
+
"RoleName": {
|
|
1822
|
+
"Fn::Sub": "pipeline-builder-renew${NameSuffix}"
|
|
1823
|
+
},
|
|
1824
|
+
"AssumeRolePolicyDocument": {
|
|
1825
|
+
"Version": "2012-10-17",
|
|
1826
|
+
"Statement": [
|
|
1827
|
+
{
|
|
1828
|
+
"Effect": "Allow",
|
|
1829
|
+
"Principal": {
|
|
1830
|
+
"Service": "lambda.amazonaws.com"
|
|
1831
|
+
},
|
|
1832
|
+
"Action": "sts:AssumeRole"
|
|
1833
|
+
}
|
|
1834
|
+
]
|
|
1835
|
+
},
|
|
1836
|
+
"ManagedPolicyArns": [
|
|
1837
|
+
{
|
|
1838
|
+
"Fn::Sub": "arn:${AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole"
|
|
1839
|
+
}
|
|
1840
|
+
],
|
|
1841
|
+
"Policies": [
|
|
1842
|
+
{
|
|
1843
|
+
"PolicyName": "renew",
|
|
1844
|
+
"PolicyDocument": {
|
|
1845
|
+
"Statement": [
|
|
1846
|
+
{
|
|
1847
|
+
"Effect": "Allow",
|
|
1848
|
+
"Action": [
|
|
1849
|
+
"secretsmanager:GetSecretValue",
|
|
1850
|
+
"secretsmanager:PutSecretValue",
|
|
1851
|
+
"secretsmanager:DescribeSecret"
|
|
1852
|
+
],
|
|
1853
|
+
"Resource": {
|
|
1854
|
+
"Fn::Sub": "arn:${AWS::Partition}:secretsmanager:${AWS::Region}:${AWS::AccountId}:secret:pipeline-builder/${OrgId}/*"
|
|
1855
|
+
}
|
|
1856
|
+
}
|
|
1857
|
+
]
|
|
1858
|
+
}
|
|
1859
|
+
}
|
|
1860
|
+
],
|
|
1861
|
+
"PermissionsBoundary": {
|
|
1862
|
+
"Fn::If": [
|
|
1863
|
+
"HasPermissionsBoundary",
|
|
1864
|
+
{
|
|
1865
|
+
"Ref": "PermissionsBoundaryArn"
|
|
1866
|
+
},
|
|
1867
|
+
{
|
|
1868
|
+
"Ref": "AWS::NoValue"
|
|
1869
|
+
}
|
|
1870
|
+
]
|
|
1871
|
+
}
|
|
1872
|
+
},
|
|
1873
|
+
"Condition": "RenewOn"
|
|
1874
|
+
},
|
|
1875
|
+
"RenewFunction": {
|
|
1876
|
+
"Type": "AWS::Lambda::Function",
|
|
1877
|
+
"Properties": {
|
|
1878
|
+
"FunctionName": {
|
|
1879
|
+
"Fn::Sub": "pipeline-builder-renew${NameSuffix}"
|
|
1880
|
+
},
|
|
1881
|
+
"Runtime": "nodejs26.x",
|
|
1882
|
+
"Handler": "index.handler",
|
|
1883
|
+
"Code": {
|
|
1884
|
+
"ZipFile": "exports.handler=async()=>{throw new Error('Placeholder — pipeline-manager infra setup-account uploads the key renewal')}"
|
|
1885
|
+
},
|
|
1886
|
+
"Role": {
|
|
1887
|
+
"Fn::GetAtt": [
|
|
1888
|
+
"RenewRole",
|
|
1889
|
+
"Arn"
|
|
1890
|
+
]
|
|
1891
|
+
},
|
|
1892
|
+
"Timeout": 60,
|
|
1893
|
+
"MemorySize": 256,
|
|
1894
|
+
"Environment": {
|
|
1895
|
+
"Variables": {
|
|
1896
|
+
"PLATFORM_SECRET_NAMES": {
|
|
1897
|
+
"Ref": "RenewSecretNames"
|
|
1898
|
+
},
|
|
1899
|
+
"KEY_TTL_DAYS": {
|
|
1900
|
+
"Ref": "KeyLifetimeDays"
|
|
1901
|
+
},
|
|
1902
|
+
"PIPELINE_MANAGER_VERSION": {
|
|
1903
|
+
"Ref": "PipelineManagerVersion"
|
|
1904
|
+
},
|
|
1905
|
+
"NODE_ENV": "production"
|
|
1906
|
+
}
|
|
1907
|
+
}
|
|
1908
|
+
},
|
|
1909
|
+
"Condition": "RenewOn"
|
|
1910
|
+
},
|
|
1911
|
+
"RenewScheduleRule": {
|
|
1912
|
+
"Type": "AWS::Events::Rule",
|
|
1913
|
+
"Properties": {
|
|
1914
|
+
"Name": {
|
|
1915
|
+
"Fn::Sub": "pipeline-builder-renew${NameSuffix}"
|
|
1916
|
+
},
|
|
1917
|
+
"Description": "Scheduled service-account key rotation",
|
|
1918
|
+
"State": "ENABLED",
|
|
1919
|
+
"ScheduleExpression": {
|
|
1920
|
+
"Ref": "RenewSchedule"
|
|
1921
|
+
},
|
|
1922
|
+
"Targets": [
|
|
1923
|
+
{
|
|
1924
|
+
"Id": "renew-lambda",
|
|
1925
|
+
"Arn": {
|
|
1926
|
+
"Fn::GetAtt": [
|
|
1927
|
+
"RenewFunction",
|
|
1928
|
+
"Arn"
|
|
1929
|
+
]
|
|
1930
|
+
}
|
|
1931
|
+
}
|
|
1932
|
+
]
|
|
1933
|
+
},
|
|
1934
|
+
"Condition": "RenewOn"
|
|
1935
|
+
},
|
|
1936
|
+
"RenewInvokePermission": {
|
|
1937
|
+
"Type": "AWS::Lambda::Permission",
|
|
1938
|
+
"Properties": {
|
|
1939
|
+
"FunctionName": {
|
|
1940
|
+
"Ref": "RenewFunction"
|
|
1941
|
+
},
|
|
1942
|
+
"Action": "lambda:InvokeFunction",
|
|
1943
|
+
"Principal": "events.amazonaws.com",
|
|
1944
|
+
"SourceArn": {
|
|
1945
|
+
"Fn::GetAtt": [
|
|
1946
|
+
"RenewScheduleRule",
|
|
1947
|
+
"Arn"
|
|
1948
|
+
]
|
|
1949
|
+
}
|
|
1950
|
+
},
|
|
1951
|
+
"Condition": "RenewOn"
|
|
1952
|
+
},
|
|
1953
|
+
"RenewLogGroup": {
|
|
1954
|
+
"Type": "AWS::Logs::LogGroup",
|
|
1955
|
+
"Condition": "RenewOn",
|
|
1956
|
+
"Properties": {
|
|
1957
|
+
"LogGroupName": {
|
|
1958
|
+
"Fn::Sub": "/aws/lambda/pipeline-builder-renew${NameSuffix}"
|
|
1959
|
+
},
|
|
1960
|
+
"RetentionInDays": 30
|
|
1961
|
+
}
|
|
1962
|
+
}
|
|
1963
|
+
},
|
|
1964
|
+
"Outputs": {
|
|
1965
|
+
"FunctionName": {
|
|
1966
|
+
"Value": {
|
|
1967
|
+
"Ref": "RunnerFunction"
|
|
1968
|
+
},
|
|
1969
|
+
"Condition": "RunnerOn"
|
|
1970
|
+
},
|
|
1971
|
+
"RunnerId": {
|
|
1972
|
+
"Value": {
|
|
1973
|
+
"Ref": "RunnerId"
|
|
1974
|
+
},
|
|
1975
|
+
"Condition": "RunnerOn"
|
|
1976
|
+
},
|
|
1977
|
+
"EndpointUrl": {
|
|
1978
|
+
"Description": "Where the platform delivers run requests. Treat as a secret: never log it.",
|
|
1979
|
+
"Value": {
|
|
1980
|
+
"Fn::If": [
|
|
1981
|
+
"UseFunctionUrl",
|
|
1982
|
+
{
|
|
1983
|
+
"Fn::GetAtt": [
|
|
1984
|
+
"FunctionUrl",
|
|
1985
|
+
"FunctionUrl"
|
|
1986
|
+
]
|
|
1987
|
+
},
|
|
1988
|
+
{
|
|
1989
|
+
"Fn::Sub": "https://${RunnerApi}.execute-api.${AWS::Region}.${AWS::URLSuffix}/runner/"
|
|
1990
|
+
}
|
|
1991
|
+
]
|
|
1992
|
+
},
|
|
1993
|
+
"Condition": "RunnerOn"
|
|
1994
|
+
},
|
|
1995
|
+
"EventsFunctionName": {
|
|
1996
|
+
"Condition": "ReportingOn",
|
|
1997
|
+
"Value": {
|
|
1998
|
+
"Ref": "EventsFunction"
|
|
1999
|
+
}
|
|
2000
|
+
},
|
|
2001
|
+
"EventQueueUrl": {
|
|
2002
|
+
"Condition": "ReportingOn",
|
|
2003
|
+
"Value": {
|
|
2004
|
+
"Ref": "EventQueue"
|
|
2005
|
+
}
|
|
2006
|
+
},
|
|
2007
|
+
"EventDeadLetterQueueUrl": {
|
|
2008
|
+
"Condition": "ReportingOn",
|
|
2009
|
+
"Value": {
|
|
2010
|
+
"Ref": "EventDeadLetterQueue"
|
|
2011
|
+
}
|
|
2012
|
+
},
|
|
2013
|
+
"RenewFunctionName": {
|
|
2014
|
+
"Condition": "RenewOn",
|
|
2015
|
+
"Value": {
|
|
2016
|
+
"Ref": "RenewFunction"
|
|
2017
|
+
}
|
|
2018
|
+
}
|
|
2019
|
+
},
|
|
2020
|
+
"Rules": {
|
|
2021
|
+
"RunnerNeedsItsId": {
|
|
2022
|
+
"RuleCondition": {
|
|
2023
|
+
"Fn::Equals": [
|
|
2024
|
+
{
|
|
2025
|
+
"Ref": "EnableRunner"
|
|
2026
|
+
},
|
|
2027
|
+
"true"
|
|
2028
|
+
]
|
|
2029
|
+
},
|
|
2030
|
+
"Assertions": [
|
|
2031
|
+
{
|
|
2032
|
+
"Assert": {
|
|
2033
|
+
"Fn::Not": [
|
|
2034
|
+
{
|
|
2035
|
+
"Fn::Equals": [
|
|
2036
|
+
{
|
|
2037
|
+
"Ref": "RunnerId"
|
|
2038
|
+
},
|
|
2039
|
+
""
|
|
2040
|
+
]
|
|
2041
|
+
}
|
|
2042
|
+
]
|
|
2043
|
+
},
|
|
2044
|
+
"AssertDescription": "A stack with the runner (EnableRunner=true) is always bound to the connector it was registered as: RunnerId is required."
|
|
2045
|
+
}
|
|
2046
|
+
]
|
|
2047
|
+
}
|
|
2048
|
+
}
|
|
2049
|
+
}
|