@cloudsnorkel/cdk-github-runners 0.2.0 → 0.3.2

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 (54) hide show
  1. package/.gitattributes +8 -1
  2. package/.jsii +1371 -206
  3. package/API.md +1191 -93
  4. package/README.md +59 -49
  5. package/lib/index.d.ts +3 -1
  6. package/lib/index.js +7 -1
  7. package/lib/lambdas/build-image/index.js +121 -0
  8. package/lib/lambdas/delete-runner/index.js +5151 -2999
  9. package/lib/lambdas/setup/index.html +37 -0
  10. package/lib/lambdas/setup/index.js +140 -255
  11. package/lib/lambdas/status/index.js +5151 -2999
  12. package/lib/lambdas/token-retriever/index.js +5151 -2999
  13. package/lib/lambdas/update-lambda/index.js +55 -0
  14. package/lib/providers/codebuild.d.ts +31 -1
  15. package/lib/providers/codebuild.js +57 -13
  16. package/lib/providers/common.d.ts +87 -6
  17. package/lib/providers/common.js +64 -4
  18. package/lib/providers/docker-images/codebuild/linux-arm64/Dockerfile +63 -0
  19. package/lib/providers/docker-images/codebuild/{Dockerfile → linux-x64/Dockerfile} +14 -5
  20. package/lib/providers/docker-images/fargate/linux-arm64/Dockerfile +45 -0
  21. package/lib/providers/docker-images/fargate/{runner.sh → linux-arm64/runner.sh} +0 -0
  22. package/lib/providers/docker-images/fargate/{Dockerfile → linux-x64/Dockerfile} +14 -5
  23. package/lib/providers/docker-images/fargate/linux-x64/runner.sh +5 -0
  24. package/lib/providers/docker-images/lambda/linux-arm64/Dockerfile +36 -0
  25. package/lib/providers/docker-images/lambda/{runner.js → linux-arm64/runner.js} +0 -0
  26. package/lib/providers/docker-images/lambda/{runner.sh → linux-arm64/runner.sh} +0 -0
  27. package/lib/providers/docker-images/lambda/linux-x64/Dockerfile +35 -0
  28. package/lib/providers/docker-images/lambda/linux-x64/runner.js +29 -0
  29. package/lib/providers/docker-images/lambda/linux-x64/runner.sh +12 -0
  30. package/lib/providers/fargate.d.ts +33 -1
  31. package/lib/providers/fargate.js +39 -8
  32. package/lib/providers/image-builders/codebuild.d.ts +178 -0
  33. package/lib/providers/image-builders/codebuild.js +354 -0
  34. package/lib/providers/image-builders/static.d.ts +29 -0
  35. package/lib/providers/image-builders/static.js +58 -0
  36. package/lib/providers/lambda.d.ts +27 -1
  37. package/lib/providers/lambda.js +88 -9
  38. package/lib/runner.d.ts +56 -9
  39. package/lib/runner.js +37 -11
  40. package/lib/secrets.js +1 -1
  41. package/lib/utils.d.ts +2 -1
  42. package/lib/utils.js +14 -3
  43. package/lib/webhook.js +2 -1
  44. package/package.json +30 -12
  45. package/setup/index.html +12 -0
  46. package/setup/src/App.svelte +291 -0
  47. package/setup/src/app.scss +15 -0
  48. package/setup/src/main.ts +8 -0
  49. package/setup/src/vite-env.d.ts +2 -0
  50. package/setup/svelte.config.mjs +7 -0
  51. package/setup/tsconfig.json +21 -0
  52. package/setup/tsconfig.node.json +8 -0
  53. package/setup/vite.config.ts +15 -0
  54. package/lib/providers/docker-images/lambda/Dockerfile +0 -27
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
 
@@ -461,6 +779,50 @@ VPC used for hosting the task.
461
779
 
462
780
  ---
463
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
+ ---
464
826
 
465
827
  ### GitHubRunners <a name="GitHubRunners" id="@cloudsnorkel/cdk-github-runners.GitHubRunners"></a>
466
828
 
@@ -471,20 +833,20 @@ It creates a webhook, secrets, and a step function to orchestrate all runs. Secr
471
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.
472
834
 
473
835
  ```typescript
474
- new GitHubRunners(stack, 'runners', {});
836
+ new GitHubRunners(this, 'runners');
475
837
  ```
476
838
 
477
839
  Usually you'd want to configure the runner providers so the runners can run in a certain VPC or have certain permissions.
