@cloudsnorkel/cdk-github-runners 0.14.2 → 0.14.4

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 (33) hide show
  1. package/.jsii +512 -224
  2. package/API.md +114 -0
  3. package/assets/providers/ami-root-device.lambda/index.js +13 -0
  4. package/assets/setup.lambda/index.html +1 -1
  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 +5 -0
  8. package/lib/image-builders/aws-image-builder/ami.js +12 -1
  9. package/lib/image-builders/aws-image-builder/builder.d.ts +9 -0
  10. package/lib/image-builders/aws-image-builder/builder.js +7 -5
  11. package/lib/image-builders/aws-image-builder/common.js +2 -2
  12. package/lib/image-builders/aws-image-builder/deprecated/ami.js +1 -1
  13. package/lib/image-builders/aws-image-builder/deprecated/container.js +1 -1
  14. package/lib/image-builders/aws-image-builder/deprecated/linux-components.js +1 -1
  15. package/lib/image-builders/aws-image-builder/deprecated/windows-components.js +1 -1
  16. package/lib/image-builders/codebuild-deprecated.js +1 -1
  17. package/lib/image-builders/codebuild.js +2 -2
  18. package/lib/image-builders/components.js +1 -1
  19. package/lib/image-builders/static.js +1 -1
  20. package/lib/providers/ami-root-device.lambda.js +14 -1
  21. package/lib/providers/codebuild.js +2 -2
  22. package/lib/providers/common.d.ts +35 -0
  23. package/lib/providers/common.js +8 -5
  24. package/lib/providers/ec2.d.ts +6 -1
  25. package/lib/providers/ec2.js +7 -3
  26. package/lib/providers/ecs.d.ts +5 -1
  27. package/lib/providers/ecs.js +10 -5
  28. package/lib/providers/fargate.js +4 -5
  29. package/lib/providers/lambda.js +4 -4
  30. package/lib/runner.js +7 -7
  31. package/lib/secrets.js +1 -1
  32. package/lib/webhook.js +2 -2
  33. package/package.json +15 -15
package/API.md CHANGED
@@ -5116,6 +5116,7 @@ const awsImageBuilderRunnerImageBuilderProps: AwsImageBuilderRunnerImageBuilderP
5116
5116
  | --- | --- | --- |
5117
5117
  | <code><a href="#@cloudsnorkel/cdk-github-runners.AwsImageBuilderRunnerImageBuilderProps.property.fastLaunchOptions">fastLaunchOptions</a></code> | <code><a href="#@cloudsnorkel/cdk-github-runners.FastLaunchOptions">FastLaunchOptions</a></code> | Options for fast launch. |
5118
5118
  | <code><a href="#@cloudsnorkel/cdk-github-runners.AwsImageBuilderRunnerImageBuilderProps.property.instanceType">instanceType</a></code> | <code>aws-cdk-lib.aws_ec2.InstanceType</code> | The instance type used to build the image. |
5119
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.AwsImageBuilderRunnerImageBuilderProps.property.storageSize">storageSize</a></code> | <code>aws-cdk-lib.Size</code> | Size of volume available for builder instances. This modifies the boot volume size and doesn't add any additional volumes. |
5119
5120
 
5120
5121
  ---
5121
5122
 
@@ -5147,6 +5148,21 @@ The instance type used to build the image.
5147
5148
 
5148
5149
  ---
5149
5150
 
5151
+ ##### `storageSize`<sup>Optional</sup> <a name="storageSize" id="@cloudsnorkel/cdk-github-runners.AwsImageBuilderRunnerImageBuilderProps.property.storageSize"></a>
5152
+
5153
+ ```typescript
5154
+ public readonly storageSize: Size;
5155
+ ```
5156
+
5157
+ - *Type:* aws-cdk-lib.Size
5158
+ - *Default:* default size for AMI (usually 30GB for Linux and 50GB for Windows)
5159
+
5160
+ Size of volume available for builder instances. This modifies the boot volume size and doesn't add any additional volumes.
5161
+
5162
+ Use this if you're building images with big components and need more space.
5163
+
5164
+ ---
5165
+
5150
5166
  ### CodeBuildImageBuilderProps <a name="CodeBuildImageBuilderProps" id="@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilderProps"></a>
