@cloudsnorkel/cdk-github-runners 0.14.18 → 0.14.19

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 (44) hide show
  1. package/.jsii +626 -140
  2. package/API.md +426 -17
  3. package/README.md +32 -2
  4. package/assets/providers/ami-root-device.lambda/index.js +11 -0
  5. package/lib/access.js +1 -1
  6. package/lib/image-builders/api.js +1 -1
  7. package/lib/image-builders/aws-image-builder/ami.d.ts +3 -2
  8. package/lib/image-builders/aws-image-builder/ami.js +9 -34
  9. package/lib/image-builders/aws-image-builder/base-image.d.ts +118 -0
  10. package/lib/image-builders/aws-image-builder/base-image.js +130 -0
  11. package/lib/image-builders/aws-image-builder/builder.js +17 -5
  12. package/lib/image-builders/aws-image-builder/container.d.ts +2 -1
  13. package/lib/image-builders/aws-image-builder/container.js +7 -6
  14. package/lib/image-builders/aws-image-builder/deprecated/ami.js +1 -1
  15. package/lib/image-builders/aws-image-builder/deprecated/container.js +1 -1
  16. package/lib/image-builders/aws-image-builder/deprecated/linux-components.js +1 -1
  17. package/lib/image-builders/aws-image-builder/deprecated/windows-components.js +1 -1
  18. package/lib/image-builders/aws-image-builder/index.d.ts +1 -0
  19. package/lib/image-builders/aws-image-builder/index.js +2 -1
  20. package/lib/image-builders/codebuild-deprecated.js +1 -1
  21. package/lib/image-builders/codebuild.js +15 -4
  22. package/lib/image-builders/common.d.ts +22 -3
  23. package/lib/image-builders/common.js +1 -1
  24. package/lib/image-builders/components.d.ts +1 -1
  25. package/lib/image-builders/components.js +31 -21
  26. package/lib/image-builders/static.js +4 -3
  27. package/lib/providers/ami-root-device.lambda.js +12 -1
  28. package/lib/providers/codebuild.js +4 -4
  29. package/lib/providers/common.js +3 -3
  30. package/lib/providers/composite.js +5 -5
  31. package/lib/providers/ec2.js +5 -5
  32. package/lib/providers/ecs.js +3 -3
  33. package/lib/providers/fargate.js +4 -4
  34. package/lib/providers/lambda.js +4 -4
  35. package/lib/runner.d.ts +24 -5
  36. package/lib/runner.js +46 -9
  37. package/lib/secrets.js +1 -1
  38. package/lib/utils.d.ts +13 -0
  39. package/lib/utils.js +47 -1
  40. package/lib/webhook-redelivery.d.ts +11 -0
  41. package/lib/webhook-redelivery.js +3 -1
  42. package/lib/webhook.d.ts +10 -0
  43. package/lib/webhook.js +3 -1
  44. package/package.json +1 -1
package/API.md CHANGED
@@ -7217,8 +7217,8 @@ const gitHubRunnersProps: GitHubRunnersProps = { ... }
7217
7217
 
7218
7218
  | **Name** | **Type** | **Description** |
7219
7219
  | --- | --- | --- |
7220
- | <code><a href="#@cloudsnorkel/cdk-github-runners.GitHubRunnersProps.property.allowPublicSubnet">allowPublicSubnet</a></code> | <code>boolean</code> | Allow management functions to run in public subnets. |
7221
- | <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. |
7220
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.GitHubRunnersProps.property.allowPublicSubnet">allowPublicSubnet</a></code> | <code>boolean</code> | Allow management functions to run in public subnets. Lambda Functions in a public subnet can NOT access the internet. |
7221
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.GitHubRunnersProps.property.extraCertificates">extraCertificates</a></code> | <code>string</code> | Path to a certificate file (.pem or .crt) or a directory containing certificate files (.pem or .crt) required to trust GitHub Enterprise Server. Use this when GitHub Enterprise Server certificates are self-signed. |
7222
7222
  | <code><a href="#@cloudsnorkel/cdk-github-runners.GitHubRunnersProps.property.idleTimeout">idleTimeout</a></code> | <code>aws-cdk-lib.Duration</code> | Time to wait before stopping a runner that remains idle. |
7223
7223
  | <code><a href="#@cloudsnorkel/cdk-github-runners.GitHubRunnersProps.property.logOptions">logOptions</a></code> | <code><a href="#@cloudsnorkel/cdk-github-runners.LogOptions">LogOptions</a></code> | Logging options for the state machine that manages the runners. |
7224
7224
  | <code><a href="#@cloudsnorkel/cdk-github-runners.GitHubRunnersProps.property.providers">providers</a></code> | <code><a href="#@cloudsnorkel/cdk-github-runners.IRunnerProvider">IRunnerProvider</a> \| <a href="#@cloudsnorkel/cdk-github-runners.ICompositeProvider">ICompositeProvider</a>[]</code> | List of runner providers to use. |
@@ -7244,9 +7244,9 @@ public readonly allowPublicSubnet: boolean;
7244
7244
  - *Type:* boolean
7245
7245
  - *Default:* false
7246
7246
 
7247
- Allow management functions to run in public subnets.
7247
+ Allow management functions to run in public subnets. Lambda Functions in a public subnet can NOT access the internet.
7248
7248
 
7249
- Lambda Functions in a public subnet can NOT access the internet.
7249
+ **Note:** This only affects management functions that interact with GitHub. Lambda functions that help with runner image building and don't interact with GitHub are NOT affected by this setting.
7250
7250
 
