@cloudsnorkel/cdk-github-runners 0.1.1 → 0.3.1

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.
Files changed (60) hide show
  1. package/.gitattributes +6 -1
  2. package/.jsii +1383 -218
  3. package/API.md +1199 -101
  4. package/README.md +57 -42
  5. package/demo-thumbnail.jpg +0 -0
  6. package/lib/index.d.ts +3 -2
  7. package/lib/index.js +7 -1
  8. package/lib/lambdas/build-image/index.js +121 -0
  9. package/lib/lambdas/delete-runner/index.js +12 -7
  10. package/lib/lambdas/setup/index.js +177 -66
  11. package/lib/lambdas/status/index.js +3 -2
  12. package/lib/lambdas/token-retriever/index.js +3 -2
  13. package/lib/lambdas/update-lambda/index.js +55 -0
  14. package/lib/lambdas/webhook-handler/index.js +1 -0
  15. package/lib/providers/codebuild.d.ts +32 -3
  16. package/lib/providers/codebuild.js +58 -13
  17. package/lib/providers/common.d.ts +87 -7
  18. package/lib/providers/common.js +64 -4
  19. package/lib/providers/docker-images/codebuild/linux-arm64/Dockerfile +63 -0
  20. package/lib/providers/docker-images/codebuild/{Dockerfile → linux-x64/Dockerfile} +14 -5
  21. package/lib/providers/docker-images/fargate/linux-arm64/Dockerfile +45 -0
  22. package/lib/providers/docker-images/fargate/{runner.sh → linux-arm64/runner.sh} +0 -0
  23. package/lib/providers/docker-images/fargate/{Dockerfile → linux-x64/Dockerfile} +14 -5
  24. package/lib/providers/docker-images/fargate/linux-x64/runner.sh +5 -0
  25. package/lib/providers/docker-images/lambda/linux-arm64/Dockerfile +36 -0
  26. package/lib/providers/docker-images/lambda/{runner.js → linux-arm64/runner.js} +0 -0
  27. package/lib/providers/docker-images/lambda/{runner.sh → linux-arm64/runner.sh} +0 -0
  28. package/lib/providers/docker-images/lambda/linux-x64/Dockerfile +35 -0
  29. package/lib/providers/docker-images/lambda/linux-x64/runner.js +29 -0
  30. package/lib/providers/docker-images/lambda/linux-x64/runner.sh +12 -0
  31. package/lib/providers/fargate.d.ts +46 -2
  32. package/lib/providers/fargate.js +65 -10
  33. package/lib/providers/image-builders/codebuild.d.ts +178 -0
  34. package/lib/providers/image-builders/codebuild.js +354 -0
  35. package/lib/providers/image-builders/static.d.ts +29 -0
  36. package/lib/providers/image-builders/static.js +58 -0
  37. package/lib/providers/lambda.d.ts +27 -2
  38. package/lib/providers/lambda.js +88 -9
  39. package/lib/runner.d.ts +56 -22
  40. package/lib/runner.js +38 -30
  41. package/lib/secrets.d.ts +0 -1
  42. package/lib/secrets.js +1 -1
  43. package/lib/utils.d.ts +2 -2
  44. package/lib/utils.js +14 -3
  45. package/lib/webhook.d.ts +0 -1
  46. package/lib/webhook.js +2 -1
  47. package/package.json +10 -9
  48. package/changelog.md +0 -7
  49. package/lib/index.d.ts.map +0 -1
  50. package/lib/providers/codebuild.d.ts.map +0 -1
  51. package/lib/providers/common.d.ts.map +0 -1
  52. package/lib/providers/docker-images/lambda/Dockerfile +0 -27
  53. package/lib/providers/fargate.d.ts.map +0 -1
  54. package/lib/providers/lambda.d.ts.map +0 -1
  55. package/lib/runner.d.ts.map +0 -1
  56. package/lib/secrets.d.ts.map +0 -1
  57. package/lib/utils.d.ts.map +0 -1
  58. package/lib/webhook.d.ts.map +0 -1
  59. package/releasetag.txt +0 -1
  60. package/version.txt +0 -1
package/API.md CHANGED
@@ -2,6 +2,272 @@
2
2
 
3
3
  ## Constructs <a name="Constructs" id="Constructs"></a>
4
4
 
5
+ ### CodeBuildImageBuilder <a name="CodeBuildImageBuilder" id="@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilder"></a>
6
+
7
+ - *Implements:* <a href="#@cloudsnorkel/cdk-github-runners.IImageBuilder">IImageBuilder</a>
8
+
9
+ An image builder that uses CodeBuild to build Docker images pre-baked with all the GitHub Actions runner requirements.
10
+
11
+ Builders can be used with runner providers.
12
+
13
+ Each builder re-runs automatically at a set interval to make sure the images contain the latest versions of everything.
14
+
15
+ You can create an instance of this construct to customize the image used to spin-up runners. Each provider has its own requirements for what an image should do. That's why they each provide their own Dockerfile.
16
+
17
+ For example, to set a specific runner version, rebuild the image every 2 weeks, and add a few packages for the Fargate provider, use:
18
+
19
+ ```
20
+ const builder = new CodeBuildImageBuilder(this, 'Builder', {
21
+ dockerfilePath: FargateProvider.LINUX_X64_DOCKERFILE_PATH,
22
+ runnerVersion: RunnerVersion.specific('2.293.0'),
23
+ rebuildInterval: Duration.days(14),
24
+ });
25
+ builder.setBuildArg('EXTRA_PACKAGES', 'nginx xz-utils');
26
+ new FargateProvider(this, 'Fargate provider', {
27
+ label: 'customized-fargate',
28
+ imageBuilder: builder,
29
+ });
30
+ ```
31
+
32
+ #### Initializers <a name="Initializers" id="@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilder.Initializer"></a>
33
+
34
+ ```typescript
35
+ import { CodeBuildImageBuilder } from '@cloudsnorkel/cdk-github-runners'
36
+
37
+ new CodeBuildImageBuilder(scope: Construct, id: string, props: CodeBuildImageBuilderProps)
38
+ ```
39
+
40
+ | **Name** | **Type** | **Description** |
41
+ | --- | --- | --- |
42
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilder.Initializer.parameter.scope">scope</a></code> | <code>constructs.Construct</code> | *No description.* |
43
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilder.Initializer.parameter.id">id</a></code> | <code>string</code> | *No description.* |
44
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilder.Initializer.parameter.props">props</a></code> | <code><a href="#@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilderProps">CodeBuildImageBuilderProps</a></code> | *No description.* |
45
+
46
+ ---
47
+
48
+ ##### `scope`<sup>Required</sup> <a name="scope" id="@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilder.Initializer.parameter.scope"></a>
49
+
50
+ - *Type:* constructs.Construct
51
+
52
+ ---
53
+
54
+ ##### `id`<sup>Required</sup> <a name="id" id="@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilder.Initializer.parameter.id"></a>
55
+
56
+ - *Type:* string
57
+
58
+ ---
59
+
60
+ ##### `props`<sup>Required</sup> <a name="props" id="@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilder.Initializer.parameter.props"></a>
61
+
62
+ - *Type:* <a href="#@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilderProps">CodeBuildImageBuilderProps</a>
63
+
64
+ ---
65
+
66
+ #### Methods <a name="Methods" id="Methods"></a>
67
+
68
+ | **Name** | **Description** |
69
+ | --- | --- |
70
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilder.toString">toString</a></code> | Returns a string representation of this construct. |
71
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilder.addExtraCertificates">addExtraCertificates</a></code> | Add extra trusted certificates. This helps deal with self-signed certificates for GitHub Enterprise Server. |
72
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilder.addFiles">addFiles</a></code> | Uploads a folder to the build server at a given folder name. |
73
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilder.addPolicyStatement">addPolicyStatement</a></code> | Add a policy statement to the builder to access resources required to the image build. |
74
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilder.addPostBuildCommand">addPostBuildCommand</a></code> | Adds a command that runs after `docker build` and `docker push`. |
75
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilder.addPreBuildCommand">addPreBuildCommand</a></code> | Adds a command that runs before `docker build`. |
76
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilder.bind">bind</a></code> | Called by IRunnerProvider to finalize settings and create the image builder. |
77
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilder.setBuildArg">setBuildArg</a></code> | Adds a build argument for Docker. |
78
+
79
+ ---
80
+
81
+ ##### `toString` <a name="toString" id="@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilder.toString"></a>
82
+
83
+ ```typescript
84
+ public toString(): string
85
+ ```
86
+
87
+ Returns a string representation of this construct.
88
+
89
+ ##### `addExtraCertificates` <a name="addExtraCertificates" id="@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilder.addExtraCertificates"></a>
90
+
91
+ ```typescript
92
+ public addExtraCertificates(path: string): void
93
+ ```
94
+
95
+ Add extra trusted certificates. This helps deal with self-signed certificates for GitHub Enterprise Server.
96
+
97
+ All first party Dockerfiles support this. Others may not.
98
+
99
+ ###### `path`<sup>Required</sup> <a name="path" id="@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilder.addExtraCertificates.parameter.path"></a>
100
+
101
+ - *Type:* string
102
+
103
+ path to directory containing a file called certs.pem containing all the required certificates.
104
+
105
+ ---
106
+
107
+ ##### `addFiles` <a name="addFiles" id="@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilder.addFiles"></a>
108
+
109
+ ```typescript
110
+ public addFiles(sourcePath: string, destName: string): void
111
+ ```
112
+
113
+ Uploads a folder to the build server at a given folder name.
114
+
115
+ ###### `sourcePath`<sup>Required</sup> <a name="sourcePath" id="@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilder.addFiles.parameter.sourcePath"></a>
116
+
117
+ - *Type:* string
118
+
119
+ path to source directory.
120
+
121
+ ---
122
+
123
+ ###### `destName`<sup>Required</sup> <a name="destName" id="@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilder.addFiles.parameter.destName"></a>
124
+
125
+ - *Type:* string
126
+
127
+ name of destination folder.
128
+
129
+ ---
130
+
131
+ ##### `addPolicyStatement` <a name="addPolicyStatement" id="@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilder.addPolicyStatement"></a>
132
+
133
+ ```typescript
134
+ public addPolicyStatement(statement: PolicyStatement): void
135
+ ```
136
+
137
+ Add a policy statement to the builder to access resources required to the image build.
138
+
139
+ ###### `statement`<sup>Required</sup> <a name="statement" id="@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilder.addPolicyStatement.parameter.statement"></a>
140
+
141
+ - *Type:* aws-cdk-lib.aws_iam.PolicyStatement
142
+
143
+ IAM policy statement.
144
+
145
+ ---
146
+
147
+ ##### `addPostBuildCommand` <a name="addPostBuildCommand" id="@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilder.addPostBuildCommand"></a>
148
+
149
+ ```typescript
150
+ public addPostBuildCommand(command: string): void
151
+ ```
152
+
153
+ Adds a command that runs after `docker build` and `docker push`.
154
+
155
+ ###### `command`<sup>Required</sup> <a name="command" id="@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilder.addPostBuildCommand.parameter.command"></a>
156
+
157
+ - *Type:* string
158
+
159
+ command to add.
160
+
161
+ ---
162
+
163
+ ##### `addPreBuildCommand` <a name="addPreBuildCommand" id="@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilder.addPreBuildCommand"></a>
164
+
165
+ ```typescript
166
+ public addPreBuildCommand(command: string): void
167
+ ```
168
+
169
+ Adds a command that runs before `docker build`.
170
+
171
+ ###### `command`<sup>Required</sup> <a name="command" id="@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilder.addPreBuildCommand.parameter.command"></a>
172
+
173
+ - *Type:* string
174
+
175
+ command to add.
176
+
177
+ ---
178
+
179
+ ##### `bind` <a name="bind" id="@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilder.bind"></a>
180
+
181
+ ```typescript
182
+ public bind(): RunnerImage
183
+ ```
184
+
185
+ Called by IRunnerProvider to finalize settings and create the image builder.
186
+
187
+ ##### `setBuildArg` <a name="setBuildArg" id="@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilder.setBuildArg"></a>
188
+
189
+ ```typescript
190
+ public setBuildArg(name: string, value: string): void
191
+ ```
192
+
193
+ Adds a build argument for Docker.
194
+
195
+ See the documentation for the Dockerfile you're using for a list of supported build arguments.
196
+
197
+ ###### `name`<sup>Required</sup> <a name="name" id="@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilder.setBuildArg.parameter.name"></a>
198
+
199
+ - *Type:* string
200
+
201
+ build argument name.
202
+
203
+ ---
204
+
205
+ ###### `value`<sup>Required</sup> <a name="value" id="@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilder.setBuildArg.parameter.value"></a>
206
+
207
+ - *Type:* string
208
+
209
+ build argument value.
210
+
211
+ ---
212
+
213
+ #### Static Functions <a name="Static Functions" id="Static Functions"></a>
214
+
215
+ | **Name** | **Description** |
216
+ | --- | --- |
217
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilder.isConstruct">isConstruct</a></code> | Checks if `x` is a construct. |
218
+
219
+ ---
220
+
221
+ ##### ~~`isConstruct`~~ <a name="isConstruct" id="@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilder.isConstruct"></a>
222
+
223
+ ```typescript
224
+ import { CodeBuildImageBuilder } from '@cloudsnorkel/cdk-github-runners'
225
+
226
+ CodeBuildImageBuilder.isConstruct(x: any)
227
+ ```
228
+
229
+ Checks if `x` is a construct.
230
+
231
+ ###### `x`<sup>Required</sup> <a name="x" id="@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilder.isConstruct.parameter.x"></a>
232
+
233
+ - *Type:* any
234
+
235
+ Any object.
236
+
237
+ ---
238
+
239
+ #### Properties <a name="Properties" id="Properties"></a>
240
+
241
+ | **Name** | **Type** | **Description** |
242
+ | --- | --- | --- |
243
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilder.property.node">node</a></code> | <code>constructs.Node</code> | The tree node. |
244
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilder.property.props">props</a></code> | <code><a href="#@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilderProps">CodeBuildImageBuilderProps</a></code> | *No description.* |
245
+
246
+ ---
247
+
248
+ ##### `node`<sup>Required</sup> <a name="node" id="@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilder.property.node"></a>
249
+
250
+ ```typescript
251
+ public readonly node: Node;
252
+ ```
253
+
254
+ - *Type:* constructs.Node
255
+
256
+ The tree node.
257
+
258
+ ---
259
+
260
+ ##### `props`<sup>Required</sup> <a name="props" id="@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilder.property.props"></a>
261
+
262
+ ```typescript
263
+ public readonly props: CodeBuildImageBuilderProps;
264
+ ```
265
+
266
+ - *Type:* <a href="#@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilderProps">CodeBuildImageBuilderProps</a>
267
+
268
+ ---
269
+
270
+
5
271
  ### CodeBuildRunner <a name="CodeBuildRunner" id="@cloudsnorkel/cdk-github-runners.CodeBuildRunner"></a>