5151
5167
 
5152
5168
  Properties for CodeBuildImageBuilder construct.
@@ -5875,6 +5891,7 @@ const ec2RunnerProviderProps: Ec2RunnerProviderProps = { ... }
5875
5891
  | <code><a href="#@cloudsnorkel/cdk-github-runners.Ec2RunnerProviderProps.property.securityGroups">securityGroups</a></code> | <code>aws-cdk-lib.aws_ec2.ISecurityGroup[]</code> | Security groups to assign to launched runner instances. |
5876
5892
  | <code><a href="#@cloudsnorkel/cdk-github-runners.Ec2RunnerProviderProps.property.spot">spot</a></code> | <code>boolean</code> | Use spot instances to save money. |
5877
5893
  | <code><a href="#@cloudsnorkel/cdk-github-runners.Ec2RunnerProviderProps.property.spotMaxPrice">spotMaxPrice</a></code> | <code>string</code> | Set a maximum price for spot instances. |
5894
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.Ec2RunnerProviderProps.property.storageOptions">storageOptions</a></code> | <code><a href="#@cloudsnorkel/cdk-github-runners.StorageOptions">StorageOptions</a></code> | Options for runner instance storage volume. |
5878
5895
  | <code><a href="#@cloudsnorkel/cdk-github-runners.Ec2RunnerProviderProps.property.storageSize">storageSize</a></code> | <code>aws-cdk-lib.Size</code> | Size of volume available for launched runner instances. |
5879
5896
  | <code><a href="#@cloudsnorkel/cdk-github-runners.Ec2RunnerProviderProps.property.subnet">subnet</a></code> | <code>aws-cdk-lib.aws_ec2.ISubnet</code> | Subnet where the runner instances will be launched. |
5880
5897
  | <code><a href="#@cloudsnorkel/cdk-github-runners.Ec2RunnerProviderProps.property.subnetSelection">subnetSelection</a></code> | <code>aws-cdk-lib.aws_ec2.SubnetSelection</code> | Where to place the network interfaces within the VPC. |
@@ -6024,6 +6041,18 @@ Set a maximum price for spot instances.
6024
6041
 
6025
6042
  ---
6026
6043
 
6044
+ ##### `storageOptions`<sup>Optional</sup> <a name="storageOptions" id="@cloudsnorkel/cdk-github-runners.Ec2RunnerProviderProps.property.storageOptions"></a>
6045
+
6046
+ ```typescript
6047
+ public readonly storageOptions: StorageOptions;
6048
+ ```
6049
+
6050
+ - *Type:* <a href="#@cloudsnorkel/cdk-github-runners.StorageOptions">StorageOptions</a>
6051
+
6052
+ Options for runner instance storage volume.
6053
+
6054
+ ---
6055
+
6027
6056
  ##### `storageSize`<sup>Optional</sup> <a name="storageSize" id="@cloudsnorkel/cdk-github-runners.Ec2RunnerProviderProps.property.storageSize"></a>
6028
6057
 