7251
7251
  ---
7252
7252
 
@@ -7258,13 +7258,16 @@ public readonly extraCertificates: string;
7258
7258
 
7259
7259
  - *Type:* string
7260
7260
 
7261
- 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.
7261
+ Path to a certificate file (.pem or .crt) or a directory containing certificate files (.pem or .crt) required to trust GitHub Enterprise Server. Use this when GitHub Enterprise Server certificates are self-signed.
7262
7262
 
7263
- You may also want to use custom images for your runner providers that contain the same certificates. See {@link CodeBuildImageBuilder.addCertificates }.
7263
+ If a directory is provided, all .pem and .crt files in that directory will be used. The certificates will be concatenated into a single file for use by Node.js.
7264
+
7265
+ You may also want to use custom images for your runner providers that contain the same certificates. See {@link RunnerImageComponent.extraCertificates }.
7264
7266
 
7265
7267
  ```typescript
7268
+ const selfSignedCertificates = 'certs/ghes.pem'; // or 'path-to-my-extra-certs-folder' for a directory
7266
7269
  const imageBuilder = CodeBuildRunnerProvider.imageBuilder(this, 'Image Builder with Certs');
7267
- imageBuilder.addComponent(RunnerImageComponent.extraCertificates('path-to-my-extra-certs-folder/certs.pem', 'private-ca');
7270
+ imageBuilder.addComponent(RunnerImageComponent.extraCertificates(selfSignedCertificates, 'private-ca'));
7268
7271
 
7269
7272
  const provider = new CodeBuildRunnerProvider(this, 'CodeBuild', {
7270
7273
  imageBuilder: imageBuilder,
@@ -7275,7 +7278,7 @@ new GitHubRunners(
7275
7278
  'runners',
7276
7279
  {
7277
7280
  providers: [provider],
7278
- extraCertificates: 'path-to-my-extra-certs-folder',
7281
+ extraCertificates: selfSignedCertificates,
7279
7282
  }
7280
7283
  );
7281
7284
  ```
@@ -7398,6 +7401,8 @@ Security group attached to all management functions.
7398
7401
 
7399
7402
  Use this with to provide access to GitHub Enterprise Server hosted inside a VPC.
7400
7403
 
7404
+ **Note:** This only affects management functions that interact with GitHub. Lambda functions that help with runner image building and don't interact with GitHub are NOT affected by this setting.
7405
+
7401
7406
  ---
7402
7407
 
7403
7408
  ##### `securityGroups`<sup>Optional</sup> <a name="securityGroups" id="@cloudsnorkel/cdk-github-runners.GitHubRunnersProps.property.securityGroups"></a>
@@ -7410,7 +7415,11 @@ public readonly securityGroups: ISecurityGroup[];
7410
7415
 
7411
7416
  Security groups attached to all management functions.
7412
7417
 
7413
- Use this with to provide access to GitHub Enterprise Server hosted inside a VPC.
7418
+ Use this to provide outbound access from management functions to GitHub Enterprise Server hosted inside a VPC.
7419
+
7420
+ **Note:** This only affects management functions that interact with GitHub. Lambda functions that help with runner image building and don't interact with GitHub are NOT affected by this setting.
7421
+
7422
+ **Note:** Defining inbound rules on this security group does nothing. This security group only controls outbound access FROM the management functions. To limit access TO the webhook or setup functions, use {@link webhookAccess} and {@link setupAccess} instead.
7414
7423
 
7415
7424
  ---
7416
7425
 
@@ -7454,6 +7463,8 @@ public readonly vpc: IVpc;
7454
7463
 
7455
7464
  VPC used for all management functions. Use this with GitHub Enterprise Server hosted that's inaccessible from outside the VPC.
7456
7465
 
7466
+ **Note:** This only affects management functions that interact with GitHub. Lambda functions that help with runner image building and don't interact with GitHub are NOT affected by this setting and will run outside the VPC.
7467
+
7457
7468
  Make sure the selected VPC and subnets have access to the following with either NAT Gateway or VPC Endpoints:
7458
7469
  * GitHub Enterprise Server
7459
7470
  * Secrets Manager
@@ -7477,6 +7488,8 @@ VPC subnets used for all management functions.
7477
7488
 
7478
7489
  Use this with GitHub Enterprise Server hosted that's inaccessible from outside the VPC.
7479
7490
 
7491
+ **Note:** This only affects management functions that interact with GitHub. Lambda functions that help with runner image building and don't interact with GitHub are NOT affected by this setting.
7492
+
7480
7493
  ---
7481
7494
 
7482
7495
  ##### `webhookAccess`<sup>Optional</sup> <a name="webhookAccess" id="@cloudsnorkel/cdk-github-runners.GitHubRunnersProps.property.webhookAccess"></a>
@@ -8428,8 +8441,8 @@ const runnerImageBuilderProps: RunnerImageBuilderProps = { ... }
8428
8441
  | --- | --- | --- |
8429
8442
  | <code><a href="#@cloudsnorkel/cdk-github-runners.RunnerImageBuilderProps.property.architecture">architecture</a></code> | <code><a href="#@cloudsnorkel/cdk-github-runners.Architecture">Architecture</a></code> | Image architecture. |
8430
8443
  | <code><a href="#@cloudsnorkel/cdk-github-runners.RunnerImageBuilderProps.property.awsImageBuilderOptions">awsImageBuilderOptions</a></code> | <code><a href="#@cloudsnorkel/cdk-github-runners.AwsImageBuilderRunnerImageBuilderProps">AwsImageBuilderRunnerImageBuilderProps</a></code> | Options specific to AWS Image Builder. |