478
840
 
479
841
  ```typescript
480
- const vpc = ec2.Vpc.fromLookup(stack, 'vpc', { vpcId: 'vpc-1234567' });
481
- const runnerSg = new ec2.SecurityGroup(stack, 'runner security group', { vpc: vpc });
482
- const dbSg = ec2.SecurityGroup.fromSecurityGroupId(stack, 'database security group', 'sg-1234567');
483
- 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');
484
846
 
485
847
  // create a custom CodeBuild provider
486
848
  const myProvider = new CodeBuildRunner(
487
- stack, 'codebuild runner',
849
+ this, 'codebuild runner',
488
850
  {
489
851
  label: 'my-codebuild',
490
852
  vpc: vpc,
@@ -497,7 +859,7 @@ dbSg.connections.allowFrom(runnerSg, ec2.Port.tcp(3306), 'allow runners to conne
497
859
 
498
860
  // create the runner infrastructure
499
861
  new GitHubRunners(
500
- stack,
862
+ this,
501
863
  'runners',
502
864
  {
503
865
  providers: [myProvider],
@@ -510,7 +872,7 @@ new GitHubRunners(
510
872
  ```typescript
511
873
  import { GitHubRunners } from '@cloudsnorkel/cdk-github-runners'
512
874
 
513
- new GitHubRunners(scope: Construct, id: string, props: GitHubRunnersProps)
875
+ new GitHubRunners(scope: Construct, id: string, props?: GitHubRunnersProps)
514
876
  ```
515
877
 
516
878
  | **Name** | **Type** | **Description** |
@@ -533,7 +895,7 @@ new GitHubRunners(scope: Construct, id: string, props: GitHubRunnersProps)
533
895
 
534
896
  ---
535
897
 
536
- ##### `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>
537
899
 
538
900
  - *Type:* <a href="#@cloudsnorkel/cdk-github-runners.GitHubRunnersProps">GitHubRunnersProps</a>
539
901
 
@@ -586,7 +948,6 @@ Any object.
586
948
  | **Name** | **Type** | **Description** |
587
949
  | --- | --- | --- |
588
950
  | <code><a href="#@cloudsnorkel/cdk-github-runners.GitHubRunners.property.node">node</a></code> | <code>constructs.Node</code> | The tree node. |
589
- | <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.* |
590
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. |
591
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. |
592
953
 
@@ -604,16 +965,6 @@ The tree node.
604
965
 
605
966
  ---
606
967
 
607
- ##### `props`<sup>Required</sup> <a name="props" id="@cloudsnorkel/cdk-github-runners.GitHubRunners.property.props"></a>
608
-
609
- ```typescript
610
- public readonly props: GitHubRunnersProps;
611
- ```
612
-
613
- - *Type:* <a href="#@cloudsnorkel/cdk-github-runners.GitHubRunnersProps">GitHubRunnersProps</a>
614
-
615
- ---
616
-
617
968
  ##### `providers`<sup>Required</sup> <a name="providers" id="@cloudsnorkel/cdk-github-runners.GitHubRunners.property.providers"></a>
618
969
 
619
970
  ```typescript
@@ -842,25 +1193,69 @@ VPC used for hosting the function.
842
1193
 
843
1194
  ---
844
1195
 
1196
+ #### Constants <a name="Constants" id="Constants"></a>
845
1197
 
846
- ### Secrets <a name="Secrets" id="@cloudsnorkel/cdk-github-runners.Secrets"></a>
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. |
847
1202
 
848
- Secrets required for GitHub runners operation.
1203
+ ---
849
1204
 
850
- #### Initializers <a name="Initializers" id="@cloudsnorkel/cdk-github-runners.Secrets.Initializer"></a>
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>
851
1206
 
852
1207
  ```typescript