6
272
 
7
273
  - *Implements:* <a href="#@cloudsnorkel/cdk-github-runners.IRunnerProvider">IRunnerProvider</a>
@@ -205,6 +471,58 @@ VPC used for hosting the project.
205
471
 
206
472
  ---
207
473
 
474
+ #### Constants <a name="Constants" id="Constants"></a>
475
+
476
+ | **Name** | **Type** | **Description** |
477
+ | --- | --- | --- |
478
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.CodeBuildRunner.property.LINUX_ARM64_DOCKERFILE_PATH">LINUX_ARM64_DOCKERFILE_PATH</a></code> | <code>string</code> | Path to Dockerfile for Linux ARM64 with all the requirements for CodeBuild runner. |
479
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.CodeBuildRunner.property.LINUX_X64_DOCKERFILE_PATH">LINUX_X64_DOCKERFILE_PATH</a></code> | <code>string</code> | Path to Dockerfile for Linux x64 with all the requirements for CodeBuild runner. |
480
+
481
+ ---
482
+
483
+ ##### `LINUX_ARM64_DOCKERFILE_PATH`<sup>Required</sup> <a name="LINUX_ARM64_DOCKERFILE_PATH" id="@cloudsnorkel/cdk-github-runners.CodeBuildRunner.property.LINUX_ARM64_DOCKERFILE_PATH"></a>
484
+
485
+ ```typescript
486
+ public readonly LINUX_ARM64_DOCKERFILE_PATH: string;
487
+ ```
488
+
489
+ - *Type:* string
490
+
491
+ Path to Dockerfile for Linux ARM64 with all the requirements for CodeBuild runner.
492
+
493
+ Use this Dockerfile unless you need to customize it further than allowed by hooks.
494
+
495
+ Available build arguments that can be set in the image builder:
496
+ * `BASE_IMAGE` sets the `FROM` line. This should be an Ubuntu compatible image.
497
+ * `EXTRA_PACKAGES` can be used to install additional packages.
498
+ * `DOCKER_CHANNEL` overrides the channel from which Docker will be downloaded. Defaults to `"stsable"`.
499
+ * `DIND_COMMIT` overrides the commit where dind is found.
500
+ * `DOCKER_VERSION` overrides the installed Docker version.
501
+ * `DOCKER_COMPOSE_VERSION` overrides the installed docker-compose version.
502
+
503
+ ---
504
+
505
+ ##### `LINUX_X64_DOCKERFILE_PATH`<sup>Required</sup> <a name="LINUX_X64_DOCKERFILE_PATH" id="@cloudsnorkel/cdk-github-runners.CodeBuildRunner.property.LINUX_X64_DOCKERFILE_PATH"></a>
506
+
507
+ ```typescript
508
+ public readonly LINUX_X64_DOCKERFILE_PATH: string;
509
+ ```
510
+
511
+ - *Type:* string
512
+
513
+ Path to Dockerfile for Linux x64 with all the requirements for CodeBuild runner.
514
+
515
+ Use this Dockerfile unless you need to customize it further than allowed by hooks.
516
+
517
+ Available build arguments that can be set in the image builder:
518
+ * `BASE_IMAGE` sets the `FROM` line. This should be an Ubuntu compatible image.
519
+ * `EXTRA_PACKAGES` can be used to install additional packages.
520
+ * `DOCKER_CHANNEL` overrides the channel from which Docker will be downloaded. Defaults to `"stsable"`.
521
+ * `DIND_COMMIT` overrides the commit where dind is found.
522
+ * `DOCKER_VERSION` overrides the installed Docker version.
523
+ * `DOCKER_COMPOSE_VERSION` overrides the installed docker-compose version.
524
+
525
+ ---
208
526
 
209
527
  ### FargateRunner <a name="FargateRunner" id="@cloudsnorkel/cdk-github-runners.FargateRunner"></a>
210
528
 
@@ -322,6 +640,7 @@ Any object.
322
640
  | <code><a href="#@cloudsnorkel/cdk-github-runners.FargateRunner.property.container">container</a></code> | <code>aws-cdk-lib.aws_ecs.ContainerDefinition</code> | Container definition hosting the runner. |
323
641
  | <code><a href="#@cloudsnorkel/cdk-github-runners.FargateRunner.property.grantPrincipal">grantPrincipal</a></code> | <code>aws-cdk-lib.aws_iam.IPrincipal</code> | Grant principal used to add permissions to the runner role. |
324
642
  | <code><a href="#@cloudsnorkel/cdk-github-runners.FargateRunner.property.label">label</a></code> | <code>string</code> | Label associated with this provider. |
643
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.FargateRunner.property.spot">spot</a></code> | <code>boolean</code> | Use spot pricing for Fargate tasks. |
325
644
  | <code><a href="#@cloudsnorkel/cdk-github-runners.FargateRunner.property.task">task</a></code> | <code>aws-cdk-lib.aws_ecs.FargateTaskDefinition</code> | Fargate task hosting the runner. |
326
645
  | <code><a href="#@cloudsnorkel/cdk-github-runners.FargateRunner.property.securityGroup">securityGroup</a></code> | <code>aws-cdk-lib.aws_ec2.ISecurityGroup</code> | Security group attached to the task. |
327
646
  | <code><a href="#@cloudsnorkel/cdk-github-runners.FargateRunner.property.vpc">vpc</a></code> | <code>aws-cdk-lib.aws_ec2.IVpc</code> | VPC used for hosting the task. |
@@ -412,6 +731,18 @@ Label associated with this provider.
412
731
 
413
732
  ---
414
733
 
734
+ ##### `spot`<sup>Required</sup> <a name="spot" id="@cloudsnorkel/cdk-github-runners.FargateRunner.property.spot"></a>
735
+
736
+ ```typescript
737
+ public readonly spot: boolean;
738
+ ```
739
+
740
+ - *Type:* boolean
741
+
742
+ Use spot pricing for Fargate tasks.
743
+
744
+ ---
745
+
415
746
  ##### `task`<sup>Required</sup> <a name="task" id="@cloudsnorkel/cdk-github-runners.FargateRunner.property.task"></a>
416
747
 