8431
- | <code><a href="#@cloudsnorkel/cdk-github-runners.RunnerImageBuilderProps.property.baseAmi">baseAmi</a></code> | <code>string</code> | Base AMI from which runner AMIs will be built. |
8432
- | <code><a href="#@cloudsnorkel/cdk-github-runners.RunnerImageBuilderProps.property.baseDockerImage">baseDockerImage</a></code> | <code>string</code> | Base image from which Docker runner images will be built. |
8444
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.RunnerImageBuilderProps.property.baseAmi">baseAmi</a></code> | <code>string \| <a href="#@cloudsnorkel/cdk-github-runners.BaseImage">BaseImage</a></code> | Base AMI from which runner AMIs will be built. |
8445
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.RunnerImageBuilderProps.property.baseDockerImage">baseDockerImage</a></code> | <code>string \| <a href="#@cloudsnorkel/cdk-github-runners.BaseContainerImage">BaseContainerImage</a></code> | Base image from which Docker runner images will be built. |
8433
8446
  | <code><a href="#@cloudsnorkel/cdk-github-runners.RunnerImageBuilderProps.property.builderType">builderType</a></code> | <code><a href="#@cloudsnorkel/cdk-github-runners.RunnerImageBuilderType">RunnerImageBuilderType</a></code> | *No description.* |
8434
8447
  | <code><a href="#@cloudsnorkel/cdk-github-runners.RunnerImageBuilderProps.property.codeBuildOptions">codeBuildOptions</a></code> | <code><a href="#@cloudsnorkel/cdk-github-runners.CodeBuildRunnerImageBuilderProps">CodeBuildRunnerImageBuilderProps</a></code> | Options specific to CodeBuild image builder. |
8435
8448
  | <code><a href="#@cloudsnorkel/cdk-github-runners.RunnerImageBuilderProps.property.components">components</a></code> | <code><a href="#@cloudsnorkel/cdk-github-runners.RunnerImageComponent">RunnerImageComponent</a>[]</code> | Components to install on the image. |
@@ -8476,29 +8489,47 @@ Only used when builderType is RunnerImageBuilderType.AWS_IMAGE_BUILDER.
8476
8489
  ##### `baseAmi`<sup>Optional</sup> <a name="baseAmi" id="@cloudsnorkel/cdk-github-runners.RunnerImageBuilderProps.property.baseAmi"></a>
8477
8490
 
8478
8491
  ```typescript
8479
- public readonly baseAmi: string;
8492
+ public readonly baseAmi: string | BaseImage;
8480
8493
  ```
8481
8494
 
8482
- - *Type:* string
8495
+ - *Type:* string | <a href="#@cloudsnorkel/cdk-github-runners.BaseImage">BaseImage</a>
8483
8496
  - *Default:* latest Ubuntu 22.04 AMI for Os.LINUX_UBUNTU and Os.LINUX_UBUNTU_2204, Ubuntu 24.04 AMI for Os.LINUX_UBUNTU_2404, latest Amazon Linux 2 AMI for Os.LINUX_AMAZON_2, latest Windows Server 2022 AMI for Os.WINDOWS
8484
8497
 
8485
8498
  Base AMI from which runner AMIs will be built.
8486
8499
 
8487
- This can be an actual AMI or an AWS Image Builder ARN that points to the latest AMI. For example `arn:aws:imagebuilder:us-east-1:aws:image/ubuntu-server-22-lts-x86/x.x.x` would always use the latest version of Ubuntu 22.04 in each build. If you want a specific version, you can replace `x.x.x` with that version.
8500
+ This can be:
8501
+ - A string (AMI ID, Image Builder ARN, SSM parameter reference, or Marketplace product ID) - deprecated, use BaseImage static factory methods instead
8502
+ - A BaseImage instance created using static factory methods:
8503
+ - `BaseImage.fromAmiId('ami-12345')` - Use an AMI ID
8504
+ - `BaseImage.fromString('arn:aws:imagebuilder:...')` - Use any string (ARN, AMI ID, etc.)
8505
+ - `BaseImage.fromSsmParameter(parameter)` - Use an SSM parameter object
8506
+ - `BaseImage.fromSsmParameterName('/aws/service/ami/...')` - Use an SSM parameter by name
8507
+ - `BaseImage.fromMarketplaceProductId('product-id')` - Use a Marketplace product ID
8508
+ - `BaseImage.fromImageBuilder(scope, 'ubuntu-server-22-lts-x86')` - Use an AWS-provided Image Builder image
8509
+
8510
+ For example `BaseImage.fromImageBuilder(scope, 'ubuntu-server-22-lts-x86')` would always use the latest version of Ubuntu 22.04 in each build. If you want a specific version, you can pass the version as the third parameter.
8488
8511
 
8489
8512
  ---
8490
8513
 
8491
8514
  ##### `baseDockerImage`<sup>Optional</sup> <a name="baseDockerImage" id="@cloudsnorkel/cdk-github-runners.RunnerImageBuilderProps.property.baseDockerImage"></a>
8492
8515
 
8493
8516
  ```typescript
8494
- public readonly baseDockerImage: string;
8517
+ public readonly baseDockerImage: string | BaseContainerImage;
8495
8518
  ```
8496
8519
 
