@cloudsnorkel/cdk-github-runners 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.jsii CHANGED
@@ -3167,6 +3167,29 @@
3167
3167
  "line": 149
3168
3168
  },
3169
3169
  "methods": [
3170
+ {
3171
+ "docs": {
3172
+ "remarks": "All first party Dockerfiles support this. Others may not.",
3173
+ "stability": "experimental",
3174
+ "summary": "Add extra trusted certificates. This helps deal with self-signed certificates for GitHub Enterprise Server."
3175
+ },
3176
+ "locationInModule": {
3177
+ "filename": "src/providers/image-builders/codebuild.ts",
3178
+ "line": 271
3179
+ },
3180
+ "name": "addExtraCertificates",
3181
+ "parameters": [
3182
+ {
3183
+ "docs": {
3184
+ "summary": "path to directory containing a file called certs.pem containing all the required certificates."
3185
+ },
3186
+ "name": "path",
3187
+ "type": {
3188
+ "primitive": "string"
3189
+ }
3190
+ }
3191
+ ]
3192
+ },
3170
3193
  {
3171
3194
  "docs": {
3172
3195
  "stability": "experimental",
@@ -3271,7 +3294,7 @@
3271
3294
  },
3272
3295
  "locationInModule": {
3273
3296
  "filename": "src/providers/image-builders/codebuild.ts",
3274
- "line": 267
3297
+ "line": 281
3275
3298
  },
3276
3299
  "name": "bind",
3277
3300
  "overrides": "@cloudsnorkel/cdk-github-runners.IImageBuilder",
@@ -4421,7 +4444,7 @@
4421
4444
  "assembly": "@cloudsnorkel/cdk-github-runners",
4422
4445
  "base": "constructs.Construct",
4423
4446
  "docs": {
4424
- "remarks": "It creates a webhook, secrets, and a step function to orchestrate all runs. Secrets are not automatically filled. See README.md for instructions on how to setup GitHub integration.\n\nBy 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.\n\n```typescript\nnew GitHubRunners(stack, 'runners', {});\n```\n\nUsually you'd want to configure the runner providers so the runners can run in a certain VPC or have certain permissions.\n\n```typescript\nconst vpc = ec2.Vpc.fromLookup(stack, 'vpc', { vpcId: 'vpc-1234567' });\nconst runnerSg = new ec2.SecurityGroup(stack, 'runner security group', { vpc: vpc });\nconst dbSg = ec2.SecurityGroup.fromSecurityGroupId(stack, 'database security group', 'sg-1234567');\nconst bucket = new s3.Bucket(stack, 'runner bucket');\n\n// create a custom CodeBuild provider\nconst myProvider = new CodeBuildRunner(\n stack, 'codebuild runner',\n {\n label: 'my-codebuild',\n vpc: vpc,\n securityGroup: runnerSg,\n },\n);\n// grant some permissions to the provider\nbucket.grantReadWrite(myProvider);\ndbSg.connections.allowFrom(runnerSg, ec2.Port.tcp(3306), 'allow runners to connect to MySQL database');\n\n// create the runner infrastructure\nnew GitHubRunners(\n stack,\n 'runners',\n {\n providers: [myProvider],\n }\n);\n```",
4447
+ "remarks": "It creates a webhook, secrets, and a step function to orchestrate all runs. Secrets are not automatically filled. See README.md for instructions on how to setup GitHub integration.\n\nBy 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.\n\n```typescript\nnew GitHubRunners(this, 'runners');\n```\n\nUsually you'd want to configure the runner providers so the runners can run in a certain VPC or have certain permissions.\n\n```typescript\nconst vpc = ec2.Vpc.fromLookup(this, 'vpc', { vpcId: 'vpc-1234567' });\nconst runnerSg = new ec2.SecurityGroup(this, 'runner security group', { vpc: vpc });\nconst dbSg = ec2.SecurityGroup.fromSecurityGroupId(this, 'database security group', 'sg-1234567');\nconst bucket = new s3.Bucket(this, 'runner bucket');\n\n// create a custom CodeBuild provider\nconst myProvider = new CodeBuildRunner(\n this, 'codebuild runner',\n {\n label: 'my-codebuild',\n vpc: vpc,\n securityGroup: runnerSg,\n },\n);\n// grant some permissions to the provider\nbucket.grantReadWrite(myProvider);\ndbSg.connections.allowFrom(runnerSg, ec2.Port.tcp(3306), 'allow runners to connect to MySQL database');\n\n// create the runner infrastructure\nnew GitHubRunners(\n this,\n 'runners',\n {\n providers: [myProvider],\n }\n);\n```",
4425
4448
  "stability": "experimental",
4426
4449
  "summary": "Create all the required infrastructure to provide self-hosted GitHub runners."
4427
4450
  },
@@ -4432,7 +4455,7 @@
4432
4455
  },
4433
4456
  "locationInModule": {
4434
4457
  "filename": "src/runner.ts",
4435
- "line": 83
4458
+ "line": 140
4436
4459
  },
4437
4460
  "parameters": [
4438
4461
  {
@@ -4459,7 +4482,7 @@
4459
4482
  "kind": "class",
4460
4483
  "locationInModule": {
4461
4484
  "filename": "src/runner.ts",
4462
- "line": 65
4485
+ "line": 120
4463
4486
  },
4464
4487
  "name": "GitHubRunners",
4465
4488
  "properties": [
@@ -4471,7 +4494,7 @@
4471
4494
  "immutable": true,
4472
4495
  "locationInModule": {
4473
4496
  "filename": "src/runner.ts",
4474
- "line": 72
4497
+ "line": 127
4475
4498
  },
4476
4499
  "name": "providers",
4477
4500
  "type": {
@@ -4491,7 +4514,7 @@
4491
4514
  "immutable": true,
4492
4515
  "locationInModule": {
4493
4516
  "filename": "src/runner.ts",
4494
- "line": 77
4517
+ "line": 132
4495
4518
  },
4496
4519
  "name": "secrets",
4497
4520
  "type": {
@@ -4512,10 +4535,47 @@
4512
4535
  "kind": "interface",
4513
4536
  "locationInModule": {
4514
4537
  "filename": "src/runner.ts",
4515
- "line": 16
4538
+ "line": 22
4516
4539
  },
4517
4540
  "name": "GitHubRunnersProps",
4518
4541
  "properties": [
4542
+ {
4543
+ "abstract": true,
4544
+ "docs": {
4545
+ "default": "false",
4546
+ "remarks": "Lambda Functions in a public subnet can NOT access the internet.",
4547
+ "stability": "experimental",
4548
+ "summary": "Allow management functions to run in public subnets."
4549
+ },
4550
+ "immutable": true,
4551
+ "locationInModule": {
4552
+ "filename": "src/runner.ts",
4553
+ "line": 45
4554
+ },
4555
+ "name": "allowPublicSubnet",
4556
+ "optional": true,
4557
+ "type": {
4558
+ "primitive": "boolean"
4559
+ }
4560
+ },
4561
+ {
4562
+ "abstract": true,
4563
+ "docs": {
4564
+ "remarks": "You may also want to use custom images for your runner providers that contain the same certificates. See {@link CodeBuildImageBuilder.addCertificates}.\n\n```typescript\nconst imageBuilder = new CodeBuildImageBuilder(this, 'Image Builder with Certs', {\n dockerfilePath: CodeBuildRunner.LINUX_X64_DOCKERFILE_PATH,\n});\nimageBuilder.addExtraCertificates('path-to-my-extra-certs-folder');\n\nconst provider = new CodeBuildRunner(this, 'CodeBuild', {\n imageBuilder: imageBuilder,\n});\n\nnew GitHubRunners(\n this,\n 'runners',\n {\n providers: [provider],\n extraCertificates: 'path-to-my-extra-certs-folder',\n }\n);\n```",
4565
+ "stability": "experimental",
4566
+ "summary": "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."
4567
+ },
4568
+ "immutable": true,
4569
+ "locationInModule": {
4570
+ "filename": "src/runner.ts",
4571
+ "line": 77
4572
+ },
4573
+ "name": "extraCertificates",
4574
+ "optional": true,
4575
+ "type": {
4576
+ "primitive": "string"
4577
+ }
4578
+ },
4519
4579
  {
4520
4580
  "abstract": true,
4521
4581
  "docs": {
@@ -4527,7 +4587,7 @@
4527
4587
  "immutable": true,
4528
4588
  "locationInModule": {
4529
4589
  "filename": "src/runner.ts",
4530
- "line": 22
4590
+ "line": 28
4531
4591
  },
4532
4592
  "name": "providers",
4533
4593
  "optional": true,
@@ -4539,6 +4599,60 @@
4539
4599
  "kind": "array"
4540
4600
  }
4541
4601
  }
4602
+ },
4603
+ {
4604
+ "abstract": true,
4605
+ "docs": {
4606
+ "remarks": "Use this with to provide access to GitHub Enterprise Server hosted inside a VPC.",
4607
+ "stability": "experimental",
4608
+ "summary": "Security group attached to all management functions."
4609
+ },
4610
+ "immutable": true,
4611
+ "locationInModule": {
4612
+ "filename": "src/runner.ts",
4613
+ "line": 50
4614
+ },
4615
+ "name": "securityGroup",
4616
+ "optional": true,
4617
+ "type": {
4618
+ "fqn": "aws-cdk-lib.aws_ec2.ISecurityGroup"
4619
+ }
4620
+ },
4621
+ {
4622
+ "abstract": true,
4623
+ "docs": {
4624
+ "remarks": "Use this with GitHub Enterprise Server hosted that's inaccessible from outside the VPC.",
4625
+ "stability": "experimental",
4626
+ "summary": "VPC used for all management functions."
4627
+ },
4628
+ "immutable": true,
4629
+ "locationInModule": {
4630
+ "filename": "src/runner.ts",
4631
+ "line": 33
4632
+ },
4633
+ "name": "vpc",
4634
+ "optional": true,
4635
+ "type": {
4636
+ "fqn": "aws-cdk-lib.aws_ec2.IVpc"
4637
+ }
4638
+ },
4639
+ {
4640
+ "abstract": true,
4641
+ "docs": {
4642
+ "remarks": "Use this with GitHub Enterprise Server hosted that's inaccessible from outside the VPC.",
4643
+ "stability": "experimental",
4644
+ "summary": "VPC subnets used for all management functions."
4645
+ },
4646
+ "immutable": true,
4647
+ "locationInModule": {
4648
+ "filename": "src/runner.ts",
4649
+ "line": 38
4650
+ },
4651
+ "name": "vpcSubnets",
4652
+ "optional": true,
4653
+ "type": {
4654
+ "fqn": "aws-cdk-lib.aws_ec2.SubnetSelection"
4655
+ }
4542
4656
  }
4543
4657
  ],
4544
4658
  "symbolId": "src/runner:GitHubRunnersProps"
@@ -5740,6 +5854,6 @@
5740
5854
  "symbolId": "src/providers/image-builders/static:StaticRunnerImage"
5741
5855
  }
5742
5856
  },
5743
- "version": "0.3.0",
5744
- "fingerprint": "BbcPeU/UMTYhijuLgnABdbWc76bh1KhE/IYBv9sCMz8="
5857
+ "version": "0.3.1",
5858
+ "fingerprint": "mO1CotXTw7dyIyYAuK+dlrSJ0ioDpaMEfXc4kKbJBvY="
5745
5859
  }
package/API.md CHANGED
@@ -68,6 +68,7 @@ new CodeBuildImageBuilder(scope: Construct, id: string, props: CodeBuildImageBui
68
68
  | **Name** | **Description** |
69
69
  | --- | --- |
70
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. |
71
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. |
72
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. |
73
74
  | <code><a href="#@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilder.addPostBuildCommand">addPostBuildCommand</a></code> | Adds a command that runs after `docker build` and `docker push`. |
@@ -85,6 +86,24 @@ public toString(): string
85
86
 
86
87
  Returns a string representation of this construct.
87
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
+
88
107
  ##### `addFiles` <a name="addFiles" id="@cloudsnorkel/cdk-github-runners.CodeBuildImageBuilder.addFiles"></a>
89
108
 
90
109
  ```typescript
@@ -814,20 +833,20 @@ It creates a webhook, secrets, and a step function to orchestrate all runs. Secr
814
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.
815
834
 
816
835
  ```typescript
817
- new GitHubRunners(stack, 'runners', {});
836
+ new GitHubRunners(this, 'runners');
818
837
  ```
819
838
 
820
839
  Usually you'd want to configure the runner providers so the runners can run in a certain VPC or have certain permissions.
821
840
 
822
841
  ```typescript
823
- const vpc = ec2.Vpc.fromLookup(stack, 'vpc', { vpcId: 'vpc-1234567' });
824
- const runnerSg = new ec2.SecurityGroup(stack, 'runner security group', { vpc: vpc });
825
- const dbSg = ec2.SecurityGroup.fromSecurityGroupId(stack, 'database security group', 'sg-1234567');
826
- 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');
827
846
 
828
847
  // create a custom CodeBuild provider
829
848
  const myProvider = new CodeBuildRunner(
830
- stack, 'codebuild runner',
849
+ this, 'codebuild runner',
831
850
  {
832
851
  label: 'my-codebuild',
833
852
  vpc: vpc,
@@ -840,7 +859,7 @@ dbSg.connections.allowFrom(runnerSg, ec2.Port.tcp(3306), 'allow runners to conne
840
859
 
841
860
  // create the runner infrastructure
842
861
  new GitHubRunners(
843
- stack,
862
+ this,
844
863
  'runners',
845
864
  {
846
865
  providers: [myProvider],
@@ -1962,7 +1981,61 @@ const gitHubRunnersProps: GitHubRunnersProps = { ... }
1962
1981
 
1963
1982
  | **Name** | **Type** | **Description** |
1964
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. |
1965
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. |
1990
+
1991
+ ---
1992
+
1993
+ ##### `allowPublicSubnet`<sup>Optional</sup> <a name="allowPublicSubnet" id="@cloudsnorkel/cdk-github-runners.GitHubRunnersProps.property.allowPublicSubnet"></a>
1994
+
1995
+ ```typescript
1996
+ public readonly allowPublicSubnet: boolean;
1997
+ ```
1998
+
1999
+ - *Type:* boolean
2000
+ - *Default:* false
2001
+
2002
+ Allow management functions to run in public subnets.
2003
+
2004
+ Lambda Functions in a public subnet can NOT access the internet.
2005
+
2006
+ ---
2007
+
2008
+ ##### `extraCertificates`<sup>Optional</sup> <a name="extraCertificates" id="@cloudsnorkel/cdk-github-runners.GitHubRunnersProps.property.extraCertificates"></a>
2009
+
2010
+ ```typescript
2011
+ public readonly extraCertificates: string;
2012
+ ```
2013
+
2014
+ - *Type:* string
2015
+
2016
+ Path to a directory containing a file named certs.pem containing any additional certificates required to trust GitHub Enterprise Server. Use this when GitHub Enterprise Server certificates are self-signed.
2017
+
2018
+ You may also want to use custom images for your runner providers that contain the same certificates. See {@link CodeBuildImageBuilder.addCertificates}.
2019
+
2020
+ ```typescript
2021
+ const imageBuilder = new CodeBuildImageBuilder(this, 'Image Builder with Certs', {
2022
+ dockerfilePath: CodeBuildRunner.LINUX_X64_DOCKERFILE_PATH,
2023
+ });
2024
+ imageBuilder.addExtraCertificates('path-to-my-extra-certs-folder');
2025
+
2026
+ const provider = new CodeBuildRunner(this, 'CodeBuild', {
2027
+ imageBuilder: imageBuilder,
2028
+ });
2029
+
2030
+ new GitHubRunners(
2031
+ this,
2032
+ 'runners',
2033
+ {
2034
+ providers: [provider],
2035
+ extraCertificates: 'path-to-my-extra-certs-folder',
2036
+ }
2037
+ );
2038
+ ```
1966
2039
 
1967
2040
  ---
1968
2041
 
@@ -1981,6 +2054,48 @@ At least one provider is required. Provider will be selected when its label matc
1981
2054
 
1982
2055
  ---
1983
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
+
1984
2099
  ### LambdaRunnerProps <a name="LambdaRunnerProps" id="@cloudsnorkel/cdk-github-runners.LambdaRunnerProps"></a>
1985
2100
 
1986
2101
  #### Initializer <a name="Initializer" id="@cloudsnorkel/cdk-github-runners.LambdaRunnerProps.Initializer"></a>
@@ -11386,9 +11386,9 @@ var require_yallist = __commonJS({
11386
11386
  }
11387
11387
  });
11388
11388
 
11389
- // node_modules/lru-cache/index.js
11389
+ // node_modules/@octokit/auth-app/node_modules/lru-cache/index.js
11390
11390
  var require_lru_cache = __commonJS({
11391
- "node_modules/lru-cache/index.js"(exports2, module2) {
11391
+ "node_modules/@octokit/auth-app/node_modules/lru-cache/index.js"(exports2, module2) {
11392
11392
  "use strict";
11393
11393
  var Yallist = require_yallist();
11394
11394
  var MAX = Symbol("max");