@cloudsnorkel/cdk-github-runners 0.7.1 → 0.7.3
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/.jsii +629 -6
- package/API.md +394 -1
- package/README.md +2 -2
- package/lib/index.d.ts +3 -13
- package/lib/index.js +14 -29
- package/lib/lambdas/delete-ami/index.js +11 -2
- package/lib/lambdas/delete-runner/index.js +0 -7
- package/lib/lambdas/setup/index.js +0 -6
- package/lib/lambdas/status/index.js +0 -7
- package/lib/lambdas/token-retriever/index.js +0 -7
- package/lib/lambdas/update-lambda/index.js +1041 -1214
- package/lib/providers/codebuild.js +1 -1
- package/lib/providers/common.js +3 -3
- package/lib/providers/ec2.js +11 -2
- package/lib/providers/fargate.js +1 -1
- package/lib/providers/image-builders/ami.js +6 -2
- package/lib/providers/image-builders/codebuild.js +1 -1
- package/lib/providers/image-builders/common.js +1 -1
- package/lib/providers/image-builders/container.js +1 -1
- package/lib/providers/image-builders/index.d.ts +7 -0
- package/lib/providers/image-builders/index.js +20 -0
- package/lib/providers/image-builders/linux-components.js +1 -1
- package/lib/providers/image-builders/static.js +1 -1
- package/lib/providers/image-builders/windows-components.js +1 -1
- package/lib/providers/index.d.ts +6 -0
- package/lib/providers/index.js +19 -0
- package/lib/providers/lambda.js +1 -1
- package/lib/runner.js +1 -1
- package/lib/secrets.js +1 -1
- package/package.json +10 -10
package/API.md
CHANGED
|
@@ -2,6 +2,210 @@
|
|
|
2
2
|
|
|
3
3
|
## Constructs <a name="Constructs" id="Constructs"></a>
|
|
4
4
|
|
|
5
|
+
### AmiBuilder <a name="AmiBuilder" id="@cloudsnorkel/cdk-github-runners.AmiBuilder"></a>
|
|
6
|
+
|
|
7
|
+
- *Implements:* <a href="#@cloudsnorkel/cdk-github-runners.IAmiBuilder">IAmiBuilder</a>, aws-cdk-lib.aws_ec2.IConnectable
|
|
8
|
+
|
|
9
|
+
An AMI builder that uses AWS Image Builder to build AMIs pre-baked with all the GitHub Actions runner requirements.
|
|
10
|
+
|
|
11
|
+
Builders can be used with {@link Ec2Runner}.
|
|
12
|
+
|
|
13
|
+
Each builder re-runs automatically at a set interval to make sure the AMIs contain the latest versions of everything.
|
|
14
|
+
|
|
15
|
+
You can create an instance of this construct to customize the AMI used to spin-up runners. Some runner providers may require custom components. Check the runner provider documentation.
|
|
16
|
+
|
|
17
|
+
For example, to set a specific runner version, rebuild the image every 2 weeks, and add a few packages for the EC2 provider, use:
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
const builder = new AmiBuilder(this, 'Builder', {
|
|
21
|
+
runnerVersion: RunnerVersion.specific('2.293.0'),
|
|
22
|
+
rebuildInterval: Duration.days(14),
|
|
23
|
+
});
|
|
24
|
+
builder.addComponent(new ImageBuilderComponent(scope, id, {
|
|
25
|
+
platform: 'Linux',
|
|
26
|
+
displayName: 'p7zip',
|
|
27
|
+
description: 'Install some more packages',
|
|
28
|
+
commands: [
|
|
29
|
+
'set -ex',
|
|
30
|
+
'apt-get install p7zip',
|
|
31
|
+
],
|
|
32
|
+
}));
|
|
33
|
+
new Ec2Runner(this, 'EC2 provider', {
|
|
34
|
+
label: 'custom-ec2',
|
|
35
|
+
amiBuilder: builder,
|
|
36
|
+
});
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
#### Initializers <a name="Initializers" id="@cloudsnorkel/cdk-github-runners.AmiBuilder.Initializer"></a>
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
import { AmiBuilder } from '@cloudsnorkel/cdk-github-runners'
|
|
43
|
+
|
|
44
|
+
new AmiBuilder(scope: Construct, id: string, props?: AmiBuilderProps)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
| **Name** | **Type** | **Description** |
|
|
48
|
+
| --- | --- | --- |
|
|
49
|
+
| <code><a href="#@cloudsnorkel/cdk-github-runners.AmiBuilder.Initializer.parameter.scope">scope</a></code> | <code>constructs.Construct</code> | *No description.* |
|
|
50
|
+
| <code><a href="#@cloudsnorkel/cdk-github-runners.AmiBuilder.Initializer.parameter.id">id</a></code> | <code>string</code> | *No description.* |
|
|
51
|
+
| <code><a href="#@cloudsnorkel/cdk-github-runners.AmiBuilder.Initializer.parameter.props">props</a></code> | <code><a href="#@cloudsnorkel/cdk-github-runners.AmiBuilderProps">AmiBuilderProps</a></code> | *No description.* |
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
##### `scope`<sup>Required</sup> <a name="scope" id="@cloudsnorkel/cdk-github-runners.AmiBuilder.Initializer.parameter.scope"></a>
|
|
56
|
+
|
|
57
|
+
- *Type:* constructs.Construct
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
##### `id`<sup>Required</sup> <a name="id" id="@cloudsnorkel/cdk-github-runners.AmiBuilder.Initializer.parameter.id"></a>
|
|
62
|
+
|
|
63
|
+
- *Type:* string
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
##### `props`<sup>Optional</sup> <a name="props" id="@cloudsnorkel/cdk-github-runners.AmiBuilder.Initializer.parameter.props"></a>
|
|
68
|
+
|
|
69
|
+
- *Type:* <a href="#@cloudsnorkel/cdk-github-runners.AmiBuilderProps">AmiBuilderProps</a>
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
#### Methods <a name="Methods" id="Methods"></a>
|
|
74
|
+
|
|
75
|
+
| **Name** | **Description** |
|
|
76
|
+
| --- | --- |
|
|
77
|
+
| <code><a href="#@cloudsnorkel/cdk-github-runners.AmiBuilder.toString">toString</a></code> | Returns a string representation of this construct. |
|
|
78
|
+
| <code><a href="#@cloudsnorkel/cdk-github-runners.AmiBuilder.addComponent">addComponent</a></code> | Add a component to be installed. |
|
|
79
|
+
| <code><a href="#@cloudsnorkel/cdk-github-runners.AmiBuilder.addExtraCertificates">addExtraCertificates</a></code> | Add extra trusted certificates. |
|
|
80
|
+
| <code><a href="#@cloudsnorkel/cdk-github-runners.AmiBuilder.bind">bind</a></code> | Called by IRunnerProvider to finalize settings and create the AMI builder. |
|
|
81
|
+
| <code><a href="#@cloudsnorkel/cdk-github-runners.AmiBuilder.prependComponent">prependComponent</a></code> | Add a component to be installed before any other components. |
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
##### `toString` <a name="toString" id="@cloudsnorkel/cdk-github-runners.AmiBuilder.toString"></a>
|
|
86
|
+
|
|
87
|
+
```typescript
|
|
88
|
+
public toString(): string
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Returns a string representation of this construct.
|
|
92
|
+
|
|
93
|
+
##### `addComponent` <a name="addComponent" id="@cloudsnorkel/cdk-github-runners.AmiBuilder.addComponent"></a>
|
|
94
|
+
|
|
95
|
+
```typescript
|
|
96
|
+
public addComponent(component: ImageBuilderComponent): void
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Add a component to be installed.
|
|
100
|
+
|
|
101
|
+
###### `component`<sup>Required</sup> <a name="component" id="@cloudsnorkel/cdk-github-runners.AmiBuilder.addComponent.parameter.component"></a>
|
|
102
|
+
|
|
103
|
+
- *Type:* <a href="#@cloudsnorkel/cdk-github-runners.ImageBuilderComponent">ImageBuilderComponent</a>
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
##### `addExtraCertificates` <a name="addExtraCertificates" id="@cloudsnorkel/cdk-github-runners.AmiBuilder.addExtraCertificates"></a>
|
|
108
|
+
|
|
109
|
+
```typescript
|
|
110
|
+
public addExtraCertificates(path: string): void
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Add extra trusted certificates.
|
|
114
|
+
|
|
115
|
+
This helps deal with self-signed certificates for GitHub Enterprise Server.
|
|
116
|
+
|
|
117
|
+
###### `path`<sup>Required</sup> <a name="path" id="@cloudsnorkel/cdk-github-runners.AmiBuilder.addExtraCertificates.parameter.path"></a>
|
|
118
|
+
|
|
119
|
+
- *Type:* string
|
|
120
|
+
|
|
121
|
+
path to directory containing a file called certs.pem containing all the required certificates.
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
##### `bind` <a name="bind" id="@cloudsnorkel/cdk-github-runners.AmiBuilder.bind"></a>
|
|
126
|
+
|
|
127
|
+
```typescript
|
|
128
|
+
public bind(): RunnerAmi
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Called by IRunnerProvider to finalize settings and create the AMI builder.
|
|
132
|
+
|
|
133
|
+
##### `prependComponent` <a name="prependComponent" id="@cloudsnorkel/cdk-github-runners.AmiBuilder.prependComponent"></a>
|
|
134
|
+
|
|
135
|
+
```typescript
|
|
136
|
+
public prependComponent(component: ImageBuilderComponent): void
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Add a component to be installed before any other components.
|
|
140
|
+
|
|
141
|
+
Useful for required system settings like certificates or proxy settings.
|
|
142
|
+
|
|
143
|
+
###### `component`<sup>Required</sup> <a name="component" id="@cloudsnorkel/cdk-github-runners.AmiBuilder.prependComponent.parameter.component"></a>
|
|
144
|
+
|
|
145
|
+
- *Type:* <a href="#@cloudsnorkel/cdk-github-runners.ImageBuilderComponent">ImageBuilderComponent</a>
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
#### Static Functions <a name="Static Functions" id="Static Functions"></a>
|
|
150
|
+
|
|
151
|
+
| **Name** | **Description** |
|
|
152
|
+
| --- | --- |
|
|
153
|
+
| <code><a href="#@cloudsnorkel/cdk-github-runners.AmiBuilder.isConstruct">isConstruct</a></code> | Checks if `x` is a construct. |
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
##### ~~`isConstruct`~~ <a name="isConstruct" id="@cloudsnorkel/cdk-github-runners.AmiBuilder.isConstruct"></a>
|
|
158
|
+
|
|
159
|
+
```typescript
|
|
160
|
+
import { AmiBuilder } from '@cloudsnorkel/cdk-github-runners'
|
|
161
|
+
|
|
162
|
+
AmiBuilder.isConstruct(x: any)
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Checks if `x` is a construct.
|
|
166
|
+
|
|
167
|
+
###### `x`<sup>Required</sup> <a name="x" id="@cloudsnorkel/cdk-github-runners.AmiBuilder.isConstruct.parameter.x"></a>
|
|
168
|
+
|
|
169
|
+
- *Type:* any
|
|
170
|
+
|
|
171
|
+
Any object.
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
#### Properties <a name="Properties" id="Properties"></a>
|
|
176
|
+
|
|
177
|
+
| **Name** | **Type** | **Description** |
|
|
178
|
+
| --- | --- | --- |
|
|
179
|
+
| <code><a href="#@cloudsnorkel/cdk-github-runners.AmiBuilder.property.node">node</a></code> | <code>constructs.Node</code> | The tree node. |
|
|
180
|
+
| <code><a href="#@cloudsnorkel/cdk-github-runners.AmiBuilder.property.connections">connections</a></code> | <code>aws-cdk-lib.aws_ec2.Connections</code> | The network connections associated with this resource. |
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
##### `node`<sup>Required</sup> <a name="node" id="@cloudsnorkel/cdk-github-runners.AmiBuilder.property.node"></a>
|
|
185
|
+
|
|
186
|
+
```typescript
|
|
187
|
+
public readonly node: Node;
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
- *Type:* constructs.Node
|
|
191
|
+
|
|
192
|
+
The tree node.
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
##### `connections`<sup>Required</sup> <a name="connections" id="@cloudsnorkel/cdk-github-runners.AmiBuilder.property.connections"></a>
|
|
197
|
+
|
|
198
|
+
```typescript
|
|
199
|
+
public readonly connections: Connections;
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
- *Type:* aws-cdk-lib.aws_ec2.Connections
|
|
203
|
+
|
|
204
|
+
The network connections associated with this resource.
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
|
|
5
209
|
### CodeBuildImageBuilder <a name="CodeBuildImageBuilder" id="@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilder"></a>
|
|
6
210
|
|
|
7
211
|
- *Implements:* <a href="#@cloudsnorkel/cdk-github-runners.IImageBuilder">IImageBuilder</a>
|
|
@@ -2158,6 +2362,195 @@ Webhook secret used to confirm events are coming from GitHub and nowhere else.
|
|
|
2158
2362
|
|
|
2159
2363
|
## Structs <a name="Structs" id="Structs"></a>
|
|
2160
2364
|
|
|
2365
|
+
### AmiBuilderProps <a name="AmiBuilderProps" id="@cloudsnorkel/cdk-github-runners.AmiBuilderProps"></a>
|
|
2366
|
+
|
|
2367
|
+
Properties for {@link AmiBuilder} construct.
|
|
2368
|
+
|
|
2369
|
+
#### Initializer <a name="Initializer" id="@cloudsnorkel/cdk-github-runners.AmiBuilderProps.Initializer"></a>
|
|
2370
|
+
|
|
2371
|
+
```typescript
|
|
2372
|
+
import { AmiBuilderProps } from '@cloudsnorkel/cdk-github-runners'
|
|
2373
|
+
|
|
2374
|
+
const amiBuilderProps: AmiBuilderProps = { ... }
|
|
2375
|
+
```
|
|
2376
|
+
|
|
2377
|
+
#### Properties <a name="Properties" id="Properties"></a>
|
|
2378
|
+
|
|
2379
|
+
| **Name** | **Type** | **Description** |
|
|
2380
|
+
| --- | --- | --- |
|
|
2381
|
+
| <code><a href="#@cloudsnorkel/cdk-github-runners.AmiBuilderProps.property.architecture">architecture</a></code> | <code><a href="#@cloudsnorkel/cdk-github-runners.Architecture">Architecture</a></code> | Image architecture. |
|
|
2382
|
+
| <code><a href="#@cloudsnorkel/cdk-github-runners.AmiBuilderProps.property.instanceType">instanceType</a></code> | <code>aws-cdk-lib.aws_ec2.InstanceType</code> | The instance type used to build the image. |
|
|
2383
|
+
| <code><a href="#@cloudsnorkel/cdk-github-runners.AmiBuilderProps.property.logRemovalPolicy">logRemovalPolicy</a></code> | <code>aws-cdk-lib.RemovalPolicy</code> | Removal policy for logs of image builds. |
|
|
2384
|
+
| <code><a href="#@cloudsnorkel/cdk-github-runners.AmiBuilderProps.property.logRetention">logRetention</a></code> | <code>aws-cdk-lib.aws_logs.RetentionDays</code> | The number of days log events are kept in CloudWatch Logs. |
|
|
2385
|
+
| <code><a href="#@cloudsnorkel/cdk-github-runners.AmiBuilderProps.property.os">os</a></code> | <code><a href="#@cloudsnorkel/cdk-github-runners.Os">Os</a></code> | Image OS. |
|
|
2386
|
+
| <code><a href="#@cloudsnorkel/cdk-github-runners.AmiBuilderProps.property.rebuildInterval">rebuildInterval</a></code> | <code>aws-cdk-lib.Duration</code> | Schedule the AMI to be rebuilt every given interval. |
|
|
2387
|
+
| <code><a href="#@cloudsnorkel/cdk-github-runners.AmiBuilderProps.property.runnerVersion">runnerVersion</a></code> | <code><a href="#@cloudsnorkel/cdk-github-runners.RunnerVersion">RunnerVersion</a></code> | Version of GitHub Runners to install. |
|
|
2388
|
+
| <code><a href="#@cloudsnorkel/cdk-github-runners.AmiBuilderProps.property.securityGroup">securityGroup</a></code> | <code>aws-cdk-lib.aws_ec2.ISecurityGroup</code> | Security group to assign to launched builder instances. |
|
|
2389
|
+
| <code><a href="#@cloudsnorkel/cdk-github-runners.AmiBuilderProps.property.securityGroups">securityGroups</a></code> | <code>aws-cdk-lib.aws_ec2.ISecurityGroup[]</code> | Security groups to assign to launched builder instances. |
|
|
2390
|
+
| <code><a href="#@cloudsnorkel/cdk-github-runners.AmiBuilderProps.property.subnetSelection">subnetSelection</a></code> | <code>aws-cdk-lib.aws_ec2.SubnetSelection</code> | Where to place the network interfaces within the VPC. |
|
|
2391
|
+
| <code><a href="#@cloudsnorkel/cdk-github-runners.AmiBuilderProps.property.vpc">vpc</a></code> | <code>aws-cdk-lib.aws_ec2.IVpc</code> | VPC where builder instances will be launched. |
|
|
2392
|
+
|
|
2393
|
+
---
|
|
2394
|
+
|
|
2395
|
+
##### `architecture`<sup>Optional</sup> <a name="architecture" id="@cloudsnorkel/cdk-github-runners.AmiBuilderProps.property.architecture"></a>
|
|
2396
|
+
|
|
2397
|
+
```typescript
|
|
2398
|
+
public readonly architecture: Architecture;
|
|
2399
|
+
```
|
|
2400
|
+
|
|
2401
|
+
- *Type:* <a href="#@cloudsnorkel/cdk-github-runners.Architecture">Architecture</a>
|
|
2402
|
+
- *Default:* Architecture.X86_64
|
|
2403
|
+
|
|
2404
|
+
Image architecture.
|
|
2405
|
+
|
|
2406
|
+
---
|
|
2407
|
+
|
|
2408
|
+
##### `instanceType`<sup>Optional</sup> <a name="instanceType" id="@cloudsnorkel/cdk-github-runners.AmiBuilderProps.property.instanceType"></a>
|
|
2409
|
+
|
|
2410
|
+
```typescript
|
|
2411
|
+
public readonly instanceType: InstanceType;
|
|
2412
|
+
```
|
|
2413
|
+
|
|
2414
|
+
- *Type:* aws-cdk-lib.aws_ec2.InstanceType
|
|
2415
|
+
- *Default:* m5.large
|
|
2416
|
+
|
|
2417
|
+
The instance type used to build the image.
|
|
2418
|
+
|
|
2419
|
+
---
|
|
2420
|
+
|
|
2421
|
+
##### `logRemovalPolicy`<sup>Optional</sup> <a name="logRemovalPolicy" id="@cloudsnorkel/cdk-github-runners.AmiBuilderProps.property.logRemovalPolicy"></a>
|
|
2422
|
+
|
|
2423
|
+
```typescript
|
|
2424
|
+
public readonly logRemovalPolicy: RemovalPolicy;
|
|
2425
|
+
```
|
|
2426
|
+
|
|
2427
|
+
- *Type:* aws-cdk-lib.RemovalPolicy
|
|
2428
|
+
- *Default:* RemovalPolicy.DESTROY
|
|
2429
|
+
|
|
2430
|
+
Removal policy for logs of image builds.
|
|
2431
|
+
|
|
2432
|
+
If deployment fails on the custom resource, try setting this to `RemovalPolicy.RETAIN`. This way the logs can still be viewed, and you can see why the build failed.
|
|
2433
|
+
|
|
2434
|
+
We try to not leave anything behind when removed. But sometimes a log staying behind is useful.
|
|
2435
|
+
|
|
2436
|
+
---
|
|
2437
|
+
|
|
2438
|
+
##### `logRetention`<sup>Optional</sup> <a name="logRetention" id="@cloudsnorkel/cdk-github-runners.AmiBuilderProps.property.logRetention"></a>
|
|
2439
|
+
|
|
2440
|
+
```typescript
|
|
2441
|
+
public readonly logRetention: RetentionDays;
|
|
2442
|
+
```
|
|
2443
|
+
|
|
2444
|
+
- *Type:* aws-cdk-lib.aws_logs.RetentionDays
|
|
2445
|
+
- *Default:* logs.RetentionDays.ONE_MONTH
|
|
2446
|
+
|
|
2447
|
+
The number of days log events are kept in CloudWatch Logs.
|
|
2448
|
+
|
|
2449
|
+
When updating
|
|
2450
|
+
this property, unsetting it doesn't remove the log retention policy. To
|
|
2451
|
+
remove the retention policy, set the value to `INFINITE`.
|
|
2452
|
+
|
|
2453
|
+
---
|
|
2454
|
+
|
|
2455
|
+
##### `os`<sup>Optional</sup> <a name="os" id="@cloudsnorkel/cdk-github-runners.AmiBuilderProps.property.os"></a>
|
|
2456
|
+
|
|
2457
|
+
```typescript
|
|
2458
|
+
public readonly os: Os;
|
|
2459
|
+
```
|
|
2460
|
+
|
|
2461
|
+
- *Type:* <a href="#@cloudsnorkel/cdk-github-runners.Os">Os</a>
|
|
2462
|
+
- *Default:* OS.LINUX
|
|
2463
|
+
|
|
2464
|
+
Image OS.
|
|
2465
|
+
|
|
2466
|
+
---
|
|
2467
|
+
|
|
2468
|
+
##### `rebuildInterval`<sup>Optional</sup> <a name="rebuildInterval" id="@cloudsnorkel/cdk-github-runners.AmiBuilderProps.property.rebuildInterval"></a>
|
|
2469
|
+
|
|
2470
|
+
```typescript
|
|
2471
|
+
public readonly rebuildInterval: Duration;
|
|
2472
|
+
```
|
|
2473
|
+
|
|
2474
|
+
- *Type:* aws-cdk-lib.Duration
|
|
2475
|
+
- *Default:* Duration.days(7)
|
|
2476
|
+
|
|
2477
|
+
Schedule the AMI to be rebuilt every given interval.
|
|
2478
|
+
|
|
2479
|
+
Useful for keeping the AMI up-do-date with the latest GitHub runner version and latest OS updates.
|
|
2480
|
+
|
|
2481
|
+
Set to zero to disable.
|
|
2482
|
+
|
|
2483
|
+
---
|
|
2484
|
+
|
|
2485
|
+
##### `runnerVersion`<sup>Optional</sup> <a name="runnerVersion" id="@cloudsnorkel/cdk-github-runners.AmiBuilderProps.property.runnerVersion"></a>
|
|
2486
|
+
|
|
2487
|
+
```typescript
|
|
2488
|
+
public readonly runnerVersion: RunnerVersion;
|
|
2489
|
+
```
|
|
2490
|
+
|
|
2491
|
+
- *Type:* <a href="#@cloudsnorkel/cdk-github-runners.RunnerVersion">RunnerVersion</a>
|
|
2492
|
+
- *Default:* latest version available
|
|
2493
|
+
|
|
2494
|
+
Version of GitHub Runners to install.
|
|
2495
|
+
|
|
2496
|
+
---
|
|
2497
|
+
|
|
2498
|
+
##### ~~`securityGroup`~~<sup>Optional</sup> <a name="securityGroup" id="@cloudsnorkel/cdk-github-runners.AmiBuilderProps.property.securityGroup"></a>
|
|
2499
|
+
|
|
2500
|
+
- *Deprecated:* use {@link securityGroups}
|
|
2501
|
+
|
|
2502
|
+
```typescript
|
|
2503
|
+
public readonly securityGroup: ISecurityGroup;
|
|
2504
|
+
```
|
|
2505
|
+
|
|
2506
|
+
- *Type:* aws-cdk-lib.aws_ec2.ISecurityGroup
|
|
2507
|
+
- *Default:* new security group
|
|
2508
|
+
|
|
2509
|
+
Security group to assign to launched builder instances.
|
|
2510
|
+
|
|
2511
|
+
---
|
|
2512
|
+
|
|
2513
|
+
##### `securityGroups`<sup>Optional</sup> <a name="securityGroups" id="@cloudsnorkel/cdk-github-runners.AmiBuilderProps.property.securityGroups"></a>
|
|
2514
|
+
|
|
2515
|
+
```typescript
|
|
2516
|
+
public readonly securityGroups: ISecurityGroup[];
|
|
2517
|
+
```
|
|
2518
|
+
|
|
2519
|
+
- *Type:* aws-cdk-lib.aws_ec2.ISecurityGroup[]
|
|
2520
|
+
- *Default:* new security group
|
|
2521
|
+
|
|
2522
|
+
Security groups to assign to launched builder instances.
|
|
2523
|
+
|
|
2524
|
+
---
|
|
2525
|
+
|
|
2526
|
+
##### `subnetSelection`<sup>Optional</sup> <a name="subnetSelection" id="@cloudsnorkel/cdk-github-runners.AmiBuilderProps.property.subnetSelection"></a>
|
|
2527
|
+
|
|
2528
|
+
```typescript
|
|
2529
|
+
public readonly subnetSelection: SubnetSelection;
|
|
2530
|
+
```
|
|
2531
|
+
|
|
2532
|
+
- *Type:* aws-cdk-lib.aws_ec2.SubnetSelection
|
|
2533
|
+
- *Default:* default VPC subnet
|
|
2534
|
+
|
|
2535
|
+
Where to place the network interfaces within the VPC.
|
|
2536
|
+
|
|
2537
|
+
Only the first matched subnet will be used.
|
|
2538
|
+
|
|
2539
|
+
---
|
|
2540
|
+
|
|
2541
|
+
##### `vpc`<sup>Optional</sup> <a name="vpc" id="@cloudsnorkel/cdk-github-runners.AmiBuilderProps.property.vpc"></a>
|
|
2542
|
+
|
|
2543
|
+
```typescript
|
|
2544
|
+
public readonly vpc: IVpc;
|
|
2545
|
+
```
|
|
2546
|
+
|
|
2547
|
+
- *Type:* aws-cdk-lib.aws_ec2.IVpc
|
|
2548
|
+
- *Default:* default account VPC
|
|
2549
|
+
|
|
2550
|
+
VPC where builder instances will be launched.
|
|
2551
|
+
|
|
2552
|
+
---
|
|
2553
|
+
|
|
2161
2554
|
### CodeBuildImageBuilderProps <a name="CodeBuildImageBuilderProps" id="@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilderProps"></a>
|
|
2162
2555
|
|
|
2163
2556
|
Properties for CodeBuildImageBuilder construct.
|
|
@@ -4885,7 +5278,7 @@ WindowsComponents.githubRunner(scope: Construct, id: string, runnerVersion: Runn
|
|
|
4885
5278
|
|
|
4886
5279
|
### IAmiBuilder <a name="IAmiBuilder" id="@cloudsnorkel/cdk-github-runners.IAmiBuilder"></a>
|
|
4887
5280
|
|
|
4888
|
-
- *Implemented By:* <a href="#@cloudsnorkel/cdk-github-runners.IAmiBuilder">IAmiBuilder</a>
|
|
5281
|
+
- *Implemented By:* <a href="#@cloudsnorkel/cdk-github-runners.AmiBuilder">AmiBuilder</a>, <a href="#@cloudsnorkel/cdk-github-runners.IAmiBuilder">IAmiBuilder</a>
|
|
4889
5282
|
|
|
4890
5283
|
Interface for constructs that build an AMI that can be used in {@link IRunnerProvider}.
|
|
4891
5284
|
|
package/README.md
CHANGED
|
@@ -205,13 +205,13 @@ new GitHubRunners(stack, 'runners', {
|
|
|
205
205
|
## Other Options
|
|
206
206
|
|
|
207
207
|
1. [philips-labs/terraform-aws-github-runner][3] if you're using Terraform
|
|
208
|
-
2. [actions
|
|
208
|
+
2. [actions/actions-runner-controller][4] if you're using Kubernetes
|
|
209
209
|
|
|
210
210
|
|
|
211
211
|
[1]: https://docs.github.com/en/actions/hosting-your-own-runners/about-self-hosted-runners
|
|
212
212
|
[2]: https://github.com/marketplace/actions/configure-aws-credentials-action-for-github-actions
|
|
213
213
|
[3]: https://github.com/philips-labs/terraform-aws-github-runner
|
|
214
|
-
[4]: https://github.com/actions
|
|
214
|
+
[4]: https://github.com/actions/actions-runner-controller
|
|
215
215
|
[5]: https://github.com/actions/runner
|
|
216
216
|
[6]: https://pypi.org/project/cloudsnorkel.cdk-github-runners
|
|
217
217
|
[7]: https://www.npmjs.com/package/@cloudsnorkel/cdk-github-runners
|
package/lib/index.d.ts
CHANGED
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export { Ec2Runner, Ec2RunnerProps } from './providers/ec2';
|
|
5
|
-
export { LambdaRunner, LambdaRunnerProps } from './providers/lambda';
|
|
6
|
-
export { FargateRunner, FargateRunnerProps } from './providers/fargate';
|
|
7
|
-
export { IRunnerProvider, RunnerProviderProps, RunnerVersion, RunnerRuntimeParameters, RunnerAmi, RunnerImage, IAmiBuilder, IImageBuilder, IRunnerProviderStatus, IRunnerImageStatus, IRunnerAmiStatus, Architecture, Os } from './providers/common';
|
|
8
|
-
export { CodeBuildImageBuilder, CodeBuildImageBuilderProps } from './providers/image-builders/codebuild';
|
|
9
|
-
export { ImageBuilderComponent, ImageBuilderComponentProperties, ImageBuilderAsset } from './providers/image-builders/common';
|
|
10
|
-
export { ContainerImageBuilder, ContainerImageBuilderProps } from './providers/image-builders/container';
|
|
11
|
-
export { WindowsComponents } from './providers/image-builders/windows-components';
|
|
12
|
-
export { LinuxUbuntuComponents } from './providers/image-builders/linux-components';
|
|
13
|
-
export { StaticRunnerImage } from './providers/image-builders/static';
|
|
1
|
+
export * from './secrets';
|
|
2
|
+
export * from './runner';
|
|
3
|
+
export * from './providers';
|
package/lib/index.js
CHANGED
|
@@ -1,31 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
2
12
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var codebuild_1 = require("./providers/codebuild");
|
|
8
|
-
Object.defineProperty(exports, "CodeBuildRunner", { enumerable: true, get: function () { return codebuild_1.CodeBuildRunner; } });
|
|
9
|
-
var ec2_1 = require("./providers/ec2");
|
|
10
|
-
Object.defineProperty(exports, "Ec2Runner", { enumerable: true, get: function () { return ec2_1.Ec2Runner; } });
|
|
11
|
-
var lambda_1 = require("./providers/lambda");
|
|
12
|
-
Object.defineProperty(exports, "LambdaRunner", { enumerable: true, get: function () { return lambda_1.LambdaRunner; } });
|
|
13
|
-
var fargate_1 = require("./providers/fargate");
|
|
14
|
-
Object.defineProperty(exports, "FargateRunner", { enumerable: true, get: function () { return fargate_1.FargateRunner; } });
|
|
15
|
-
var common_1 = require("./providers/common");
|
|
16
|
-
Object.defineProperty(exports, "RunnerVersion", { enumerable: true, get: function () { return common_1.RunnerVersion; } });
|
|
17
|
-
Object.defineProperty(exports, "Architecture", { enumerable: true, get: function () { return common_1.Architecture; } });
|
|
18
|
-
Object.defineProperty(exports, "Os", { enumerable: true, get: function () { return common_1.Os; } });
|
|
19
|
-
var codebuild_2 = require("./providers/image-builders/codebuild");
|
|
20
|
-
Object.defineProperty(exports, "CodeBuildImageBuilder", { enumerable: true, get: function () { return codebuild_2.CodeBuildImageBuilder; } });
|
|
21
|
-
var common_2 = require("./providers/image-builders/common");
|
|
22
|
-
Object.defineProperty(exports, "ImageBuilderComponent", { enumerable: true, get: function () { return common_2.ImageBuilderComponent; } });
|
|
23
|
-
var container_1 = require("./providers/image-builders/container");
|
|
24
|
-
Object.defineProperty(exports, "ContainerImageBuilder", { enumerable: true, get: function () { return container_1.ContainerImageBuilder; } });
|
|
25
|
-
var windows_components_1 = require("./providers/image-builders/windows-components");
|
|
26
|
-
Object.defineProperty(exports, "WindowsComponents", { enumerable: true, get: function () { return windows_components_1.WindowsComponents; } });
|
|
27
|
-
var linux_components_1 = require("./providers/image-builders/linux-components");
|
|
28
|
-
Object.defineProperty(exports, "LinuxUbuntuComponents", { enumerable: true, get: function () { return linux_components_1.LinuxUbuntuComponents; } });
|
|
29
|
-
var static_1 = require("./providers/image-builders/static");
|
|
30
|
-
Object.defineProperty(exports, "StaticRunnerImage", { enumerable: true, get: function () { return static_1.StaticRunnerImage; } });
|
|
31
|
-
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxxQ0FBb0M7QUFBM0Isa0dBQUEsT0FBTyxPQUFBO0FBQ2hCLG1DQUE2RDtBQUFwRCx1R0FBQSxhQUFhLE9BQUE7QUFDdEIsbURBQThFO0FBQXJFLDRHQUFBLGVBQW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F0aWNSdW5uZXJJbWFnZSB9IGZyb20gJy4vcHJvdmlkZXJzL2ltYWdlLWJ1aWxkZXJzL3N0YXRpYyc7XG4iXX0=
|
|
13
|
+
__exportStar(require("./secrets"), exports);
|
|
14
|
+
__exportStar(require("./runner"), exports);
|
|
15
|
+
__exportStar(require("./providers"), exports);
|
|
16
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7O0FBQUEsNENBQTBCO0FBQzFCLDJDQUF5QjtBQUN6Qiw4Q0FBNEIiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgKiBmcm9tICcuL3NlY3JldHMnO1xuZXhwb3J0ICogZnJvbSAnLi9ydW5uZXInO1xuZXhwb3J0ICogZnJvbSAnLi9wcm92aWRlcnMnO1xuIl19
|
|
@@ -61,6 +61,7 @@ async function customResourceRespond(event, responseStatus, reason, physicalReso
|
|
|
61
61
|
// src/lambdas/delete-ami/index.ts
|
|
62
62
|
var ec2 = new AWS2.EC2();
|
|
63
63
|
async function deleteAmis(launchTemplateId, stackName, builderName, deleteAll) {
|
|
64
|
+
var _a;
|
|
64
65
|
const images = await ec2.describeImages({
|
|
65
66
|
Owners: ["self"],
|
|
66
67
|
Filters: [
|
|
@@ -88,8 +89,8 @@ async function deleteAmis(launchTemplateId, stackName, builderName, deleteAll) {
|
|
|
88
89
|
}
|
|
89
90
|
const launchTemplate = launchTemplates.LaunchTemplateVersions[0];
|
|
90
91
|
imagesToDelete = imagesToDelete.filter((i) => {
|
|
91
|
-
var
|
|
92
|
-
return i.ImageId != ((
|
|
92
|
+
var _a2;
|
|
93
|
+
return i.ImageId != ((_a2 = launchTemplate.LaunchTemplateData) == null ? void 0 : _a2.ImageId);
|
|
93
94
|
});
|
|
94
95
|
imagesToDelete = imagesToDelete.filter((i) => i.CreationDate && Date.parse(i.CreationDate) < Date.now() - 1e3 * 60 * 60 * 48);
|
|
95
96
|
console.log(`${imagesToDelete.length} AMIs left after filtering by date and excluding AMI used by launch template`);
|
|
@@ -103,6 +104,14 @@ async function deleteAmis(launchTemplateId, stackName, builderName, deleteAll) {
|
|
|
103
104
|
await ec2.deregisterImage({
|
|
104
105
|
ImageId: image.ImageId
|
|
105
106
|
}).promise();
|
|
107
|
+
for (const blockMapping of image.BlockDeviceMappings ?? []) {
|
|
108
|
+
if ((_a = blockMapping.Ebs) == null ? void 0 : _a.SnapshotId) {
|
|
109
|
+
console.log(`Deleting ${blockMapping.Ebs.SnapshotId}`);
|
|
110
|
+
await ec2.deleteSnapshot({
|
|
111
|
+
SnapshotId: blockMapping.Ebs.SnapshotId
|
|
112
|
+
}).promise();
|
|
113
|
+
}
|
|
114
|
+
}
|
|
106
115
|
}
|
|
107
116
|
}
|
|
108
117
|
exports.handler = async function(event, context) {
|
|
@@ -16026,10 +16026,3 @@ exports.handler = async function(event) {
|
|
|
16026
16026
|
}
|
|
16027
16027
|
}
|
|
16028
16028
|
};
|
|
16029
|
-
/*!
|
|
16030
|
-
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
|
16031
|
-
*
|
|
16032
|
-
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
16033
|
-
* Released under the MIT License.
|
|
16034
|
-
*/
|
|
16035
|
-
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
@@ -9000,9 +9000,3 @@ exports.handler = async function(event) {
|
|
|
9000
9000
|
return response(500, `<b>Error:</b> ${e}`);
|
|
9001
9001
|
}
|
|
9002
9002
|
};
|
|
9003
|
-
/*!
|
|
9004
|
-
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
|
9005
|
-
*
|
|
9006
|
-
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
9007
|
-
* Released under the MIT License.
|
|
9008
|
-
*/
|
|
@@ -14910,10 +14910,3 @@ exports.handler = async function() {
|
|
|
14910
14910
|
}
|
|
14911
14911
|
return status;
|
|
14912
14912
|
};
|
|
14913
|
-
/*!
|
|
14914
|
-
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
|
14915
|
-
*
|
|
14916
|
-
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
14917
|
-
* Released under the MIT License.
|
|
14918
|
-
*/
|
|
14919
|
-
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
@@ -15980,10 +15980,3 @@ exports.handler = async function(event) {
|
|
|
15980
15980
|
token: response.data.token
|
|
15981
15981
|
};
|
|
15982
15982
|
};
|
|
15983
|
-
/*!
|
|
15984
|
-
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
|
|
15985
|
-
*
|
|
15986
|
-
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
15987
|
-
* Released under the MIT License.
|
|
15988
|
-
*/
|
|
15989
|
-
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|