8497
- - *Type:* string
8520
+ - *Type:* string | <a href="#@cloudsnorkel/cdk-github-runners.BaseContainerImage">BaseContainerImage</a>
8498
8521
  - *Default:* public.ecr.aws/lts/ubuntu:22.04 for Os.LINUX_UBUNTU and Os.LINUX_UBUNTU_2204, public.ecr.aws/lts/ubuntu:24.04 for Os.LINUX_UBUNTU_2404, public.ecr.aws/amazonlinux/amazonlinux:2 for Os.LINUX_AMAZON_2, mcr.microsoft.com/windows/servercore:ltsc2019-amd64 for Os.WINDOWS
8499
8522
 
8500
8523
  Base image from which Docker runner images will be built.
8501
8524
 
8525
+ This can be:
8526
+ - A string (ECR/ECR public image URI, DockerHub image, or Image Builder ARN) - deprecated, use BaseContainerImage static factory methods instead
8527
+ - A BaseContainerImage instance created using static factory methods:
8528
+ - `BaseContainerImage.fromDockerHub('ubuntu', '22.04')` - Use DockerHub
8529
+ - `BaseContainerImage.fromEcr(repo, 'latest')` - Use ECR (automatically grants permissions with CodeBuild)
8530
+ - `BaseContainerImage.fromEcrPublic('lts', 'ubuntu', '22.04')` - Use ECR Public
8531
+ - `BaseContainerImage.fromString('public.ecr.aws/lts/ubuntu:22.04')` - Use any string
8532
+
8502
8533
  When using private images from a different account or not on ECR, you may need to include additional setup commands with {@link dockerSetupCommands}.
8503
8534
 
8504
8535
  ---
@@ -9187,6 +9218,384 @@ X86_64.
9187
9218
 
9188
9219
  ---
9189
9220
 