6029
6058
  ```typescript
@@ -6115,6 +6144,7 @@ const ecsRunnerProviderProps: EcsRunnerProviderProps = { ... }
6115
6144
  | <code><a href="#@cloudsnorkel/cdk-github-runners.EcsRunnerProviderProps.property.securityGroups">securityGroups</a></code> | <code>aws-cdk-lib.aws_ec2.ISecurityGroup[]</code> | Security groups to assign to the task. |
6116
6145
  | <code><a href="#@cloudsnorkel/cdk-github-runners.EcsRunnerProviderProps.property.spot">spot</a></code> | <code>boolean</code> | Use spot capacity. |
6117
6146
  | <code><a href="#@cloudsnorkel/cdk-github-runners.EcsRunnerProviderProps.property.spotMaxPrice">spotMaxPrice</a></code> | <code>string</code> | Maximum price for spot instances. |
6147
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.EcsRunnerProviderProps.property.storageOptions">storageOptions</a></code> | <code><a href="#@cloudsnorkel/cdk-github-runners.StorageOptions">StorageOptions</a></code> | Options for runner instance storage volume. |
6118
6148
  | <code><a href="#@cloudsnorkel/cdk-github-runners.EcsRunnerProviderProps.property.storageSize">storageSize</a></code> | <code>aws-cdk-lib.Size</code> | Size of volume available for launched cluster instances. |
6119
6149
  | <code><a href="#@cloudsnorkel/cdk-github-runners.EcsRunnerProviderProps.property.subnetSelection">subnetSelection</a></code> | <code>aws-cdk-lib.aws_ec2.SubnetSelection</code> | Subnets to run the runners in. |
6120
6150
  | <code><a href="#@cloudsnorkel/cdk-github-runners.EcsRunnerProviderProps.property.vpc">vpc</a></code> | <code>aws-cdk-lib.aws_ec2.IVpc</code> | VPC to launch the runners in. |
@@ -6365,6 +6395,18 @@ Maximum price for spot instances.
6365
6395
 
6366
6396
  ---
6367
6397
 
6398
+ ##### `storageOptions`<sup>Optional</sup> <a name="storageOptions" id="@cloudsnorkel/cdk-github-runners.EcsRunnerProviderProps.property.storageOptions"></a>
6399
+
6400
+ ```typescript
6401
+ public readonly storageOptions: StorageOptions;
6402
+ ```
6403
+
6404
+ - *Type:* <a href="#@cloudsnorkel/cdk-github-runners.StorageOptions">StorageOptions</a>
6405
+
6406
+ Options for runner instance storage volume.
6407
+
6408
+ ---
6409
+
6368
6410
  ##### `storageSize`<sup>Optional</sup> <a name="storageSize" id="@cloudsnorkel/cdk-github-runners.EcsRunnerProviderProps.property.storageSize"></a>
6369
6411
 
6370
6412
  ```typescript
@@ -8279,6 +8321,78 @@ Path to runner token used to register token.
8279
8321
 
8280
8322
  ---
8281
8323
 