853
- import { Secrets } from '@cloudsnorkel/cdk-github-runners'
854
-
855
- new Secrets(scope: Construct, id: string)
1208
+ public readonly LINUX_ARM64_DOCKERFILE_PATH: string;
856
1209
  ```
857
1210
 
858
- | **Name** | **Type** | **Description** |
859
- | --- | --- | --- |
860
- | <code><a href="#@cloudsnorkel/cdk-github-runners.Secrets.Initializer.parameter.scope">scope</a></code> | <code>constructs.Construct</code> | *No description.* |
861
- | <code><a href="#@cloudsnorkel/cdk-github-runners.Secrets.Initializer.parameter.id">id</a></code> | <code>string</code> | *No description.* |
1211
+ - *Type:* string
862
1212
 
863
- ---
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
+ ---
1240
+
1241
+ ### Secrets <a name="Secrets" id="@cloudsnorkel/cdk-github-runners.Secrets"></a>
1242
+
1243
+ Secrets required for GitHub runners operation.
1244
+
1245
+ #### Initializers <a name="Initializers" id="@cloudsnorkel/cdk-github-runners.Secrets.Initializer"></a>
1246
+
1247
+ ```typescript
1248
+ import { Secrets } from '@cloudsnorkel/cdk-github-runners'
1249
+
1250
+ new Secrets(scope: Construct, id: string)
1251
+ ```
1252
+
1253
+ | **Name** | **Type** | **Description** |
1254
+ | --- | --- | --- |
1255
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.Secrets.Initializer.parameter.scope">scope</a></code> | <code>constructs.Construct</code> | *No description.* |
1256
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.Secrets.Initializer.parameter.id">id</a></code> | <code>string</code> | *No description.* |
1257
+
1258
+ ---
864
1259
 
865
1260
  ##### `scope`<sup>Required</sup> <a name="scope" id="@cloudsnorkel/cdk-github-runners.Secrets.Initializer.parameter.scope"></a>
866
1261
 
@@ -1000,6 +1395,211 @@ Webhook secret used to confirm events are coming from GitHub and nowhere else.
1000
1395
 
1001
1396
  ## Structs <a name="Structs" id="Structs"></a>
1002
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
+
1003
1603
  ### CodeBuildRunnerProps <a name="CodeBuildRunnerProps" id="@cloudsnorkel/cdk-github-runners.CodeBuildRunnerProps"></a>
1004
1604
 
1005
1605
  #### Initializer <a name="Initializer" id="@cloudsnorkel/cdk-github-runners.CodeBuildRunnerProps.Initializer"></a>
@@ -1015,8 +1615,8 @@ const codeBuildRunnerProps: CodeBuildRunnerProps = { ... }
1015
1615
  | **Name** | **Type** | **Description** |
1016
1616
  | --- | --- | --- |
1017
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. |
1018
- | <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. |
1019
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. |
1020
1620
  | <code><a href="#@cloudsnorkel/cdk-github-runners.CodeBuildRunnerProps.property.label">label</a></code> | <code>string</code> | GitHub Actions label used for this provider. |
1021
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. |
1022
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. |
@@ -1042,31 +1642,33 @@ remove the retention policy, set the value to `INFINITE`.
1042
1642
 
1043
1643
  ---
1044
1644
 
1045
- ##### `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>
1046
1646
 
1047
1647
  ```typescript
1048
- public readonly runnerVersion: RunnerVersion;
1648
+ public readonly computeType: ComputeType;
1049
1649
  ```
1050
1650
 