9221
+ ### BaseContainerImage <a name="BaseContainerImage" id="@cloudsnorkel/cdk-github-runners.BaseContainerImage"></a>
9222
+
9223
+ Represents a base container image that is used to start from in EC2 Image Builder container builds.
9224
+
9225
+ This class is adapted from AWS CDK's BaseContainerImage class to support both string and object inputs.
9226
+
9227
+ #### Initializers <a name="Initializers" id="@cloudsnorkel/cdk-github-runners.BaseContainerImage.Initializer"></a>
9228
+
9229
+ ```typescript
9230
+ import { BaseContainerImage } from '@cloudsnorkel/cdk-github-runners'
9231
+
9232
+ new BaseContainerImage(image: string, ecrRepository?: IRepository)
9233
+ ```
9234
+
9235
+ | **Name** | **Type** | **Description** |
9236
+ | --- | --- | --- |
9237
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.BaseContainerImage.Initializer.parameter.image">image</a></code> | <code>string</code> | *No description.* |
9238
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.BaseContainerImage.Initializer.parameter.ecrRepository">ecrRepository</a></code> | <code>aws-cdk-lib.aws_ecr.IRepository</code> | *No description.* |
9239
+
9240
+ ---
9241
+
9242
+ ##### `image`<sup>Required</sup> <a name="image" id="@cloudsnorkel/cdk-github-runners.BaseContainerImage.Initializer.parameter.image"></a>
9243
+
9244
+ - *Type:* string
9245
+
9246
+ ---
9247
+
9248
+ ##### `ecrRepository`<sup>Optional</sup> <a name="ecrRepository" id="@cloudsnorkel/cdk-github-runners.BaseContainerImage.Initializer.parameter.ecrRepository"></a>
9249
+
9250
+ - *Type:* aws-cdk-lib.aws_ecr.IRepository
9251
+
9252
+ ---
9253
+
9254
+
9255
+ #### Static Functions <a name="Static Functions" id="Static Functions"></a>
9256
+
9257
+ | **Name** | **Description** |
9258
+ | --- | --- |
9259
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.BaseContainerImage.fromDockerHub">fromDockerHub</a></code> | The DockerHub image to use as the base image in a container recipe. |
9260
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.BaseContainerImage.fromEcr">fromEcr</a></code> | The ECR container image to use as the base image in a container recipe. |
9261
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.BaseContainerImage.fromEcrPublic">fromEcrPublic</a></code> | The ECR public container image to use as the base image in a container recipe. |
9262
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.BaseContainerImage.fromString">fromString</a></code> | The string value of the base image to use in a container recipe. |
9263
+
9264
+ ---
9265
+
9266
+ ##### `fromDockerHub` <a name="fromDockerHub" id="@cloudsnorkel/cdk-github-runners.BaseContainerImage.fromDockerHub"></a>
9267
+
9268
+ ```typescript
9269
+ import { BaseContainerImage } from '@cloudsnorkel/cdk-github-runners'
9270
+
9271
+ BaseContainerImage.fromDockerHub(repository: string, tag: string)
9272
+ ```
9273
+
9274
+ The DockerHub image to use as the base image in a container recipe.
9275
+
9276
+ ###### `repository`<sup>Required</sup> <a name="repository" id="@cloudsnorkel/cdk-github-runners.BaseContainerImage.fromDockerHub.parameter.repository"></a>
9277
+
9278
+ - *Type:* string
9279
+
9280
+ The DockerHub repository where the base image resides in.
9281
+
9282
+ ---
9283
+
9284
+ ###### `tag`<sup>Required</sup> <a name="tag" id="@cloudsnorkel/cdk-github-runners.BaseContainerImage.fromDockerHub.parameter.tag"></a>
9285
+
9286
+ - *Type:* string
9287
+
9288
+ The tag of the base image in the DockerHub repository.
9289
+
9290
+ ---
9291
+
9292
+ ##### `fromEcr` <a name="fromEcr" id="@cloudsnorkel/cdk-github-runners.BaseContainerImage.fromEcr"></a>
9293
+
9294
+ ```typescript
9295
+ import { BaseContainerImage } from '@cloudsnorkel/cdk-github-runners'
9296
+
9297
+ BaseContainerImage.fromEcr(repository: IRepository, tag: string)
9298
+ ```
9299
+
9300
+ The ECR container image to use as the base image in a container recipe.
9301
+
9302
+ ###### `repository`<sup>Required</sup> <a name="repository" id="@cloudsnorkel/cdk-github-runners.BaseContainerImage.fromEcr.parameter.repository"></a>
9303
+
9304
+ - *Type:* aws-cdk-lib.aws_ecr.IRepository
9305
+
9306
+ The ECR repository where the base image resides in.
9307
+
9308
+ ---
9309
+
9310
+ ###### `tag`<sup>Required</sup> <a name="tag" id="@cloudsnorkel/cdk-github-runners.BaseContainerImage.fromEcr.parameter.tag"></a>
9311
+
9312
+ - *Type:* string
9313
+
9314
+ The tag of the base image in the ECR repository.
9315
+
9316
+ ---
9317
+
9318
+ ##### `fromEcrPublic` <a name="fromEcrPublic" id="@cloudsnorkel/cdk-github-runners.BaseContainerImage.fromEcrPublic"></a>
9319
+
9320
+ ```typescript
9321
+ import { BaseContainerImage } from '@cloudsnorkel/cdk-github-runners'
9322
+
9323
+ BaseContainerImage.fromEcrPublic(registryAlias: string, repositoryName: string, tag: string)
9324
+ ```
9325
+
9326
+ The ECR public container image to use as the base image in a container recipe.
9327
+
9328
+ ###### `registryAlias`<sup>Required</sup> <a name="registryAlias" id="@cloudsnorkel/cdk-github-runners.BaseContainerImage.fromEcrPublic.parameter.registryAlias"></a>
9329
+
9330
+ - *Type:* string
9331
+
9332
+ The alias of the ECR public registry where the base image resides in.
9333
+
9334
+ ---
9335
+
9336
+ ###### `repositoryName`<sup>Required</sup> <a name="repositoryName" id="@cloudsnorkel/cdk-github-runners.BaseContainerImage.fromEcrPublic.parameter.repositoryName"></a>
9337
+
9338
+ - *Type:* string
9339
+
9340
+ The name of the ECR public repository, where the base image resides in.
9341
+
9342
+ ---
9343
+
9344
+ ###### `tag`<sup>Required</sup> <a name="tag" id="@cloudsnorkel/cdk-github-runners.BaseContainerImage.fromEcrPublic.parameter.tag"></a>
9345
+
9346
+ - *Type:* string
9347
+
9348
+ The tag of the base image in the ECR public repository.
9349
+
9350
+ ---
9351
+
9352
+ ##### `fromString` <a name="fromString" id="@cloudsnorkel/cdk-github-runners.BaseContainerImage.fromString"></a>
9353
+
9354
+ ```typescript
9355
+ import { BaseContainerImage } from '@cloudsnorkel/cdk-github-runners'
9356
+
9357
+ BaseContainerImage.fromString(baseContainerImageString: string)
9358
+ ```
9359
+
9360
+ The string value of the base image to use in a container recipe.
9361
+
9362
+ This can be an EC2 Image Builder image ARN,
9363
+ an ECR or ECR public image, or a container URI sourced from a third-party container registry such as DockerHub.
9364
+
9365
+ ###### `baseContainerImageString`<sup>Required</sup> <a name="baseContainerImageString" id="@cloudsnorkel/cdk-github-runners.BaseContainerImage.fromString.parameter.baseContainerImageString"></a>
9366
+
9367
+ - *Type:* string
9368
+
9369
+ The base image as a direct string value.
9370
+
9371
+ ---
9372
+
9373
+ #### Properties <a name="Properties" id="Properties"></a>
9374
+
9375
+ | **Name** | **Type** | **Description** |
9376
+ | --- | --- | --- |
9377
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.BaseContainerImage.property.image">image</a></code> | <code>string</code> | The rendered base image to use. |
9378
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.BaseContainerImage.property.ecrRepository">ecrRepository</a></code> | <code>aws-cdk-lib.aws_ecr.IRepository</code> | The ECR repository if this image was created from an ECR repository. |
9379
+
9380
+ ---
9381
+
9382
+ ##### `image`<sup>Required</sup> <a name="image" id="@cloudsnorkel/cdk-github-runners.BaseContainerImage.property.image"></a>
9383
+
9384
+ ```typescript
9385
+ public readonly image: string;
9386
+ ```
9387
+
9388
+ - *Type:* string
9389
+
9390
+ The rendered base image to use.
9391
+
9392
+ ---
9393
+
9394
+ ##### `ecrRepository`<sup>Optional</sup> <a name="ecrRepository" id="@cloudsnorkel/cdk-github-runners.BaseContainerImage.property.ecrRepository"></a>
9395
+
9396
+ ```typescript
9397
+ public readonly ecrRepository: IRepository;
9398
+ ```
9399
+
9400
+ - *Type:* aws-cdk-lib.aws_ecr.IRepository
9401
+
9402
+ The ECR repository if this image was created from an ECR repository.
9403
+
9404
+ This allows automatic permission granting for CodeBuild.
9405
+
9406
+ ---
9407
+
9408
+
9409
+ ### BaseImage <a name="BaseImage" id="@cloudsnorkel/cdk-github-runners.BaseImage"></a>
9410
+
9411
+ Represents a base image that is used to start from in EC2 Image Builder image builds.
9412
+
9413
+ This class is adapted from AWS CDK's BaseImage class to support both string and object inputs.
9414
+
9415
+ #### Initializers <a name="Initializers" id="@cloudsnorkel/cdk-github-runners.BaseImage.Initializer"></a>
9416
+
9417
+ ```typescript
9418
+ import { BaseImage } from '@cloudsnorkel/cdk-github-runners'
9419
+
9420
+ new BaseImage(image: string)
9421
+ ```
9422
+
9423
+ | **Name** | **Type** | **Description** |
9424
+ | --- | --- | --- |
9425
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.BaseImage.Initializer.parameter.image">image</a></code> | <code>string</code> | *No description.* |
9426
+
9427
+ ---
9428
+
9429
+ ##### `image`<sup>Required</sup> <a name="image" id="@cloudsnorkel/cdk-github-runners.BaseImage.Initializer.parameter.image"></a>
9430
+
9431
+ - *Type:* string
9432
+
9433
+ ---
9434
+
9435
+
9436
+ #### Static Functions <a name="Static Functions" id="Static Functions"></a>
9437
+
9438
+ | **Name** | **Description** |
9439
+ | --- | --- |
9440
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.BaseImage.fromAmiId">fromAmiId</a></code> | The AMI ID to use as a base image in an image recipe. |
9441
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.BaseImage.fromImageBuilder">fromImageBuilder</a></code> | An AWS-provided EC2 Image Builder image to use as a base image in an image recipe. |
9442
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.BaseImage.fromMarketplaceProductId">fromMarketplaceProductId</a></code> | The marketplace product ID for an AMI product to use as the base image in an image recipe. |
9443
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.BaseImage.fromSsmParameter">fromSsmParameter</a></code> | The SSM parameter to use as the base image in an image recipe. |
9444
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.BaseImage.fromSsmParameterName">fromSsmParameterName</a></code> | The parameter name for the SSM parameter to use as the base image in an image recipe. |
9445
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.BaseImage.fromString">fromString</a></code> | The direct string value of the base image to use in an image recipe. |
9446
+
9447
+ ---
9448
+
9449
+ ##### `fromAmiId` <a name="fromAmiId" id="@cloudsnorkel/cdk-github-runners.BaseImage.fromAmiId"></a>
9450
+
9451
+ ```typescript
9452
+ import { BaseImage } from '@cloudsnorkel/cdk-github-runners'
9453
+
9454
+ BaseImage.fromAmiId(amiId: string)
9455
+ ```
9456
+
9457
+ The AMI ID to use as a base image in an image recipe.
9458
+
9459
+ ###### `amiId`<sup>Required</sup> <a name="amiId" id="@cloudsnorkel/cdk-github-runners.BaseImage.fromAmiId.parameter.amiId"></a>
9460
+
9461
+ - *Type:* string
9462
+
9463
+ The AMI ID to use as the base image.
9464
+
9465
+ ---
9466
+
9467
+ ##### `fromImageBuilder` <a name="fromImageBuilder" id="@cloudsnorkel/cdk-github-runners.BaseImage.fromImageBuilder"></a>
9468
+
9469
+ ```typescript
9470
+ import { BaseImage } from '@cloudsnorkel/cdk-github-runners'
9471
+
9472
+ BaseImage.fromImageBuilder(scope: Construct, resourceName: string, version?: string)
9473
+ ```
9474
+
9475
+ An AWS-provided EC2 Image Builder image to use as a base image in an image recipe.
9476
+
9477
+ This constructs an Image Builder ARN for AWS-provided images like `ubuntu-server-22-lts-x86/x.x.x`.
9478
+
9479
+ ###### `scope`<sup>Required</sup> <a name="scope" id="@cloudsnorkel/cdk-github-runners.BaseImage.fromImageBuilder.parameter.scope"></a>
9480
+
9481
+ - *Type:* constructs.Construct
9482
+
9483
+ The construct scope (used to determine the stack and region).
9484
+
9485
+ ---
9486
+
9487
+ ###### `resourceName`<sup>Required</sup> <a name="resourceName" id="@cloudsnorkel/cdk-github-runners.BaseImage.fromImageBuilder.parameter.resourceName"></a>
9488
+
9489
+ - *Type:* string
9490
+
9491
+ The Image Builder resource name pattern (e.g., `ubuntu-server-22-lts-x86` or `ubuntu-server-22-lts-${arch}`).
9492
+
9493
+ ---
9494
+
9495
+ ###### `version`<sup>Optional</sup> <a name="version" id="@cloudsnorkel/cdk-github-runners.BaseImage.fromImageBuilder.parameter.version"></a>
9496
+
9497
+ - *Type:* string
9498
+
9499
+ The version pattern (defaults to `x.x.x` to use the latest version).
9500
+
9501
+ ---
9502
+
9503
+ ##### `fromMarketplaceProductId` <a name="fromMarketplaceProductId" id="@cloudsnorkel/cdk-github-runners.BaseImage.fromMarketplaceProductId"></a>
9504
+
9505
+ ```typescript
9506
+ import { BaseImage } from '@cloudsnorkel/cdk-github-runners'
9507
+
9508
+ BaseImage.fromMarketplaceProductId(productId: string)
9509
+ ```
9510
+
9511
+ The marketplace product ID for an AMI product to use as the base image in an image recipe.
9512
+
9513
+ ###### `productId`<sup>Required</sup> <a name="productId" id="@cloudsnorkel/cdk-github-runners.BaseImage.fromMarketplaceProductId.parameter.productId"></a>
9514
+
9515
+ - *Type:* string
9516
+
9517
+ The Marketplace AMI product ID to use as the base image.
9518
+
9519
+ ---
9520
+
9521
+ ##### `fromSsmParameter` <a name="fromSsmParameter" id="@cloudsnorkel/cdk-github-runners.BaseImage.fromSsmParameter"></a>
9522
+
9523
+ ```typescript
9524
+ import { BaseImage } from '@cloudsnorkel/cdk-github-runners'
9525
+
9526
+ BaseImage.fromSsmParameter(parameter: IParameter)
9527
+ ```
9528
+
9529
+ The SSM parameter to use as the base image in an image recipe.
9530
+
9531
+ ###### `parameter`<sup>Required</sup> <a name="parameter" id="@cloudsnorkel/cdk-github-runners.BaseImage.fromSsmParameter.parameter.parameter"></a>
9532
+
9533
+ - *Type:* aws-cdk-lib.aws_ssm.IParameter
9534
+
9535
+ The SSM parameter to use as the base image.
9536
+
9537
+ ---
9538
+
9539
+ ##### `fromSsmParameterName` <a name="fromSsmParameterName" id="@cloudsnorkel/cdk-github-runners.BaseImage.fromSsmParameterName"></a>
9540
+
9541
+ ```typescript
9542
+ import { BaseImage } from '@cloudsnorkel/cdk-github-runners'
9543
+
9544
+ BaseImage.fromSsmParameterName(parameterName: string)
9545
+ ```
9546
+
9547
+ The parameter name for the SSM parameter to use as the base image in an image recipe.
9548
+
9549
+ ###### `parameterName`<sup>Required</sup> <a name="parameterName" id="@cloudsnorkel/cdk-github-runners.BaseImage.fromSsmParameterName.parameter.parameterName"></a>
9550
+
9551
+ - *Type:* string
9552
+
9553
+ The name of the SSM parameter to use as the base image.
9554
+
9555
+ ---
9556
+
9557
+ ##### `fromString` <a name="fromString" id="@cloudsnorkel/cdk-github-runners.BaseImage.fromString"></a>
9558
+
9559
+ ```typescript
9560
+ import { BaseImage } from '@cloudsnorkel/cdk-github-runners'
9561
+
9562
+ BaseImage.fromString(baseImageString: string)
9563
+ ```
9564
+
9565
+ The direct string value of the base image to use in an image recipe.
9566
+
9567
+ This can be an EC2 Image Builder image ARN,
9568
+ an SSM parameter, an AWS Marketplace product ID, or an AMI ID.
9569
+
9570
+ ###### `baseImageString`<sup>Required</sup> <a name="baseImageString" id="@cloudsnorkel/cdk-github-runners.BaseImage.fromString.parameter.baseImageString"></a>
9571
+
9572
+ - *Type:* string
9573
+
9574
+ The base image as a direct string value.
9575
+
9576
+ ---
9577
+
9578
+ #### Properties <a name="Properties" id="Properties"></a>
9579
+
9580
+ | **Name** | **Type** | **Description** |
9581
+ | --- | --- | --- |
9582
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.BaseImage.property.image">image</a></code> | <code>string</code> | The rendered base image to use. |
9583
+
9584
+ ---
9585
+
9586
+ ##### `image`<sup>Required</sup> <a name="image" id="@cloudsnorkel/cdk-github-runners.BaseImage.property.image"></a>
9587
+
9588
+ ```typescript
9589
+ public readonly image: string;
9590
+ ```
9591
+
9592
+ - *Type:* string
9593
+
9594
+ The rendered base image to use.
9595
+
9596
+ ---
9597
+
9598
+
9190
9599
  ### CompositeProvider <a name="CompositeProvider" id="@cloudsnorkel/cdk-github-runners.CompositeProvider"></a>