8324
+ ### StorageOptions <a name="StorageOptions" id="@cloudsnorkel/cdk-github-runners.StorageOptions"></a>
8325
+
8326
+ Storage options for the runner instance.
8327
+
8328
+ #### Initializer <a name="Initializer" id="@cloudsnorkel/cdk-github-runners.StorageOptions.Initializer"></a>
8329
+
8330
+ ```typescript
8331
+ import { StorageOptions } from '@cloudsnorkel/cdk-github-runners'
8332
+
8333
+ const storageOptions: StorageOptions = { ... }
8334
+ ```
8335
+
8336
+ #### Properties <a name="Properties" id="Properties"></a>
8337
+
8338
+ | **Name** | **Type** | **Description** |
8339
+ | --- | --- | --- |
8340
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.StorageOptions.property.iops">iops</a></code> | <code>number</code> | The number of I/O operations per second (IOPS) to provision for the volume. |
8341
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.StorageOptions.property.throughput">throughput</a></code> | <code>number</code> | The throughput that the volume supports, in MiB/s Takes a minimum of 125 and maximum of 1000. |
8342
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.StorageOptions.property.volumeType">volumeType</a></code> | <code>aws-cdk-lib.aws_ec2.EbsDeviceVolumeType</code> | The EBS volume type. |
8343
+
8344
+ ---
8345
+
8346
+ ##### `iops`<sup>Optional</sup> <a name="iops" id="@cloudsnorkel/cdk-github-runners.StorageOptions.property.iops"></a>
8347
+
8348
+ ```typescript
8349
+ public readonly iops: number;
8350
+ ```
8351
+
8352
+ - *Type:* number
8353
+ - *Default:* none, required for `EbsDeviceVolumeType.IO1`
8354
+
8355
+ The number of I/O operations per second (IOPS) to provision for the volume.
8356
+
8357
+ Must only be set for `volumeType`: `EbsDeviceVolumeType.IO1`
8358
+
8359
+ The maximum ratio of IOPS to volume size (in GiB) is 50:1, so for 5,000 provisioned IOPS,
8360
+ you need at least 100 GiB storage on the volume.
8361
+
8362
+ > [https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html)
8363
+
8364
+ ---
8365
+
8366
+ ##### `throughput`<sup>Optional</sup> <a name="throughput" id="@cloudsnorkel/cdk-github-runners.StorageOptions.property.throughput"></a>
8367
+
8368
+ ```typescript
8369
+ public readonly throughput: number;
8370
+ ```
8371
+
8372
+ - *Type:* number
8373
+ - *Default:* 125 MiB/s. Only valid on gp3 volumes.
8374
+
8375
+ The throughput that the volume supports, in MiB/s Takes a minimum of 125 and maximum of 1000.
8376
+
8377
+ > [https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-volume.html#cfn-ec2-volume-throughput](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-volume.html#cfn-ec2-volume-throughput)
8378
+
8379
+ ---
8380
+
8381
+ ##### `volumeType`<sup>Optional</sup> <a name="volumeType" id="@cloudsnorkel/cdk-github-runners.StorageOptions.property.volumeType"></a>
8382
+
8383
+ ```typescript
8384
+ public readonly volumeType: EbsDeviceVolumeType;
8385
+ ```
8386
+
8387
+ - *Type:* aws-cdk-lib.aws_ec2.EbsDeviceVolumeType
8388
+ - *Default:* `EbsDeviceVolumeType.GP2`
8389
+
8390
+ The EBS volume type.
8391
+
8392
+ > [https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html)
8393
+
8394
+ ---
8395
+
8282
8396
  ## Classes <a name="Classes" id="Classes"></a>
8283
8397
 
8284
8398
  ### Architecture <a name="Architecture" id="@cloudsnorkel/cdk-github-runners.Architecture"></a>
@@ -24,6 +24,7 @@ __export(ami_root_device_lambda_exports, {
24
24
  });
25
25
  module.exports = __toCommonJS(ami_root_device_lambda_exports);
26
26
  var import_client_ec2 = require("@aws-sdk/client-ec2");
27
+ var import_client_imagebuilder = require("@aws-sdk/client-imagebuilder");
27
28
  var import_client_ssm = require("@aws-sdk/client-ssm");
28
29
 
29
30
  // src/lambda-helpers.ts
@@ -66,6 +67,7 @@ async function customResourceRespond(event, responseStatus, reason, physicalReso
66
67
  // src/providers/ami-root-device.lambda.ts
67
68
  var ssm = new import_client_ssm.SSMClient();
68
69
  var ec2 = new import_client_ec2.EC2Client();
70
+ var ib = new import_client_imagebuilder.ImagebuilderClient();
69
71
  async function handleAmi(event, ami) {
70
72
  const imageDescs = await ec2.send(new import_client_ec2.DescribeImagesCommand({ ImageIds: [ami] }));
71
73
  if (imageDescs.Images?.length !== 1) {
@@ -118,6 +120,17 @@ async function handler(event, context) {
118
120
  await handleAmi(event, lts.LaunchTemplateVersions[0].LaunchTemplateData.ImageId);
119
121
  break;
120
122
  }
123
+ if (ami.match("^arn:aws[^:]*:imagebuilder:[^:]+:[^:]+:image/.*$")) {
124
+ console.log(`Checking Image Builder ${ami}`);
125
+ const img = await ib.send(new import_client_imagebuilder.GetImageCommand({ imageBuildVersionArn: ami }));
126
+ const actualAmi = img.image?.outputResources?.amis?.[0]?.image;
127
+ if (!actualAmi) {
128
+ await customResourceRespond(event, "FAILED", `${ami} doesn't have an AMI`, "ERROR", {});
129
+ break;
130
+ }
131
+ await handleAmi(event, actualAmi);
132
+ break;
133
+ }
121
134
  await customResourceRespond(event, "FAILED", `Unknown type of AMI ${ami}`, "ERROR", {});
122
135
  break;
123
136
  case "Delete":