1051
- - *Type:* <a href="#@cloudsnorkel/cdk-github-runners.RunnerVersion">RunnerVersion</a>
1052
- - *Default:* latest version available
1651
+ - *Type:* aws-cdk-lib.aws_codebuild.ComputeType
1652
+ - *Default:* {@link ComputeType#SMALL}
1053
1653
 
1054
- 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.
1055
1657
 
1056
1658
  ---
1057
1659
 
1058
- ##### `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>
1059
1661
 
1060
1662
  ```typescript
1061
- public readonly computeType: ComputeType;
1663
+ public readonly imageBuilder: IImageBuilder;
1062
1664
  ```
1063
1665
 
1064
- - *Type:* aws-cdk-lib.aws_codebuild.ComputeType
1065
- - *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
1066
1668
 
1067
- The type of compute to use for this build.
1669
+ Provider running an image to run inside CodeBuild with GitHub runner pre-configured.
1068
1670
 
1069
- See the {@link ComputeType} enum for the possible values.
1671
+ A user named `runner` is expected to exist with access to Docker-in-Docker.
1070
1672
 
1071
1673
  ---
1072
1674
 
@@ -1155,11 +1757,11 @@ const fargateRunnerProps: FargateRunnerProps = { ... }
1155
1757
  | **Name** | **Type** | **Description** |
1156
1758
  | --- | --- | --- |
1157
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. |
1158
- | <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. |
1159
1760
  | <code><a href="#@cloudsnorkel/cdk-github-runners.FargateRunnerProps.property.assignPublicIp">assignPublicIp</a></code> | <code>boolean</code> | Assign public IP to the runner task. |
1160
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. |
1161
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. |
1162
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. |
1163
1765
  | <code><a href="#@cloudsnorkel/cdk-github-runners.FargateRunnerProps.property.label">label</a></code> | <code>string</code> | GitHub Actions label used for this provider. |
1164
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. |
1165
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. |
@@ -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
@@ -1367,42 +1981,138 @@ const gitHubRunnersProps: GitHubRunnersProps = { ... }
1367
1981
 
1368
1982
  | **Name** | **Type** | **Description** |
1369
1983
  | --- | --- | --- |
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. |
1370
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. |
1371
1990
 
1372
1991
  ---
1373
1992
 
1374
- ##### `providers`<sup>Optional</sup> <a name="providers" id="@cloudsnorkel/cdk-github-runners.GitHubRunnersProps.property.providers"></a>
1993
+ ##### `allowPublicSubnet`<sup>Optional</sup> <a name="allowPublicSubnet" id="@cloudsnorkel/cdk-github-runners.GitHubRunnersProps.property.allowPublicSubnet"></a>
1375
1994
 
1376
1995
  ```typescript
1377
- public readonly providers: IRunnerProvider[];
1996
+ public readonly allowPublicSubnet: boolean;
1378
1997
  ```
1379
1998
 
1380
- - *Type:* <a href="#@cloudsnorkel/cdk-github-runners.IRunnerProvider">IRunnerProvider</a>[]
1381
- - *Default:* CodeBuild, Lambda and Fargate runners with all the defaults (no VPC or default account VPC)
1999
+ - *Type:* boolean
2000
+ - *Default:* false
1382
2001
 
1383
- List of runner providers to use.
2002
+ Allow management functions to run in public subnets.
1384
2003
 
1385
- At least one provider is required. Provider will be selected when its label matches the labels requested by the workflow job.
2004
+ Lambda Functions in a public subnet can NOT access the internet.
1386
2005
 
1387
2006
  ---
1388
2007
 
1389
- ### LambdaRunnerProps <a name="LambdaRunnerProps" id="@cloudsnorkel/cdk-github-runners.LambdaRunnerProps"></a>
2008
+ ##### `extraCertificates`<sup>Optional</sup> <a name="extraCertificates" id="@cloudsnorkel/cdk-github-runners.GitHubRunnersProps.property.extraCertificates"></a>
1390
2009
 
1391
- #### Initializer <a name="Initializer" id="@cloudsnorkel/cdk-github-runners.LambdaRunnerProps.Initializer"></a>
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}.
1392
2019
 
1393
2020
  ```typescript
1394
- import { LambdaRunnerProps } from '@cloudsnorkel/cdk-github-runners'
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');
1395
2025
 
1396
- const lambdaRunnerProps: LambdaRunnerProps = { ... }
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
+ );
1397
2038
  ```
1398
2039
 
1399
- #### Properties <a name="Properties" id="Properties"></a>
2040
+ ---
2041
+
2042
+ ##### `providers`<sup>Optional</sup> <a name="providers" id="@cloudsnorkel/cdk-github-runners.GitHubRunnersProps.property.providers"></a>
2043
+
2044
+ ```typescript
2045
+ public readonly providers: IRunnerProvider[];
2046
+ ```
2047
+
2048
+ - *Type:* <a href="#@cloudsnorkel/cdk-github-runners.IRunnerProvider">IRunnerProvider</a>[]
2049
+ - *Default:* CodeBuild, Lambda and Fargate runners with all the defaults (no VPC or default account VPC)
2050
+
2051
+ List of runner providers to use.
2052
+
2053
+ At least one provider is required. Provider will be selected when its label matches the labels requested by the workflow job.
2054
+
2055
+ ---
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
+
2099
+ ### LambdaRunnerProps <a name="LambdaRunnerProps" id="@cloudsnorkel/cdk-github-runners.LambdaRunnerProps"></a>
2100
+
2101
+ #### Initializer <a name="Initializer" id="@cloudsnorkel/cdk-github-runners.LambdaRunnerProps.Initializer"></a>
2102
+
2103
+ ```typescript
2104
+ import { LambdaRunnerProps } from '@cloudsnorkel/cdk-github-runners'
2105
+
2106
+ const lambdaRunnerProps: LambdaRunnerProps = { ... }
2107
+ ```
2108
+
2109
+ #### Properties <a name="Properties" id="Properties"></a>
1400
2110
 
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