417
748
  ```typescript
@@ -448,6 +779,50 @@ VPC used for hosting the task.
448
779
 
449
780
  ---
450
781
 
782
+ #### Constants <a name="Constants" id="Constants"></a>
783
+
784
+ | **Name** | **Type** | **Description** |
785
+ | --- | --- | --- |
786
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.FargateRunner.property.LINUX_ARM64_DOCKERFILE_PATH">LINUX_ARM64_DOCKERFILE_PATH</a></code> | <code>string</code> | Path to Dockerfile for Linux ARM64 with all the requirement for Fargate runner. |
787
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.FargateRunner.property.LINUX_X64_DOCKERFILE_PATH">LINUX_X64_DOCKERFILE_PATH</a></code> | <code>string</code> | Path to Dockerfile for Linux x64 with all the requirement for Fargate runner. |
788
+
789
+ ---
790
+
791
+ ##### `LINUX_ARM64_DOCKERFILE_PATH`<sup>Required</sup> <a name="LINUX_ARM64_DOCKERFILE_PATH" id="@cloudsnorkel/cdk-github-runners.FargateRunner.property.LINUX_ARM64_DOCKERFILE_PATH"></a>
792
+
793
+ ```typescript
794
+ public readonly LINUX_ARM64_DOCKERFILE_PATH: string;
795
+ ```
796
+
797
+ - *Type:* string
798
+
799
+ Path to Dockerfile for Linux ARM64 with all the requirement for Fargate runner.
800
+
801
+ Use this Dockerfile unless you need to customize it further than allowed by hooks.
802
+
803
+ Available build arguments that can be set in the image builder:
804
+ * `BASE_IMAGE` sets the `FROM` line. This should be an Ubuntu compatible image.
805
+ * `EXTRA_PACKAGES` can be used to install additional packages.
806
+
807
+ ---
808
+
809
+ ##### `LINUX_X64_DOCKERFILE_PATH`<sup>Required</sup> <a name="LINUX_X64_DOCKERFILE_PATH" id="@cloudsnorkel/cdk-github-runners.FargateRunner.property.LINUX_X64_DOCKERFILE_PATH"></a>
810
+
811
+ ```typescript
812
+ public readonly LINUX_X64_DOCKERFILE_PATH: string;
813
+ ```
814
+
815
+ - *Type:* string
816
+
817
+ Path to Dockerfile for Linux x64 with all the requirement for Fargate runner.
818
+
819
+ Use this Dockerfile unless you need to customize it further than allowed by hooks.
820
+
821
+ Available build arguments that can be set in the image builder:
822
+ * `BASE_IMAGE` sets the `FROM` line. This should be an Ubuntu compatible image.
823
+ * `EXTRA_PACKAGES` can be used to install additional packages.
824
+
825
+ ---
451
826
 
452
827
  ### GitHubRunners <a name="GitHubRunners" id="@cloudsnorkel/cdk-github-runners.GitHubRunners"></a>
453
828
 
@@ -458,20 +833,20 @@ It creates a webhook, secrets, and a step function to orchestrate all runs. Secr
458
833
  By default, this will create a runner provider of each available type with the defaults. This is good enough for the initial setup stage when you just want to get GitHub integration working.
459
834
 
460
835
  ```typescript
461
- new GitHubRunners(stack, 'runners', {});
836
+ new GitHubRunners(this, 'runners');
462
837
  ```
463
838
 
464
839
  Usually you'd want to configure the runner providers so the runners can run in a certain VPC or have certain permissions.
465
840
 
466
841
  ```typescript
467
- const vpc = ec2.Vpc.fromLookup(stack, 'vpc', { vpcId: 'vpc-1234567' });
468
- const runnerSg = new ec2.SecurityGroup(stack, 'runner security group', { vpc: vpc });
469
- const dbSg = ec2.SecurityGroup.fromSecurityGroupId(stack, 'database security group', 'sg-1234567');
470
- const bucket = new s3.Bucket(stack, 'runner bucket');
842
+ const vpc = ec2.Vpc.fromLookup(this, 'vpc', { vpcId: 'vpc-1234567' });
843
+ const runnerSg = new ec2.SecurityGroup(this, 'runner security group', { vpc: vpc });
844
+ const dbSg = ec2.SecurityGroup.fromSecurityGroupId(this, 'database security group', 'sg-1234567');
845
+ const bucket = new s3.Bucket(this, 'runner bucket');
471
846
 
472
847
  // create a custom CodeBuild provider