9191
9600
 
9192
9601
  A composite runner provider that implements fallback and distribution strategies.
@@ -10090,7 +10499,7 @@ This can be used to support GitHub Enterprise Server with self-signed certificat
10090
10499
 
10091
10500
  - *Type:* string
10092
10501
 
10093
- path to certificate file in PEM format.
10502
+ path to certificate file in PEM format, or a directory containing certificate files (.pem or .crt).
10094
10503
 
10095
10504
  ---
10096
10505
 
package/README.md CHANGED
@@ -447,9 +447,39 @@ const providerSelector = new Function(this, 'provider-selector', {
447
447
 
448
448
  ## Examples
449
449
 
450
- Beyond the code snippets above, the fullest example available is the [integration test](test/default.integ.ts).
450
+ We provide comprehensive examples in the [`examples/`](examples/) folder to help you get started quickly:
451
451
 
452
- If you have more to share, please open a PR adding them to the `examples` folder.
452
+ ### Getting Started
453
+ - **[Simple CodeBuild](examples/typescript/simple-codebuild/)** - Basic setup with just a CodeBuild provider (also available in [Python](examples/python/simple-codebuild/))
454
+
455
+ ### Provider Configuration
456
+ - **[Composite Provider](examples/typescript/composite-provider/)** - Fallback and weighted distribution strategies (also available in [Python](examples/python/composite-provider/))
457
+ - **[Provider Selector](examples/typescript/provider-selector/)** - Custom provider selection with Lambda function (also available in [Python](examples/python/provider-selector/))
458
+ - **[EC2 Windows Provider](examples/typescript/ec2-windows-provider/)** - EC2 configuration for Windows runners (also available in [Python](examples/python/ec2-windows-provider/))
459
+
460
+ ### Compute & Performance
461
+ - **[Compute Options](examples/typescript/compute-options/)** - Configure CPU, memory, and instance types for different providers (also available in [Python](examples/python/compute-options/))
462
+ - **[Spot Instances](examples/typescript/spot-instances/)** - Use spot instances for cost savings across EC2, Fargate, and ECS (also available in [Python](examples/python/spot-instances/))
463
+ - **[Storage Options](examples/typescript/storage-options/)** - Custom EBS storage options for EC2 runners (also available in [Python](examples/python/storage-options/))
464
+ - **[ECS Scaling](examples/typescript/ecs-scaling/)** - Custom autoscaling group scaling policies for ECS providers (also available in [Python](examples/python/ecs-scaling/))
465
+
466
+ ### Security & Access
467
+ - **[IAM Permissions](examples/typescript/iam-permissions/)** - Grant AWS IAM permissions to runners (also available in [Python](examples/python/iam-permissions/))
468
+ - **[Network Access](examples/typescript/network-access/)** - Configure network access with VPCs and security groups (also available in [Python](examples/python/network-access/))
469
+ - **[Access Control](examples/typescript/access-control/)** - Configure access control for webhook and setup functions (also available in [Python](examples/python/access-control/))
470
+
471
+ ### Customization
472
+ - **[Add Software](examples/typescript/add-software/)** - Add custom software to runner images (also available in [Python](examples/python/add-software/))
473
+
474
+ ### Enterprise & Monitoring
475
+ - **[GHES](examples/typescript/ghes/)** - Configure runners for GitHub Enterprise Server (also available in [Python](examples/python/ghes/))
476
+ - **[Monitoring](examples/typescript/monitoring/)** - Set up CloudWatch alarms and SNS notifications (also available in [Python](examples/python/monitoring/))
477
+
478
+ Each example is self-contained with its own dependencies and README. Start with the simple examples and work your way up to more advanced configurations.
479
+
480
+ Another good and very full example is the [integration test](test/default.integ.ts).
481
+
482
+ If you have more to share, please open a PR adding examples to the `examples` folder.
453
483
 
454
484
  ## Architecture
455
485
 
@@ -106,6 +106,17 @@ async function handler(event, context) {
106
106
  await handleAmi(event, ssmValue);
107
107
  break;
108
108
  }
109
+ if (ami.startsWith("ssm:")) {
110
+ const ssmParam = ami.substring("ssm:".length);
111
+ console.log(`Checking SSM ${ssmParam}`);
112
+ const ssmValue = (await ssm.send(new import_client_ssm.GetParameterCommand({ Name: ssmParam }))).Parameter?.Value;
113
+ if (!ssmValue) {
114
+ await customResourceRespond(event, "FAILED", `${ami} has no value`, "ERROR", {});
115
+ break;
116
+ }
117
+ await handleAmi(event, ssmValue);
118
+ break;
119
+ }
109
120
  if (ami.startsWith("lt-")) {
110
121
  console.log(`Checking Launch Template ${ami}`);
111
122
  const lts = await ec2.send(new import_client_ec2.DescribeLaunchTemplateVersionsCommand({ LaunchTemplateId: ami, Versions: ["$Latest"] }));
package/lib/access.js CHANGED
@@ -59,7 +59,7 @@ class LambdaAccess {
59
59
  }
60
60
  exports.LambdaAccess = LambdaAccess;
61
61
  _a = JSII_RTTI_SYMBOL_1;
62
- LambdaAccess[_a] = { fqn: "@cloudsnorkel/cdk-github-runners.LambdaAccess", version: "0.14.18" };
62
+ LambdaAccess[_a] = { fqn: "@cloudsnorkel/cdk-github-runners.LambdaAccess", version: "0.14.19" };
63
63
  /**
64
64
  * @internal
65
65
  */
@@ -43,5 +43,5 @@ class RunnerImageBuilder extends common_1.RunnerImageBuilderBase {
43
43
  }
44
44
  exports.RunnerImageBuilder = RunnerImageBuilder;
45
45
  _a = JSII_RTTI_SYMBOL_1;
46
- RunnerImageBuilder[_a] = { fqn: "@cloudsnorkel/cdk-github-runners.RunnerImageBuilder", version: "0.14.18" };
46
+ RunnerImageBuilder[_a] = { fqn: "@cloudsnorkel/cdk-github-runners.RunnerImageBuilder", version: "0.14.19" };
47
47
  //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYXBpLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL2ltYWdlLWJ1aWxkZXJzL2FwaS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLDZDQUEwQztBQUUxQywyREFBd0U7QUFDeEUsMkNBQTBEO0FBQzFELHFDQUFvSTtBQUNwSSw0Q0FBa0M7QUFFbEM7Ozs7OztHQU1HO0FBQ0gsTUFBc0Isa0JBQW1CLFNBQVEsK0JBQXNCO0lBQ3JFOztPQUVHO0lBQ0gsTUFBTSxDQUFDLEdBQUcsQ0FBQyxLQ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