473
848
  const myProvider = new CodeBuildRunner(
474
- stack, 'codebuild runner',
849
+ this, 'codebuild runner',
475
850
  {
476
851
  label: 'my-codebuild',
477
852
  vpc: vpc,
@@ -484,11 +859,10 @@ dbSg.connections.allowFrom(runnerSg, ec2.Port.tcp(3306), 'allow runners to conne
484
859
 
485
860
  // create the runner infrastructure
486
861
  new GitHubRunners(
487
- stack,
862
+ this,
488
863
  'runners',
489
864
  {
490
865
  providers: [myProvider],
491
- defaultProviderLabel: 'my-codebuild',
492
866
  }
493
867
  );
494
868
  ```
@@ -498,7 +872,7 @@ new GitHubRunners(
498
872
  ```typescript
499
873
  import { GitHubRunners } from '@cloudsnorkel/cdk-github-runners'
500
874
 
501
- new GitHubRunners(scope: Construct, id: string, props: GitHubRunnersProps)
875
+ new GitHubRunners(scope: Construct, id: string, props?: GitHubRunnersProps)
502
876
  ```
503
877
 
504
878
  | **Name** | **Type** | **Description** |
@@ -521,7 +895,7 @@ new GitHubRunners(scope: Construct, id: string, props: GitHubRunnersProps)
521
895
 
522
896
  ---
523
897
 
524
- ##### `props`<sup>Required</sup> <a name="props" id="@cloudsnorkel/cdk-github-runners.GitHubRunners.Initializer.parameter.props"></a>
898
+ ##### `props`<sup>Optional</sup> <a name="props" id="@cloudsnorkel/cdk-github-runners.GitHubRunners.Initializer.parameter.props"></a>
525
899
 
526
900
  - *Type:* <a href="#@cloudsnorkel/cdk-github-runners.GitHubRunnersProps">GitHubRunnersProps</a>
527
901
 
@@ -574,8 +948,6 @@ Any object.
574
948
  | **Name** | **Type** | **Description** |
575
949
  | --- | --- | --- |
576
950
  | <code><a href="#@cloudsnorkel/cdk-github-runners.GitHubRunners.property.node">node</a></code> | <code>constructs.Node</code> | The tree node. |
577
- | <code><a href="#@cloudsnorkel/cdk-github-runners.GitHubRunners.property.defaultProvider">defaultProvider</a></code> | <code><a href="#@cloudsnorkel/cdk-github-runners.IRunnerProvider">IRunnerProvider</a></code> | Default provider as set by {@link GitHubRunnersProps.defaultProviderLabel}. |
578
- | <code><a href="#@cloudsnorkel/cdk-github-runners.GitHubRunners.property.props">props</a></code> | <code><a href="#@cloudsnorkel/cdk-github-runners.GitHubRunnersProps">GitHubRunnersProps</a></code> | *No description.* |
579
951
  | <code><a href="#@cloudsnorkel/cdk-github-runners.GitHubRunners.property.providers">providers</a></code> | <code><a href="#@cloudsnorkel/cdk-github-runners.IRunnerProvider">IRunnerProvider</a>[]</code> | Configured runner providers. |
580
952
  | <code><a href="#@cloudsnorkel/cdk-github-runners.GitHubRunners.property.secrets">secrets</a></code> | <code><a href="#@cloudsnorkel/cdk-github-runners.Secrets">Secrets</a></code> | Secrets for GitHub communication including webhook secret and runner authentication. |
581
953
 
@@ -593,49 +965,27 @@ The tree node.
593
965
 
594
966
  ---
595
967
 
596
- ##### `defaultProvider`<sup>Required</sup> <a name="defaultProvider" id="@cloudsnorkel/cdk-github-runners.GitHubRunners.property.defaultProvider"></a>
968
+ ##### `providers`<sup>Required</sup> <a name="providers" id="@cloudsnorkel/cdk-github-runners.GitHubRunners.property.providers"></a>
597
969
 
598
970
  ```typescript
599
- public readonly defaultProvider: IRunnerProvider;
971
+ public readonly providers: IRunnerProvider[];
600
972
  ```
601
973
 
602
- - *Type:* <a href="#@cloudsnorkel/cdk-github-runners.IRunnerProvider">IRunnerProvider</a>
974
+ - *Type:* <a href="#@cloudsnorkel/cdk-github-runners.IRunnerProvider">IRunnerProvider</a>[]
603
975
 
604
- Default provider as set by {@link GitHubRunnersProps.defaultProviderLabel}.
976
+ Configured runner providers.
605
977
 
606
978
  ---
607
979
 
608
- ##### `props`<sup>Required</sup> <a name="props" id="@cloudsnorkel/cdk-github-runners.GitHubRunners.property.props"></a>
980
+ ##### `secrets`<sup>Required</sup> <a name="secrets" id="@cloudsnorkel/cdk-github-runners.GitHubRunners.property.secrets"></a>
609
981
 
610
982
  ```typescript
611
- public readonly props: GitHubRunnersProps;
983
+ public readonly secrets: Secrets;
612
984
  ```
613
985
 
614
- - *Type:* <a href="#@cloudsnorkel/cdk-github-runners.GitHubRunnersProps">GitHubRunnersProps</a>
615
-
616
- ---
617
-
618
- ##### `providers`<sup>Required</sup> <a name="providers" id="@cloudsnorkel/cdk-github-runners.GitHubRunners.property.providers"></a>
619
-
620
- ```typescript
621
- public readonly providers: IRunnerProvider[];
622
- ```
623
-
624
- - *Type:* <a href="#@cloudsnorkel/cdk-github-runners.IRunnerProvider">IRunnerProvider</a>[]
625
-
626
- Configured runner providers.
627
-
628
- ---
629
-
630
- ##### `secrets`<sup>Required</sup> <a name="secrets" id="@cloudsnorkel/cdk-github-runners.GitHubRunners.property.secrets"></a>
631
-
632
- ```typescript
633
- public readonly secrets: Secrets;
634
- ```
635
-
636
- - *Type:* <a href="#@cloudsnorkel/cdk-github-runners.Secrets">Secrets</a>
637
-
638
- Secrets for GitHub communication including webhook secret and runner authentication.
986
+ - *Type:* <a href="#@cloudsnorkel/cdk-github-runners.Secrets">Secrets</a>
987
+
988
+ Secrets for GitHub communication including webhook secret and runner authentication.
639
989
 
640
990
  ---
641
991
 
@@ -843,6 +1193,50 @@ VPC used for hosting the function.
843
1193
 
844
1194
  ---
845
1195
 
1196
+ #### Constants <a name="Constants" id="Constants"></a>
1197
+
1198
+ | **Name** | **Type** | **Description** |
1199
+ | --- | --- | --- |
1200
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.LambdaRunner.property.LINUX_ARM64_DOCKERFILE_PATH">LINUX_ARM64_DOCKERFILE_PATH</a></code> | <code>string</code> | Path to Dockerfile for Linux ARM64 with all the requirement for Lambda runner. |
1201
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.LambdaRunner.property.LINUX_X64_DOCKERFILE_PATH">LINUX_X64_DOCKERFILE_PATH</a></code> | <code>string</code> | Path to Dockerfile for Linux x64 with all the requirement for Lambda runner. |
1202
+
1203
+ ---
1204
+
1205
+ ##### `LINUX_ARM64_DOCKERFILE_PATH`<sup>Required</sup> <a name="LINUX_ARM64_DOCKERFILE_PATH" id="@cloudsnorkel/cdk-github-runners.LambdaRunner.property.LINUX_ARM64_DOCKERFILE_PATH"></a>
1206
+
1207
+ ```typescript
1208
+ public readonly LINUX_ARM64_DOCKERFILE_PATH: string;
1209
+ ```
1210
+
1211
+ - *Type:* string
1212
+
1213
+ Path to Dockerfile for Linux ARM64 with all the requirement for Lambda runner.
1214
+
1215
+ Use this Dockerfile unless you need to customize it further than allowed by hooks.
1216
+
1217
+ Available build arguments that can be set in the image builder:
1218
+ * `BASE_IMAGE` sets the `FROM` line. This should be similar to public.ecr.aws/lambda/nodejs:14.
1219
+ * `EXTRA_PACKAGES` can be used to install additional packages.
1220
+
1221
+ ---
1222
+
1223
+ ##### `LINUX_X64_DOCKERFILE_PATH`<sup>Required</sup> <a name="LINUX_X64_DOCKERFILE_PATH" id="@cloudsnorkel/cdk-github-runners.LambdaRunner.property.LINUX_X64_DOCKERFILE_PATH"></a>
1224
+
1225
+ ```typescript
1226
+ public readonly LINUX_X64_DOCKERFILE_PATH: string;
1227
+ ```
1228
+
1229
+ - *Type:* string
1230
+
1231
+ Path to Dockerfile for Linux x64 with all the requirement for Lambda runner.
1232
+
1233
+ Use this Dockerfile unless you need to customize it further than allowed by hooks.
1234
+
1235
+ Available build arguments that can be set in the image builder:
1236
+ * `BASE_IMAGE` sets the `FROM` line. This should be similar to public.ecr.aws/lambda/nodejs:14.
1237
+ * `EXTRA_PACKAGES` can be used to install additional packages.
1238
+
1239
+ ---
846
1240
 
847
1241
  ### Secrets <a name="Secrets" id="@cloudsnorkel/cdk-github-runners.Secrets"></a>
848
1242
 
@@ -1001,6 +1395,211 @@ Webhook secret used to confirm events are coming from GitHub and nowhere else.
1001
1395
 
1002
1396
  ## Structs <a name="Structs" id="Structs"></a>
1003
1397
 
1398
+ ### CodeBuildImageBuilderProps <a name="CodeBuildImageBuilderProps" id="@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilderProps"></a>
1399
+
1400
+ Properties for CodeBuildImageBuilder construct.
1401
+
1402
+ #### Initializer <a name="Initializer" id="@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilderProps.Initializer"></a>
1403
+
1404
+ ```typescript
1405
+ import { CodeBuildImageBuilderProps } from '@cloudsnorkel/cdk-github-runners'
1406
+
1407
+ const codeBuildImageBuilderProps: CodeBuildImageBuilderProps = { ... }
1408
+ ```
1409
+
1410
+ #### Properties <a name="Properties" id="Properties"></a>
1411
+
1412
+ | **Name** | **Type** | **Description** |
1413
+ | --- | --- | --- |
1414
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilderProps.property.dockerfilePath">dockerfilePath</a></code> | <code>string</code> | Path to Dockerfile to be built. |
1415
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilderProps.property.architecture">architecture</a></code> | <code><a href="#@cloudsnorkel/cdk-github-runners.Architecture">Architecture</a></code> | Image architecture. |
1416
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilderProps.property.computeType">computeType</a></code> | <code>aws-cdk-lib.aws_codebuild.ComputeType</code> | The type of compute to use for this build. |
1417
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilderProps.property.logRemovalPolicy">logRemovalPolicy</a></code> | <code>aws-cdk-lib.RemovalPolicy</code> | Removal policy for logs of image builds. |
1418
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilderProps.property.logRetention">logRetention</a></code> | <code>aws-cdk-lib.aws_logs.RetentionDays</code> | The number of days log events are kept in CloudWatch Logs. |
1419
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilderProps.property.os">os</a></code> | <code><a href="#@cloudsnorkel/cdk-github-runners.Os">Os</a></code> | Image OS. |
1420
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilderProps.property.rebuildInterval">rebuildInterval</a></code> | <code>aws-cdk-lib.Duration</code> | Schedule the image to be rebuilt every given interval. |
1421
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilderProps.property.runnerVersion">runnerVersion</a></code> | <code><a href="#@cloudsnorkel/cdk-github-runners.RunnerVersion">RunnerVersion</a></code> | Version of GitHub Runners to install. |
1422
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilderProps.property.securityGroup">securityGroup</a></code> | <code>aws-cdk-lib.aws_ec2.ISecurityGroup</code> | Security Group to assign to this instance. |
1423
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilderProps.property.subnetSelection">subnetSelection</a></code> | <code>aws-cdk-lib.aws_ec2.SubnetSelection</code> | Where to place the network interfaces within the VPC. |
1424
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilderProps.property.timeout">timeout</a></code> | <code>aws-cdk-lib.Duration</code> | The number of minutes after which AWS CodeBuild stops the build if it's not complete. |
1425
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilderProps.property.vpc">vpc</a></code> | <code>aws-cdk-lib.aws_ec2.IVpc</code> | VPC to launch the runners in. |
1426
+
1427
+ ---
1428
+
1429
+ ##### `dockerfilePath`<sup>Required</sup> <a name="dockerfilePath" id="@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilderProps.property.dockerfilePath"></a>
1430
+
1431
+ ```typescript
1432
+ public readonly dockerfilePath: string;
1433
+ ```
1434
+
1435
+ - *Type:* string
1436
+
1437
+ Path to Dockerfile to be built.
1438
+
1439
+ It can be a path to a Dockerfile, a folder containing a Dockerfile, or a zip file containing a Dockerfile.
1440
+
1441
+ ---
1442
+
1443
+ ##### `architecture`<sup>Optional</sup> <a name="architecture" id="@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilderProps.property.architecture"></a>
1444
+
1445
+ ```typescript
1446
+ public readonly architecture: Architecture;
1447
+ ```
1448
+
1449
+ - *Type:* <a href="#@cloudsnorkel/cdk-github-runners.Architecture">Architecture</a>
1450
+ - *Default:* Architecture.X86_64
1451
+
1452
+ Image architecture.
1453
+
1454
+ ---
1455
+
1456
+ ##### `computeType`<sup>Optional</sup> <a name="computeType" id="@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilderProps.property.computeType"></a>
1457
+
1458
+ ```typescript
1459
+ public readonly computeType: ComputeType;
1460
+ ```
1461
+
1462
+ - *Type:* aws-cdk-lib.aws_codebuild.ComputeType
1463
+ - *Default:* {@link ComputeType#SMALL}
1464
+
1465
+ The type of compute to use for this build.
1466
+
1467
+ See the {@link ComputeType} enum for the possible values.
1468
+
1469
+ ---
1470
+
1471
+ ##### `logRemovalPolicy`<sup>Optional</sup> <a name="logRemovalPolicy" id="@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilderProps.property.logRemovalPolicy"></a>
1472
+
1473
+ ```typescript
1474
+ public readonly logRemovalPolicy: RemovalPolicy;
1475
+ ```
1476
+
1477
+ - *Type:* aws-cdk-lib.RemovalPolicy
1478
+ - *Default:* RemovalPolicy.DESTROY
1479
+
1480
+ Removal policy for logs of image builds.
1481
+
1482
+ If deployment fails on the custom resource, try setting this to `RemovalPolicy.RETAIN`. This way the CodeBuild logs can still be viewed, and you can see why the build failed.
1483
+
1484
+ We try to not leave anything behind when removed. But sometimes a log staying behind is useful.
1485
+
1486
+ ---
1487
+
1488
+ ##### `logRetention`<sup>Optional</sup> <a name="logRetention" id="@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilderProps.property.logRetention"></a>
1489
+
1490
+ ```typescript
1491
+ public readonly logRetention: RetentionDays;
1492
+ ```
1493
+
1494
+ - *Type:* aws-cdk-lib.aws_logs.RetentionDays
1495
+ - *Default:* logs.RetentionDays.ONE_MONTH
1496
+
1497
+ The number of days log events are kept in CloudWatch Logs.
1498
+
1499
+ When updating
1500
+ this property, unsetting it doesn't remove the log retention policy. To
1501
+ remove the retention policy, set the value to `INFINITE`.
1502
+
1503
+ ---
1504
+
1505
+ ##### `os`<sup>Optional</sup> <a name="os" id="@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilderProps.property.os"></a>
1506
+
1507
+ ```typescript
1508
+ public readonly os: Os;
1509
+ ```
1510
+
1511
+ - *Type:* <a href="#@cloudsnorkel/cdk-github-runners.Os">Os</a>
1512
+ - *Default:* OS.LINUX
1513
+
1514
+ Image OS.
1515
+
1516
+ ---
1517
+
1518
+ ##### `rebuildInterval`<sup>Optional</sup> <a name="rebuildInterval" id="@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilderProps.property.rebuildInterval"></a>
1519
+
1520
+ ```typescript
1521
+ public readonly rebuildInterval: Duration;
1522
+ ```
1523
+
1524
+ - *Type:* aws-cdk-lib.Duration
1525
+ - *Default:* Duration.days(7)
1526
+
1527
+ Schedule the image to be rebuilt every given interval.
1528
+
1529
+ Useful for keeping the image up-do-date with the latest GitHub runner version and latest OS updates.
1530
+
1531
+ Set to zero to disable.
1532
+
1533
+ ---
1534
+
1535
+ ##### `runnerVersion`<sup>Optional</sup> <a name="runnerVersion" id="@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilderProps.property.runnerVersion"></a>
1536
+
1537
+ ```typescript
1538
+ public readonly runnerVersion: RunnerVersion;
1539
+ ```
1540
+
1541
+ - *Type:* <a href="#@cloudsnorkel/cdk-github-runners.RunnerVersion">RunnerVersion</a>
1542
+ - *Default:* latest version available
1543
+
1544
+ Version of GitHub Runners to install.
1545
+
1546
+ ---
1547
+
1548
+ ##### `securityGroup`<sup>Optional</sup> <a name="securityGroup" id="@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilderProps.property.securityGroup"></a>
1549
+
1550
+ ```typescript
1551
+ public readonly securityGroup: ISecurityGroup;
1552
+ ```
1553
+
1554
+ - *Type:* aws-cdk-lib.aws_ec2.ISecurityGroup
1555
+ - *Default:* public project with no security group
1556
+
1557
+ Security Group to assign to this instance.
1558
+
1559
+ ---
1560
+
1561
+ ##### `subnetSelection`<sup>Optional</sup> <a name="subnetSelection" id="@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilderProps.property.subnetSelection"></a>
1562
+
1563
+ ```typescript
1564
+ public readonly subnetSelection: SubnetSelection;
1565
+ ```
1566
+
1567
+ - *Type:* aws-cdk-lib.aws_ec2.SubnetSelection
1568
+ - *Default:* no subnet
1569
+
1570
+ Where to place the network interfaces within the VPC.
1571
+
1572
+ ---
1573
+
1574
+ ##### `timeout`<sup>Optional</sup> <a name="timeout" id="@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilderProps.property.timeout"></a>
1575
+
1576
+ ```typescript
1577
+ public readonly timeout: Duration;
1578
+ ```
1579
+
1580
+ - *Type:* aws-cdk-lib.Duration
1581
+ - *Default:* Duration.hours(1)
1582
+
1583
+ The number of minutes after which AWS CodeBuild stops the build if it's not complete.
1584
+
1585
+ For valid values, see the timeoutInMinutes field in the AWS
1586
+ CodeBuild User Guide.
1587
+
1588
+ ---
1589
+
1590
+ ##### `vpc`<sup>Optional</sup> <a name="vpc" id="@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilderProps.property.vpc"></a>
1591
+
1592
+ ```typescript
1593
+ public readonly vpc: IVpc;
1594
+ ```
1595
+
1596
+ - *Type:* aws-cdk-lib.aws_ec2.IVpc
1597
+ - *Default:* no VPC
1598
+
1599
+ VPC to launch the runners in.
1600
+
1601
+ ---
1602
+
1004
1603
  ### CodeBuildRunnerProps <a name="CodeBuildRunnerProps" id="@cloudsnorkel/cdk-github-runners.CodeBuildRunnerProps"></a>
1005
1604
 
1006
1605
  #### Initializer <a name="Initializer" id="@cloudsnorkel/cdk-github-runners.CodeBuildRunnerProps.Initializer"></a>
@@ -1016,8 +1615,8 @@ const codeBuildRunnerProps: CodeBuildRunnerProps = { ... }
1016
1615
  | **Name** | **Type** | **Description** |
1017
1616
  | --- | --- | --- |
1018
1617
  | <code><a href="#@cloudsnorkel/cdk-github-runners.CodeBuildRunnerProps.property.logRetention">logRetention</a></code> | <code>aws-cdk-lib.aws_logs.RetentionDays</code> | The number of days log events are kept in CloudWatch Logs. |
1019
- | <code><a href="#@cloudsnorkel/cdk-github-runners.CodeBuildRunnerProps.property.runnerVersion">runnerVersion</a></code> | <code><a href="#@cloudsnorkel/cdk-github-runners.RunnerVersion">RunnerVersion</a></code> | Version of GitHub Runners to install. |
1020
1618
  | <code><a href="#@cloudsnorkel/cdk-github-runners.CodeBuildRunnerProps.property.computeType">computeType</a></code> | <code>aws-cdk-lib.aws_codebuild.ComputeType</code> | The type of compute to use for this build. |
1619
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.CodeBuildRunnerProps.property.imageBuilder">imageBuilder</a></code> | <code><a href="#@cloudsnorkel/cdk-github-runners.IImageBuilder">IImageBuilder</a></code> | Provider running an image to run inside CodeBuild with GitHub runner pre-configured. |
1021
1620
  | <code><a href="#@cloudsnorkel/cdk-github-runners.CodeBuildRunnerProps.property.label">label</a></code> | <code>string</code> | GitHub Actions label used for this provider. |
1022
1621
  | <code><a href="#@cloudsnorkel/cdk-github-runners.CodeBuildRunnerProps.property.securityGroup">securityGroup</a></code> | <code>aws-cdk-lib.aws_ec2.ISecurityGroup</code> | Security Group to assign to this instance. |
1023
1622
  | <code><a href="#@cloudsnorkel/cdk-github-runners.CodeBuildRunnerProps.property.subnetSelection">subnetSelection</a></code> | <code>aws-cdk-lib.aws_ec2.SubnetSelection</code> | Where to place the network interfaces within the VPC. |
@@ -1043,31 +1642,33 @@ remove the retention policy, set the value to `INFINITE`.
1043
1642
 
1044
1643
  ---
1045
1644
 
1046
- ##### `runnerVersion`<sup>Optional</sup> <a name="runnerVersion" id="@cloudsnorkel/cdk-github-runners.CodeBuildRunnerProps.property.runnerVersion"></a>
1645
+ ##### `computeType`<sup>Optional</sup> <a name="computeType" id="@cloudsnorkel/cdk-github-runners.CodeBuildRunnerProps.property.computeType"></a>
1047
1646
 
1048
1647
  ```typescript
1049
- public readonly runnerVersion: RunnerVersion;
1648
+ public readonly computeType: ComputeType;
1050
1649
  ```
1051
1650
 
1052
- - *Type:* <a href="#@cloudsnorkel/cdk-github-runners.RunnerVersion">RunnerVersion</a>
1053
- - *Default:* latest version available
1651
+ - *Type:* aws-cdk-lib.aws_codebuild.ComputeType
1652
+ - *Default:* {@link ComputeType#SMALL}
1054
1653
 
1055
- Version of GitHub Runners to install.
1654
+ The type of compute to use for this build.
1655
+
1656
+ See the {@link ComputeType} enum for the possible values.
1056
1657
 
1057
1658
  ---
1058
1659
 
1059
- ##### `computeType`<sup>Optional</sup> <a name="computeType" id="@cloudsnorkel/cdk-github-runners.CodeBuildRunnerProps.property.computeType"></a>
1660
+ ##### `imageBuilder`<sup>Optional</sup> <a name="imageBuilder" id="@cloudsnorkel/cdk-github-runners.CodeBuildRunnerProps.property.imageBuilder"></a>
1060
1661
 
1061
1662
  ```typescript
1062
- public readonly computeType: ComputeType;
1663
+ public readonly imageBuilder: IImageBuilder;
1063
1664
  ```
1064
1665
 
1065
- - *Type:* aws-cdk-lib.aws_codebuild.ComputeType
1066
- - *Default:* {@link ComputeType#SMALL}
1666
+ - *Type:* <a href="#@cloudsnorkel/cdk-github-runners.IImageBuilder">IImageBuilder</a>
1667
+ - *Default:* image builder with `CodeBuildRunner.LINUX_X64_DOCKERFILE_PATH` as Dockerfile
1067
1668
 
1068
- The type of compute to use for this build.
1669
+ Provider running an image to run inside CodeBuild with GitHub runner pre-configured.
1069
1670
 
1070
- See the {@link ComputeType} enum for the possible values.
1671
+ A user named `runner` is expected to exist with access to Docker-in-Docker.
1071
1672
 
1072
1673
  ---
1073
1674
 
@@ -1156,14 +1757,15 @@ const fargateRunnerProps: FargateRunnerProps = { ... }
1156
1757
  | **Name** | **Type** | **Description** |
1157
1758
  | --- | --- | --- |
1158
1759
  | <code><a href="#@cloudsnorkel/cdk-github-runners.FargateRunnerProps.property.logRetention">logRetention</a></code> | <code>aws-cdk-lib.aws_logs.RetentionDays</code> | The number of days log events are kept in CloudWatch Logs. |
1159
- | <code><a href="#@cloudsnorkel/cdk-github-runners.FargateRunnerProps.property.runnerVersion">runnerVersion</a></code> | <code><a href="#@cloudsnorkel/cdk-github-runners.RunnerVersion">RunnerVersion</a></code> | Version of GitHub Runners to install. |
1160
1760
  | <code><a href="#@cloudsnorkel/cdk-github-runners.FargateRunnerProps.property.assignPublicIp">assignPublicIp</a></code> | <code>boolean</code> | Assign public IP to the runner task. |
1161
1761
  | <code><a href="#@cloudsnorkel/cdk-github-runners.FargateRunnerProps.property.cluster">cluster</a></code> | <code>aws-cdk-lib.aws_ecs.Cluster</code> | Existing Fargate cluster to use. |
1162
1762
  | <code><a href="#@cloudsnorkel/cdk-github-runners.FargateRunnerProps.property.cpu">cpu</a></code> | <code>number</code> | The number of cpu units used by the task. |
1163
1763
  | <code><a href="#@cloudsnorkel/cdk-github-runners.FargateRunnerProps.property.ephemeralStorageGiB">ephemeralStorageGiB</a></code> | <code>number</code> | The amount (in GiB) of ephemeral storage to be allocated to the task. |
1764
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.FargateRunnerProps.property.imageBuilder">imageBuilder</a></code> | <code><a href="#@cloudsnorkel/cdk-github-runners.IImageBuilder">IImageBuilder</a></code> | Provider running an image to run inside CodeBuild with GitHub runner pre-configured. |
1164
1765
  | <code><a href="#@cloudsnorkel/cdk-github-runners.FargateRunnerProps.property.label">label</a></code> | <code>string</code> | GitHub Actions label used for this provider. |
1165
1766
  | <code><a href="#@cloudsnorkel/cdk-github-runners.FargateRunnerProps.property.memoryLimitMiB">memoryLimitMiB</a></code> | <code>number</code> | The amount (in MiB) of memory used by the task. |
1166
1767
  | <code><a href="#@cloudsnorkel/cdk-github-runners.FargateRunnerProps.property.securityGroup">securityGroup</a></code> | <code>aws-cdk-lib.aws_ec2.ISecurityGroup</code> | Security Group to assign to the task. |
1768
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.FargateRunnerProps.property.spot">spot</a></code> | <code>boolean</code> | Use Fargate spot capacity provider to save money. |
1167
1769
  | <code><a href="#@cloudsnorkel/cdk-github-runners.FargateRunnerProps.property.vpc">vpc</a></code> | <code>aws-cdk-lib.aws_ec2.IVpc</code> | VPC to launch the runners in. |
1168
1770
 
1169
1771
  ---
@@ -1185,19 +1787,6 @@ remove the retention policy, set the value to `INFINITE`.
1185
1787
 
1186
1788
  ---
1187
1789
 
1188
- ##### `runnerVersion`<sup>Optional</sup> <a name="runnerVersion" id="@cloudsnorkel/cdk-github-runners.FargateRunnerProps.property.runnerVersion"></a>
1189
-
1190
- ```typescript
1191
- public readonly runnerVersion: RunnerVersion;
1192
- ```
1193
-
1194
- - *Type:* <a href="#@cloudsnorkel/cdk-github-runners.RunnerVersion">RunnerVersion</a>
1195
- - *Default:* latest version available
1196
-
1197
- Version of GitHub Runners to install.
1198
-
1199
- ---
1200
-
1201
1790
  ##### `assignPublicIp`<sup>Optional</sup> <a name="assignPublicIp" id="@cloudsnorkel/cdk-github-runners.FargateRunnerProps.property.assignPublicIp"></a>
1202
1791
 
1203
1792
  ```typescript
@@ -1270,6 +1859,31 @@ NOTE: This parameter is only supported for tasks hosted on AWS Fargate using pla
1270
1859
 
1271
1860
  ---
1272
1861
 
1862
+ ##### `imageBuilder`<sup>Optional</sup> <a name="imageBuilder" id="@cloudsnorkel/cdk-github-runners.FargateRunnerProps.property.imageBuilder"></a>
1863
+
1864
+ ```typescript
1865
+ public readonly imageBuilder: IImageBuilder;
1866
+ ```
1867
+
1868
+ - *Type:* <a href="#@cloudsnorkel/cdk-github-runners.IImageBuilder">IImageBuilder</a>
1869
+ - *Default:* image builder with `FargateRunner.LINUX_X64_DOCKERFILE_PATH` as Dockerfile
1870
+
1871
+ Provider running an image to run inside CodeBuild with GitHub runner pre-configured.
1872
+
1873
+ A user named `runner` is expected to exist.
1874
+
1875
+ The entry point should start GitHub runner. For example:
1876
+
1877
+ ```
1878
+ #!/bin/bash
1879
+ set -e -u -o pipefail
1880
+
1881
+ /home/runner/config.sh --unattended --url "https://${GITHUB_DOMAIN}/${OWNER}/${REPO}" --token "${RUNNER_TOKEN}" --ephemeral --work _work --labels "${RUNNER_LABEL}" --disableupdate --name "${RUNNER_NAME}"
1882
+ /home/runner/run.sh
1883
+ ```
1884
+
1885
+ ---
1886
+
1273
1887
  ##### `label`<sup>Optional</sup> <a name="label" id="@cloudsnorkel/cdk-github-runners.FargateRunnerProps.property.label"></a>
1274
1888
 
1275
1889
  ```typescript
@@ -1322,6 +1936,22 @@ Security Group to assign to the task.
1322
1936
 
1323
1937
  ---
1324
1938
 
1939
+ ##### `spot`<sup>Optional</sup> <a name="spot" id="@cloudsnorkel/cdk-github-runners.FargateRunnerProps.property.spot"></a>
1940
+
1941
+ ```typescript
1942
+ public readonly spot: boolean;
1943
+ ```
1944
+
1945
+ - *Type:* boolean
1946
+ - *Default:* false
1947
+
1948
+ Use Fargate spot capacity provider to save money.
1949
+
1950
+ * Runners may fail to start due to missing capacity.
1951
+ * Runners might be stopped prematurely with spot pricing.
1952
+
1953
+ ---
1954
+
1325
1955
  ##### `vpc`<sup>Optional</sup> <a name="vpc" id="@cloudsnorkel/cdk-github-runners.FargateRunnerProps.property.vpc"></a>
1326
1956
 
1327
1957
  ```typescript
@@ -1351,23 +1981,61 @@ const gitHubRunnersProps: GitHubRunnersProps = { ... }
1351
1981
 
1352
1982
  | **Name** | **Type** | **Description** |
1353
1983
  | --- | --- | --- |
1354
- | <code><a href="#@cloudsnorkel/cdk-github-runners.GitHubRunnersProps.property.defaultProviderLabel">defaultProviderLabel</a></code> | <code>string</code> | Label of default provider in case the workflow job doesn't specify any known label. |
1984
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.GitHubRunnersProps.property.allowPublicSubnet">allowPublicSubnet</a></code> | <code>boolean</code> | Allow management functions to run in public subnets. |
1985
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.GitHubRunnersProps.property.extraCertificates">extraCertificates</a></code> | <code>string</code> | Path to a directory containing a file named certs.pem containing any additional certificates required to trust GitHub Enterprise Server. Use this when GitHub Enterprise Server certificates are self-signed. |
1355
1986
  | <code><a href="#@cloudsnorkel/cdk-github-runners.GitHubRunnersProps.property.providers">providers</a></code> | <code><a href="#@cloudsnorkel/cdk-github-runners.IRunnerProvider">IRunnerProvider</a>[]</code> | List of runner providers to use. |
1987
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.GitHubRunnersProps.property.securityGroup">securityGroup</a></code> | <code>aws-cdk-lib.aws_ec2.ISecurityGroup</code> | Security group attached to all management functions. |
1988
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.GitHubRunnersProps.property.vpc">vpc</a></code> | <code>aws-cdk-lib.aws_ec2.IVpc</code> | VPC used for all management functions. |
1989
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.GitHubRunnersProps.property.vpcSubnets">vpcSubnets</a></code> | <code>aws-cdk-lib.aws_ec2.SubnetSelection</code> | VPC subnets used for all management functions. |
1356
1990
 
1357
1991
  ---
1358
1992
 
1359
- ##### `defaultProviderLabel`<sup>Optional</sup> <a name="defaultProviderLabel" id="@cloudsnorkel/cdk-github-runners.GitHubRunnersProps.property.defaultProviderLabel"></a>
1993
+ ##### `allowPublicSubnet`<sup>Optional</sup> <a name="allowPublicSubnet" id="@cloudsnorkel/cdk-github-runners.GitHubRunnersProps.property.allowPublicSubnet"></a>
1360
1994
 
1361
1995
  ```typescript
1362
- public readonly defaultProviderLabel: string;
1996
+ public readonly allowPublicSubnet: boolean;
1363
1997
  ```
1364
1998
 
1365
- - *Type:* string
1366
- - *Default:* 'codebuild'
1999
+ - *Type:* boolean
2000
+ - *Default:* false
1367
2001
 
1368
- Label of default provider in case the workflow job doesn't specify any known label.
2002
+ Allow management functions to run in public subnets.
1369
2003
 
1370
- A provider with that label must be configured.
2004
+ Lambda Functions in a public subnet can NOT access the internet.
2005
+
2006
+ ---
2007
+
2008
+ ##### `extraCertificates`<sup>Optional</sup> <a name="extraCertificates" id="@cloudsnorkel/cdk-github-runners.GitHubRunnersProps.property.extraCertificates"></a>
2009
+
2010
+ ```typescript
2011
+ public readonly extraCertificates: string;
2012
+ ```
2013
+
2014
+ - *Type:* string
2015
+
2016
+ Path to a directory containing a file named certs.pem containing any additional certificates required to trust GitHub Enterprise Server. Use this when GitHub Enterprise Server certificates are self-signed.
2017
+
2018
+ You may also want to use custom images for your runner providers that contain the same certificates. See {@link CodeBuildImageBuilder.addCertificates}.
2019
+
2020
+ ```typescript
2021
+ const imageBuilder = new CodeBuildImageBuilder(this, 'Image Builder with Certs', {
2022
+ dockerfilePath: CodeBuildRunner.LINUX_X64_DOCKERFILE_PATH,
2023
+ });
2024
+ imageBuilder.addExtraCertificates('path-to-my-extra-certs-folder');
2025
+
2026
+ const provider = new CodeBuildRunner(this, 'CodeBuild', {
2027
+ imageBuilder: imageBuilder,
2028
+ });
2029
+
2030
+ new GitHubRunners(
2031
+ this,
2032
+ 'runners',
2033
+ {
2034
+ providers: [provider],
2035
+ extraCertificates: 'path-to-my-extra-certs-folder',
2036
+ }
2037
+ );
2038
+ ```
1371
2039
 
1372
2040
  ---
1373
2041
 
@@ -1386,6 +2054,48 @@ At least one provider is required. Provider will be selected when its label matc
1386
2054
 
1387
2055
  ---
1388
2056
 
2057
+ ##### `securityGroup`<sup>Optional</sup> <a name="securityGroup" id="@cloudsnorkel/cdk-github-runners.GitHubRunnersProps.property.securityGroup"></a>
2058
+
2059
+ ```typescript
2060
+ public readonly securityGroup: ISecurityGroup;
2061
+ ```
2062
+
2063
+ - *Type:* aws-cdk-lib.aws_ec2.ISecurityGroup
2064
+
2065
+ Security group attached to all management functions.
2066
+
2067
+ Use this with to provide access to GitHub Enterprise Server hosted inside a VPC.
2068
+
2069
+ ---
2070
+
2071
+ ##### `vpc`<sup>Optional</sup> <a name="vpc" id="@cloudsnorkel/cdk-github-runners.GitHubRunnersProps.property.vpc"></a>
2072
+
2073
+ ```typescript
2074
+ public readonly vpc: IVpc;
2075
+ ```
2076
+
2077
+ - *Type:* aws-cdk-lib.aws_ec2.IVpc
2078
+
2079
+ VPC used for all management functions.
2080
+
2081
+ Use this with GitHub Enterprise Server hosted that's inaccessible from outside the VPC.
2082
+
2083
+ ---
2084
+
2085
+ ##### `vpcSubnets`<sup>Optional</sup> <a name="vpcSubnets" id="@cloudsnorkel/cdk-github-runners.GitHubRunnersProps.property.vpcSubnets"></a>
2086
+
2087
+ ```typescript
2088
+ public readonly vpcSubnets: SubnetSelection;
2089
+ ```
2090
+
2091
+ - *Type:* aws-cdk-lib.aws_ec2.SubnetSelection
2092
+
2093
+ VPC subnets used for all management functions.
2094
+
2095
+ Use this with GitHub Enterprise Server hosted that's inaccessible from outside the VPC.
2096
+
2097
+ ---
2098
+
1389
2099
  ### LambdaRunnerProps <a name="LambdaRunnerProps" id="@cloudsnorkel/cdk-github-runners.LambdaRunnerProps"></a>
1390
2100
 
1391
2101
  #### Initializer <a name="Initializer" id="@cloudsnorkel/cdk-github-runners.LambdaRunnerProps.Initializer"></a>
@@ -1401,8 +2111,8 @@ const lambdaRunnerProps: LambdaRunnerProps = { ... }
1401
2111
  | **Name** | **Type** | **Description** |
1402
2112
  | --- | --- | --- |
1403
2113
  | <code><a href="#@cloudsnorkel/cdk-github-runners.LambdaRunnerProps.property.logRetention">logRetention</a></code> | <code>aws-cdk-lib.aws_logs.RetentionDays</code> | The number of days log events are kept in CloudWatch Logs. |
1404
- | <code><a href="#@cloudsnorkel/cdk-github-runners.LambdaRunnerProps.property.runnerVersion">runnerVersion</a></code> | <code><a href="#@cloudsnorkel/cdk-github-runners.RunnerVersion">RunnerVersion</a></code> | Version of GitHub Runners to install. |
1405
2114
  | <code><a href="#@cloudsnorkel/cdk-github-runners.LambdaRunnerProps.property.ephemeralStorageSize">ephemeralStorageSize</a></code> | <code>aws-cdk-lib.Size</code> | The size of the function’s /tmp directory in MiB. |
2115
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.LambdaRunnerProps.property.imageBuilder">imageBuilder</a></code> | <code><a href="#@cloudsnorkel/cdk-github-runners.IImageBuilder">IImageBuilder</a></code> | Provider running an image to run inside CodeBuild with GitHub runner pre-configured. |
1406
2116
  | <code><a href="#@cloudsnorkel/cdk-github-runners.LambdaRunnerProps.property.label">label</a></code> | <code>string</code> | GitHub Actions label used for this provider. |
1407
2117
  | <code><a href="#@cloudsnorkel/cdk-github-runners.LambdaRunnerProps.property.memorySize">memorySize</a></code> | <code>number</code> | The amount of memory, in MB, that is allocated to your Lambda function. |
1408
2118
  | <code><a href="#@cloudsnorkel/cdk-github-runners.LambdaRunnerProps.property.securityGroup">securityGroup</a></code> | <code>aws-cdk-lib.aws_ec2.ISecurityGroup</code> | Security Group to assign to this instance. |
@@ -1429,29 +2139,33 @@ remove the retention policy, set the value to `INFINITE`.
1429
2139
 
1430
2140
  ---
1431
2141
 
1432
- ##### `runnerVersion`<sup>Optional</sup> <a name="runnerVersion" id="@cloudsnorkel/cdk-github-runners.LambdaRunnerProps.property.runnerVersion"></a>
2142
+ ##### `ephemeralStorageSize`<sup>Optional</sup> <a name="ephemeralStorageSize" id="@cloudsnorkel/cdk-github-runners.LambdaRunnerProps.property.ephemeralStorageSize"></a>
1433
2143
 
1434
2144
  ```typescript
1435
- public readonly runnerVersion: RunnerVersion;
2145
+ public readonly ephemeralStorageSize: Size;
1436
2146
  ```
1437
2147
 
1438
- - *Type:* <a href="#@cloudsnorkel/cdk-github-runners.RunnerVersion">RunnerVersion</a>
1439
- - *Default:* latest version available
2148
+ - *Type:* aws-cdk-lib.Size
2149
+ - *Default:* 10 GiB
1440
2150
 
1441
- Version of GitHub Runners to install.
2151
+ The size of the function’s /tmp directory in MiB.
1442
2152
 
1443
2153
  ---
1444
2154
 
1445
- ##### `ephemeralStorageSize`<sup>Optional</sup> <a name="ephemeralStorageSize" id="@cloudsnorkel/cdk-github-runners.LambdaRunnerProps.property.ephemeralStorageSize"></a>
2155
+ ##### `imageBuilder`<sup>Optional</sup> <a name="imageBuilder" id="@cloudsnorkel/cdk-github-runners.LambdaRunnerProps.property.imageBuilder"></a>
1446
2156
 
1447
2157
  ```typescript
1448
- public readonly ephemeralStorageSize: Size;
2158
+ public readonly imageBuilder: IImageBuilder;
1449
2159
  ```
1450
2160
 
1451
- - *Type:* aws-cdk-lib.Size
1452
- - *Default:* 10 GiB
2161
+ - *Type:* <a href="#@cloudsnorkel/cdk-github-runners.IImageBuilder">IImageBuilder</a>
2162
+ - *Default:* image builder with LambdaRunner.LINUX_X64_DOCKERFILE_PATH as Dockerfile
1453
2163
 
1454
- The size of the function’s /tmp directory in MiB.
2164
+ Provider running an image to run inside CodeBuild with GitHub runner pre-configured.
2165
+
2166
+ The default command (`CMD`) should be `["runner.handler"]` which points to an included `runner.js` with a function named `handler`. The function should start the GitHub runner.
2167
+
2168
+ > [https://github.com/CloudSnorkel/cdk-github-runners/tree/main/src/providers/docker-images/lambda](https://github.com/CloudSnorkel/cdk-github-runners/tree/main/src/providers/docker-images/lambda)
1455
2169
 
1456
2170
  ---
1457
2171
 
@@ -1540,6 +2254,90 @@ VPC to launch the runners in.
1540
2254
 
1541
2255
  ---
1542
2256
 
2257
+ ### RunnerImage <a name="RunnerImage" id="@cloudsnorkel/cdk-github-runners.RunnerImage"></a>
2258
+
2259
+ #### Initializer <a name="Initializer" id="@cloudsnorkel/cdk-github-runners.RunnerImage.Initializer"></a>
2260
+
2261
+ ```typescript
2262
+ import { RunnerImage } from '@cloudsnorkel/cdk-github-runners'
2263
+
2264
+ const runnerImage: RunnerImage = { ... }
2265
+ ```
2266
+
2267
+ #### Properties <a name="Properties" id="Properties"></a>
2268
+
2269
+ | **Name** | **Type** | **Description** |
2270
+ | --- | --- | --- |
2271
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.RunnerImage.property.architecture">architecture</a></code> | <code><a href="#@cloudsnorkel/cdk-github-runners.Architecture">Architecture</a></code> | Architecture of the image. |
2272
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.RunnerImage.property.imageDigest">imageDigest</a></code> | <code>string</code> | Image digest for providers that need to know the digest like Lambda. |
2273
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.RunnerImage.property.imageRepository">imageRepository</a></code> | <code>aws-cdk-lib.aws_ecr.IRepository</code> | ECR repository containing the image. |
2274
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.RunnerImage.property.imageTag">imageTag</a></code> | <code>string</code> | Static image tag where the image will be pushed. |
2275
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.RunnerImage.property.os">os</a></code> | <code><a href="#@cloudsnorkel/cdk-github-runners.Os">Os</a></code> | OS type of the image. |
2276
+
2277
+ ---
2278
+
2279
+ ##### `architecture`<sup>Required</sup> <a name="architecture" id="@cloudsnorkel/cdk-github-runners.RunnerImage.property.architecture"></a>
2280
+
2281
+ ```typescript
2282
+ public readonly architecture: Architecture;
2283
+ ```
2284
+
2285
+ - *Type:* <a href="#@cloudsnorkel/cdk-github-runners.Architecture">Architecture</a>
2286
+
2287
+ Architecture of the image.
2288
+
2289
+ ---
2290
+
2291
+ ##### `imageDigest`<sup>Required</sup> <a name="imageDigest" id="@cloudsnorkel/cdk-github-runners.RunnerImage.property.imageDigest"></a>
2292
+
2293
+ ```typescript
2294
+ public readonly imageDigest: string;
2295
+ ```
2296
+
2297
+ - *Type:* string
2298
+
2299
+ Image digest for providers that need to know the digest like Lambda.
2300
+
2301
+ WARNING: the digest might change when the builder automatically rebuilds the image on a schedule. Do not expect for this digest to stay the same between deploys.
2302
+
2303
+ ---
2304
+
2305
+ ##### `imageRepository`<sup>Required</sup> <a name="imageRepository" id="@cloudsnorkel/cdk-github-runners.RunnerImage.property.imageRepository"></a>
2306
+
2307
+ ```typescript
2308
+ public readonly imageRepository: IRepository;
2309
+ ```
2310
+
2311
+ - *Type:* aws-cdk-lib.aws_ecr.IRepository
2312
+
2313
+ ECR repository containing the image.
2314
+
2315
+ ---
2316
+
2317
+ ##### `imageTag`<sup>Required</sup> <a name="imageTag" id="@cloudsnorkel/cdk-github-runners.RunnerImage.property.imageTag"></a>
2318
+
2319
+ ```typescript
2320
+ public readonly imageTag: string;
2321
+ ```
2322
+
2323
+ - *Type:* string
2324
+
2325
+ Static image tag where the image will be pushed.
2326
+
2327
+ ---
2328
+
2329
+ ##### `os`<sup>Required</sup> <a name="os" id="@cloudsnorkel/cdk-github-runners.RunnerImage.property.os"></a>
2330
+
2331
+ ```typescript
2332
+ public readonly os: Os;
2333
+ ```
2334
+
2335
+ - *Type:* <a href="#@cloudsnorkel/cdk-github-runners.Os">Os</a>
2336
+
2337
+ OS type of the image.
2338
+
2339
+ ---
2340
+
1543
2341
  ### RunnerProviderProps <a name="RunnerProviderProps" id="@cloudsnorkel/cdk-github-runners.RunnerProviderProps"></a>
1544
2342
 
1545
2343
  Common properties for all runner providers.
@@ -1557,7 +2355,6 @@ const runnerProviderProps: RunnerProviderProps = { ... }
1557
2355
  | **Name** | **Type** | **Description** |
1558
2356
  | --- | --- | --- |
1559
2357
  | <code><a href="#@cloudsnorkel/cdk-github-runners.RunnerProviderProps.property.logRetention">logRetention</a></code> | <code>aws-cdk-lib.aws_logs.RetentionDays</code> | The number of days log events are kept in CloudWatch Logs. |
1560
- | <code><a href="#@cloudsnorkel/cdk-github-runners.RunnerProviderProps.property.runnerVersion">runnerVersion</a></code> | <code><a href="#@cloudsnorkel/cdk-github-runners.RunnerVersion">RunnerVersion</a></code> | Version of GitHub Runners to install. |
1561
2358
 
1562
2359
  ---
1563
2360
 
@@ -1578,19 +2375,6 @@ remove the retention policy, set the value to `INFINITE`.
1578
2375
 
1579
2376
  ---
1580
2377
 
1581
- ##### `runnerVersion`<sup>Optional</sup> <a name="runnerVersion" id="@cloudsnorkel/cdk-github-runners.RunnerProviderProps.property.runnerVersion"></a>
1582
-
1583
- ```typescript
1584
- public readonly runnerVersion: RunnerVersion;
1585
- ```
1586
-
1587
- - *Type:* <a href="#@cloudsnorkel/cdk-github-runners.RunnerVersion">RunnerVersion</a>
1588
- - *Default:* latest version available
1589
-
1590
- Version of GitHub Runners to install.
1591
-
1592
- ---
1593
-
1594
2378
  ### RunnerRuntimeParameters <a name="RunnerRuntimeParameters" id="@cloudsnorkel/cdk-github-runners.RunnerRuntimeParameters"></a>
1595
2379
 
1596
2380
  Workflow job parameters as parsed from the webhook event. Pass these into your runner executor and run something like:.
@@ -1687,6 +2471,166 @@ Path to runner token used to register token.
1687
2471
 
1688
2472
  ## Classes <a name="Classes" id="Classes"></a>
1689
2473
 
2474
+ ### Architecture <a name="Architecture" id="@cloudsnorkel/cdk-github-runners.Architecture"></a>
2475
+
2476
+ CPU architecture enum for an image.
2477
+
2478
+ #### Methods <a name="Methods" id="Methods"></a>
2479
+
2480
+ | **Name** | **Description** |
2481
+ | --- | --- |
2482
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.Architecture.is">is</a></code> | Checks if the given architecture is the same as this one. |
2483
+
2484
+ ---
2485
+
2486
+ ##### `is` <a name="is" id="@cloudsnorkel/cdk-github-runners.Architecture.is"></a>
2487
+
2488
+ ```typescript
2489
+ public is(arch: Architecture): boolean
2490
+ ```
2491
+
2492
+ Checks if the given architecture is the same as this one.
2493
+
2494
+ ###### `arch`<sup>Required</sup> <a name="arch" id="@cloudsnorkel/cdk-github-runners.Architecture.is.parameter.arch"></a>
2495
+
2496
+ - *Type:* <a href="#@cloudsnorkel/cdk-github-runners.Architecture">Architecture</a>
2497
+
2498
+ architecture to compare.
2499
+
2500
+ ---
2501
+
2502
+
2503
+ #### Properties <a name="Properties" id="Properties"></a>
2504
+
2505
+ | **Name** | **Type** | **Description** |
2506
+ | --- | --- | --- |
2507
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.Architecture.property.name">name</a></code> | <code>string</code> | *No description.* |
2508
+
2509
+ ---
2510
+
2511
+ ##### `name`<sup>Required</sup> <a name="name" id="@cloudsnorkel/cdk-github-runners.Architecture.property.name"></a>
2512
+
2513
+ ```typescript
2514
+ public readonly name: string;
2515
+ ```
2516
+
2517
+ - *Type:* string
2518
+
2519
+ ---
2520
+
2521
+ #### Constants <a name="Constants" id="Constants"></a>
2522
+
2523
+ | **Name** | **Type** | **Description** |
2524
+ | --- | --- | --- |
2525
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.Architecture.property.ARM64">ARM64</a></code> | <code><a href="#@cloudsnorkel/cdk-github-runners.Architecture">Architecture</a></code> | ARM64. |
2526
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.Architecture.property.X86_64">X86_64</a></code> | <code><a href="#@cloudsnorkel/cdk-github-runners.Architecture">Architecture</a></code> | X86_64. |
2527
+
2528
+ ---
2529
+
2530
+ ##### `ARM64`<sup>Required</sup> <a name="ARM64" id="@cloudsnorkel/cdk-github-runners.Architecture.property.ARM64"></a>
2531
+
2532
+ ```typescript
2533
+ public readonly ARM64: Architecture;
2534
+ ```
2535
+
2536
+ - *Type:* <a href="#@cloudsnorkel/cdk-github-runners.Architecture">Architecture</a>
2537
+
2538
+ ARM64.
2539
+
2540
+ ---
2541
+
2542
+ ##### `X86_64`<sup>Required</sup> <a name="X86_64" id="@cloudsnorkel/cdk-github-runners.Architecture.property.X86_64"></a>
2543
+
2544
+ ```typescript
2545
+ public readonly X86_64: Architecture;
2546
+ ```
2547
+
2548
+ - *Type:* <a href="#@cloudsnorkel/cdk-github-runners.Architecture">Architecture</a>
2549
+
2550
+ X86_64.
2551
+
2552
+ ---
2553
+
2554
+ ### Os <a name="Os" id="@cloudsnorkel/cdk-github-runners.Os"></a>
2555
+
2556
+ OS enum for an image.
2557
+
2558
+ #### Methods <a name="Methods" id="Methods"></a>
2559
+
2560
+ | **Name** | **Description** |
2561
+ | --- | --- |
2562
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.Os.is">is</a></code> | Checks if the given OS is the same as this one. |
2563
+
2564
+ ---
2565
+
2566
+ ##### `is` <a name="is" id="@cloudsnorkel/cdk-github-runners.Os.is"></a>
2567
+
2568
+ ```typescript
2569
+ public is(os: Os): boolean
2570
+ ```
2571
+
2572
+ Checks if the given OS is the same as this one.
2573
+
2574
+ ###### `os`<sup>Required</sup> <a name="os" id="@cloudsnorkel/cdk-github-runners.Os.is.parameter.os"></a>
2575
+
2576
+ - *Type:* <a href="#@cloudsnorkel/cdk-github-runners.Os">Os</a>
2577
+
2578
+ OS to compare.
2579
+
2580
+ ---
2581
+
2582
+
2583
+ #### Properties <a name="Properties" id="Properties"></a>
2584
+
2585
+ | **Name** | **Type** | **Description** |
2586
+ | --- | --- | --- |
2587
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.Os.property.name">name</a></code> | <code>string</code> | *No description.* |
2588
+
2589
+ ---
2590
+
2591
+ ##### `name`<sup>Required</sup> <a name="name" id="@cloudsnorkel/cdk-github-runners.Os.property.name"></a>
2592
+
2593
+ ```typescript
2594
+ public readonly name: string;
2595
+ ```
2596
+
2597
+ - *Type:* string
2598
+
2599
+ ---
2600
+
2601
+ #### Constants <a name="Constants" id="Constants"></a>
2602
+
2603
+ | **Name** | **Type** | **Description** |
2604
+ | --- | --- | --- |
2605
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.Os.property.LINUX">LINUX</a></code> | <code><a href="#@cloudsnorkel/cdk-github-runners.Os">Os</a></code> | Linux. |
2606
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.Os.property.WINDOWS">WINDOWS</a></code> | <code><a href="#@cloudsnorkel/cdk-github-runners.Os">Os</a></code> | Windows. |
2607
+
2608
+ ---
2609
+
2610
+ ##### `LINUX`<sup>Required</sup> <a name="LINUX" id="@cloudsnorkel/cdk-github-runners.Os.property.LINUX"></a>
2611
+
2612
+ ```typescript
2613
+ public readonly LINUX: Os;
2614
+ ```
2615
+
2616
+ - *Type:* <a href="#@cloudsnorkel/cdk-github-runners.Os">Os</a>
2617
+
2618
+ Linux.
2619
+
2620
+ ---
2621
+
2622
+ ##### `WINDOWS`<sup>Required</sup> <a name="WINDOWS" id="@cloudsnorkel/cdk-github-runners.Os.property.WINDOWS"></a>
2623
+
2624
+ ```typescript
2625
+ public readonly WINDOWS: Os;
2626
+ ```
2627
+
2628
+ - *Type:* <a href="#@cloudsnorkel/cdk-github-runners.Os">Os</a>
2629
+
2630
+ Windows.
2631
+
2632
+ ---
2633
+
1690
2634
  ### RunnerVersion <a name="RunnerVersion" id="@cloudsnorkel/cdk-github-runners.RunnerVersion"></a>
1691
2635
 
1692
2636
  Defines desired GitHub Actions runner version.
@@ -1770,8 +2714,162 @@ public readonly version: string;
1770
2714
  ---
1771
2715
 
1772
2716
 
2717
+ ### StaticRunnerImage <a name="StaticRunnerImage" id="@cloudsnorkel/cdk-github-runners.StaticRunnerImage"></a>
2718
+
2719
+ Helper class with methods to use static images that are built outside the context of this project.
2720
+
2721
+ #### Initializers <a name="Initializers" id="@cloudsnorkel/cdk-github-runners.StaticRunnerImage.Initializer"></a>
2722
+
2723
+ ```typescript
2724
+ import { StaticRunnerImage } from '@cloudsnorkel/cdk-github-runners'
2725
+
2726
+ new StaticRunnerImage()
2727
+ ```
2728
+
2729
+ | **Name** | **Type** | **Description** |
2730
+ | --- | --- | --- |
2731
+
2732
+ ---
2733
+
2734
+
2735
+ #### Static Functions <a name="Static Functions" id="Static Functions"></a>
2736
+
2737
+ | **Name** | **Description** |
2738
+ | --- | --- |
2739
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.StaticRunnerImage.fromDockerHub">fromDockerHub</a></code> | Create a builder from an existing Docker Hub image. |
2740
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.StaticRunnerImage.fromEcrRepository">fromEcrRepository</a></code> | Create a builder (that doesn't actually build anything) from an existing image in an existing repository. |
2741
+
2742
+ ---
2743
+
2744
+ ##### `fromDockerHub` <a name="fromDockerHub" id="@cloudsnorkel/cdk-github-runners.StaticRunnerImage.fromDockerHub"></a>
2745
+
2746
+ ```typescript
2747
+ import { StaticRunnerImage } from '@cloudsnorkel/cdk-github-runners'
2748
+
2749
+ StaticRunnerImage.fromDockerHub(scope: Construct, id: string, image: string, architecture?: Architecture, os?: Os)
2750
+ ```
2751
+
2752
+ Create a builder from an existing Docker Hub image.
2753
+
2754
+ The image must already have GitHub Actions runner installed. You are responsible to update it and remove it when done.
2755
+
2756
+ We create a CodeBuild image builder behind the scenes to copy the image over to ECR. This helps avoid Docker Hub rate limits and prevent failures.
2757
+
2758
+ ###### `scope`<sup>Required</sup> <a name="scope" id="@cloudsnorkel/cdk-github-runners.StaticRunnerImage.fromDockerHub.parameter.scope"></a>
2759
+
2760
+ - *Type:* constructs.Construct
2761
+
2762
+ ---
2763
+
2764
+ ###### `id`<sup>Required</sup> <a name="id" id="@cloudsnorkel/cdk-github-runners.StaticRunnerImage.fromDockerHub.parameter.id"></a>
2765
+
2766
+ - *Type:* string
2767
+
2768
+ ---
2769
+
2770
+ ###### `image`<sup>Required</sup> <a name="image" id="@cloudsnorkel/cdk-github-runners.StaticRunnerImage.fromDockerHub.parameter.image"></a>
2771
+
2772
+ - *Type:* string
2773
+
2774
+ Docker Hub image with optional tag.
2775
+
2776
+ ---
2777
+
2778
+ ###### `architecture`<sup>Optional</sup> <a name="architecture" id="@cloudsnorkel/cdk-github-runners.StaticRunnerImage.fromDockerHub.parameter.architecture"></a>
2779
+
2780
+ - *Type:* <a href="#@cloudsnorkel/cdk-github-runners.Architecture">Architecture</a>
2781
+
2782
+ image architecture.
2783
+
2784
+ ---
2785
+
2786
+ ###### `os`<sup>Optional</sup> <a name="os" id="@cloudsnorkel/cdk-github-runners.StaticRunnerImage.fromDockerHub.parameter.os"></a>
2787
+
2788
+ - *Type:* <a href="#@cloudsnorkel/cdk-github-runners.Os">Os</a>
2789
+
2790
+ image OS.
2791
+
2792
+ ---
2793
+
2794
+ ##### `fromEcrRepository` <a name="fromEcrRepository" id="@cloudsnorkel/cdk-github-runners.StaticRunnerImage.fromEcrRepository"></a>
2795
+
2796
+ ```typescript
2797
+ import { StaticRunnerImage } from '@cloudsnorkel/cdk-github-runners'
2798
+
2799
+ StaticRunnerImage.fromEcrRepository(repository: IRepository, tag?: string, architecture?: Architecture, os?: Os)
2800
+ ```
2801
+
2802
+ Create a builder (that doesn't actually build anything) from an existing image in an existing repository.
2803
+
2804
+ The image must already have GitHub Actions runner installed. You are responsible to update it and remove it when done.
2805
+
2806
+ ###### `repository`<sup>Required</sup> <a name="repository" id="@cloudsnorkel/cdk-github-runners.StaticRunnerImage.fromEcrRepository.parameter.repository"></a>
2807
+
2808
+ - *Type:* aws-cdk-lib.aws_ecr.IRepository
2809
+
2810
+ ECR repository.
2811
+
2812
+ ---
2813
+
2814
+ ###### `tag`<sup>Optional</sup> <a name="tag" id="@cloudsnorkel/cdk-github-runners.StaticRunnerImage.fromEcrRepository.parameter.tag"></a>
2815
+
2816
+ - *Type:* string
2817
+
2818
+ image tag.
2819
+
2820
+ ---
2821
+
2822
+ ###### `architecture`<sup>Optional</sup> <a name="architecture" id="@cloudsnorkel/cdk-github-runners.StaticRunnerImage.fromEcrRepository.parameter.architecture"></a>
2823
+
2824
+ - *Type:* <a href="#@cloudsnorkel/cdk-github-runners.Architecture">Architecture</a>
2825
+
2826
+ image architecture.
2827
+
2828
+ ---
2829
+
2830
+ ###### `os`<sup>Optional</sup> <a name="os" id="@cloudsnorkel/cdk-github-runners.StaticRunnerImage.fromEcrRepository.parameter.os"></a>
2831
+
2832
+ - *Type:* <a href="#@cloudsnorkel/cdk-github-runners.Os">Os</a>
2833
+
2834
+ image OS.
2835
+
2836
+ ---
2837
+
2838
+
2839
+
1773
2840
  ## Protocols <a name="Protocols" id="Protocols"></a>
1774
2841
 
2842
+ ### IImageBuilder <a name="IImageBuilder" id="@cloudsnorkel/cdk-github-runners.IImageBuilder"></a>
2843
+
2844
+ - *Implemented By:* <a href="#@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilder">CodeBuildImageBuilder</a>, <a href="#@cloudsnorkel/cdk-github-runners.IImageBuilder">IImageBuilder</a>
2845
+
2846
+ Interface for constructs that build an image that can be used in {@link IRunnerProvider}.
2847
+
2848
+ Anything that ends up with an ECR repository containing a Docker image that runs GitHub self-hosted runners can be used. A simple implementation could even point to an existing image and nothing else.
2849
+
2850
+ It's important that the specified image tag be available at the time the repository is available. Providers usually assume the image is ready and will fail if it's not.
2851
+
2852
+ The image can be further updated over time manually or using a schedule as long as it is always written to the same tag.
2853
+
2854
+ #### Methods <a name="Methods" id="Methods"></a>
2855
+
2856
+ | **Name** | **Description** |
2857
+ | --- | --- |
2858
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.IImageBuilder.bind">bind</a></code> | ECR repository containing the image. |
2859
+
2860
+ ---
2861
+
2862
+ ##### `bind` <a name="bind" id="@cloudsnorkel/cdk-github-runners.IImageBuilder.bind"></a>
2863
+
2864
+ ```typescript
2865
+ public bind(): RunnerImage
2866
+ ```
2867
+
2868
+ ECR repository containing the image.
2869
+
2870
+ This method can be called multiple times if the image is bound to multiple providers. Make sure you cache the image when implementing or return an error if this builder doesn't support reusing images.
2871
+
2872
+
1775
2873
  ### IRunnerProvider <a name="IRunnerProvider" id="@cloudsnorkel/cdk-github-runners.IRunnerProvider"></a>
1776
2874
 
1777
2875
  - *Extends:* aws-cdk-lib.aws_ec2.IConnectable, aws-cdk-lib.aws_iam.IGrantable