@cloudsnorkel/cdk-github-runners 0.9.1 → 0.9.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 (32) hide show
  1. package/.jsii +272 -25
  2. package/API.md +215 -0
  3. package/assets/lambdas/setup.lambda/index.js +10 -6
  4. package/assets/lambdas/status.lambda/index.js +22 -10
  5. package/assets/lambdas/webhook-handler.lambda/index.js +15 -7
  6. package/lib/access.d.ts +65 -0
  7. package/lib/access.js +160 -0
  8. package/lib/index.d.ts +1 -0
  9. package/lib/index.js +2 -1
  10. package/lib/lambdas/setup.lambda.js +11 -7
  11. package/lib/lambdas/status.lambda.js +24 -11
  12. package/lib/lambdas/webhook-handler.lambda.js +19 -10
  13. package/lib/providers/codebuild.js +2 -2
  14. package/lib/providers/common.js +3 -3
  15. package/lib/providers/ec2.js +2 -2
  16. package/lib/providers/fargate.js +2 -2
  17. package/lib/providers/image-builders/api.js +1 -1
  18. package/lib/providers/image-builders/aws-image-builder/builder.js +1 -1
  19. package/lib/providers/image-builders/aws-image-builder/deprecated/ami.js +1 -1
  20. package/lib/providers/image-builders/aws-image-builder/deprecated/container.js +1 -1
  21. package/lib/providers/image-builders/aws-image-builder/deprecated/linux-components.js +1 -1
  22. package/lib/providers/image-builders/aws-image-builder/deprecated/windows-components.js +1 -1
  23. package/lib/providers/image-builders/codebuild-deprecated.js +1 -1
  24. package/lib/providers/image-builders/components.js +1 -1
  25. package/lib/providers/image-builders/static.js +1 -1
  26. package/lib/providers/lambda.js +2 -2
  27. package/lib/runner.d.ts +23 -0
  28. package/lib/runner.js +13 -4
  29. package/lib/secrets.js +1 -1
  30. package/lib/webhook.d.ts +5 -0
  31. package/lib/webhook.js +5 -4
  32. package/package.json +1 -1
package/.jsii CHANGED
@@ -3828,6 +3828,86 @@
3828
3828
  ],
3829
3829
  "symbolId": "src/providers/image-builders/aws-image-builder/deprecated/ami:AmiBuilderProps"
3830
3830
  },
3831
+ "@cloudsnorkel/cdk-github-runners.ApiGatewayAccessProps": {
3832
+ "assembly": "@cloudsnorkel/cdk-github-runners",
3833
+ "datatype": true,
3834
+ "docs": {
3835
+ "stability": "experimental"
3836
+ },
3837
+ "fqn": "@cloudsnorkel/cdk-github-runners.ApiGatewayAccessProps",
3838
+ "kind": "interface",
3839
+ "locationInModule": {
3840
+ "filename": "src/access.ts",
3841
+ "line": 9
3842
+ },
3843
+ "name": "ApiGatewayAccessProps",
3844
+ "properties": [
3845
+ {
3846
+ "abstract": true,
3847
+ "docs": {
3848
+ "remarks": "If not specified on public API Gateway, all IP addresses are allowed.\n\nIf not specified on private API Gateway, no IP addresses are allowed (but specified security groups are).",
3849
+ "stability": "experimental",
3850
+ "summary": "List of IP addresses in CIDR notation that are allowed to access the API Gateway."
3851
+ },
3852
+ "immutable": true,
3853
+ "locationInModule": {
3854
+ "filename": "src/access.ts",
3855
+ "line": 17
3856
+ },
3857
+ "name": "allowedIps",
3858
+ "optional": true,
3859
+ "type": {
3860
+ "collection": {
3861
+ "elementtype": {
3862
+ "primitive": "string"
3863
+ },
3864
+ "kind": "array"
3865
+ }
3866
+ }
3867
+ },
3868
+ {
3869
+ "abstract": true,
3870
+ "docs": {
3871
+ "remarks": "Only works for private API Gateways with {@link allowedVpc}.",
3872
+ "stability": "experimental",
3873
+ "summary": "List of security groups that are allowed to access the API Gateway."
3874
+ },
3875
+ "immutable": true,
3876
+ "locationInModule": {
3877
+ "filename": "src/access.ts",
3878
+ "line": 29
3879
+ },
3880
+ "name": "allowedSecurityGroups",
3881
+ "optional": true,
3882
+ "type": {
3883
+ "collection": {
3884
+ "elementtype": {
3885
+ "fqn": "aws-cdk-lib.aws_ec2.ISecurityGroup"
3886
+ },
3887
+ "kind": "array"
3888
+ }
3889
+ }
3890
+ },
3891
+ {
3892
+ "abstract": true,
3893
+ "docs": {
3894
+ "stability": "experimental",
3895
+ "summary": "Creates a private API Gateway and allows access from the specified VPC."
3896
+ },
3897
+ "immutable": true,
3898
+ "locationInModule": {
3899
+ "filename": "src/access.ts",
3900
+ "line": 22
3901
+ },
3902
+ "name": "allowedVpc",
3903
+ "optional": true,
3904
+ "type": {
3905
+ "fqn": "aws-cdk-lib.aws_ec2.IVpc"
3906
+ }
3907
+ }
3908
+ ],
3909
+ "symbolId": "src/access:ApiGatewayAccessProps"
3910
+ },
3831
3911
  "@cloudsnorkel/cdk-github-runners.Architecture": {
3832
3912
  "assembly": "@cloudsnorkel/cdk-github-runners",
3833
3913
  "docs": {
@@ -7393,7 +7473,7 @@
7393
7473
  },
7394
7474
  "locationInModule": {
7395
7475
  "filename": "src/runner.ts",
7396
- "line": 191
7476
+ "line": 218
7397
7477
  },
7398
7478
  "parameters": [
7399
7479
  {
@@ -7420,7 +7500,7 @@
7420
7500
  "kind": "class",
7421
7501
  "locationInModule": {
7422
7502
  "filename": "src/runner.ts",
7423
- "line": 172
7503
+ "line": 199
7424
7504
  },
7425
7505
  "methods": [
7426
7506
  {
@@ -7431,7 +7511,7 @@
7431
7511
  },
7432
7512
  "locationInModule": {
7433
7513
  "filename": "src/runner.ts",
7434
- "line": 565
7514
+ "line": 607
7435
7515
  },
7436
7516
  "name": "metricFailed",
7437
7517
  "parameters": [
@@ -7457,7 +7537,7 @@
7457
7537
  },
7458
7538
  "locationInModule": {
7459
7539
  "filename": "src/runner.ts",
7460
- "line": 510
7540
+ "line": 552
7461
7541
  },
7462
7542
  "name": "metricJobCompleted",
7463
7543
  "parameters": [
@@ -7483,7 +7563,7 @@
7483
7563
  },
7484
7564
  "locationInModule": {
7485
7565
  "filename": "src/runner.ts",
7486
- "line": 556
7566
+ "line": 598
7487
7567
  },
7488
7568
  "name": "metricSucceeded",
7489
7569
  "parameters": [
@@ -7509,7 +7589,7 @@
7509
7589
  },
7510
7590
  "locationInModule": {
7511
7591
  "filename": "src/runner.ts",
7512
- "line": 572
7592
+ "line": 614
7513
7593
  },
7514
7594
  "name": "metricTime",
7515
7595
  "parameters": [
@@ -7538,7 +7618,7 @@
7538
7618
  "immutable": true,
7539
7619
  "locationInModule": {
7540
7620
  "filename": "src/runner.ts",
7541
- "line": 176
7621
+ "line": 203
7542
7622
  },
7543
7623
  "name": "providers",
7544
7624
  "type": {
@@ -7558,7 +7638,7 @@
7558
7638
  "immutable": true,
7559
7639
  "locationInModule": {
7560
7640
  "filename": "src/runner.ts",
7561
- "line": 181
7641
+ "line": 208
7562
7642
  },
7563
7643
  "name": "secrets",
7564
7644
  "type": {
@@ -7572,7 +7652,7 @@
7572
7652
  "immutable": true,
7573
7653
  "locationInModule": {
7574
7654
  "filename": "src/runner.ts",
7575
- "line": 191
7655
+ "line": 218
7576
7656
  },
7577
7657
  "name": "props",
7578
7658
  "optional": true,
@@ -7594,7 +7674,7 @@
7594
7674
  "kind": "interface",
7595
7675
  "locationInModule": {
7596
7676
  "filename": "src/runner.ts",
7597
- "line": 29
7677
+ "line": 30
7598
7678
  },
7599
7679
  "name": "GitHubRunnersProps",
7600
7680
  "properties": [
@@ -7609,7 +7689,7 @@
7609
7689
  "immutable": true,
7610
7690
  "locationInModule": {
7611
7691
  "filename": "src/runner.ts",
7612
- "line": 52
7692
+ "line": 53
7613
7693
  },
7614
7694
  "name": "allowPublicSubnet",
7615
7695
  "optional": true,
@@ -7627,7 +7707,7 @@
7627
7707
  "immutable": true,
7628
7708
  "locationInModule": {
7629
7709
  "filename": "src/runner.ts",
7630
- "line": 82
7710
+ "line": 83
7631
7711
  },
7632
7712
  "name": "extraCertificates",
7633
7713
  "optional": true,
@@ -7646,7 +7726,7 @@
7646
7726
  "immutable": true,
7647
7727
  "locationInModule": {
7648
7728
  "filename": "src/runner.ts",
7649
- "line": 89
7729
+ "line": 90
7650
7730
  },
7651
7731
  "name": "idleTimeout",
7652
7732
  "optional": true,
@@ -7664,7 +7744,7 @@
7664
7744
  "immutable": true,
7665
7745
  "locationInModule": {
7666
7746
  "filename": "src/runner.ts",
7667
- "line": 96
7747
+ "line": 97
7668
7748
  },
7669
7749
  "name": "logOptions",
7670
7750
  "optional": true,
@@ -7683,7 +7763,7 @@
7683
7763
  "immutable": true,
7684
7764
  "locationInModule": {
7685
7765
  "filename": "src/runner.ts",
7686
- "line": 35
7766
+ "line": 36
7687
7767
  },
7688
7768
  "name": "providers",
7689
7769
  "optional": true,
@@ -7706,7 +7786,7 @@
7706
7786
  "immutable": true,
7707
7787
  "locationInModule": {
7708
7788
  "filename": "src/runner.ts",
7709
- "line": 57
7789
+ "line": 58
7710
7790
  },
7711
7791
  "name": "securityGroup",
7712
7792
  "optional": true,
@@ -7714,6 +7794,44 @@
7714
7794
  "fqn": "aws-cdk-lib.aws_ec2.ISecurityGroup"
7715
7795
  }
7716
7796
  },
7797
+ {
7798
+ "abstract": true,
7799
+ "docs": {
7800
+ "default": "LambdaAccess.lambdaUrl()",
7801
+ "remarks": "Once you finish the setup process, you can set this to `LambdaAccess.noAccess()` to remove access to the setup function. You can also use `LambdaAccess.apiGateway({ allowedIps: ['my-ip/0']})` to limit access to your IP only.",
7802
+ "stability": "experimental",
7803
+ "summary": "Access configuration for the setup function."
7804
+ },
7805
+ "immutable": true,
7806
+ "locationInModule": {
7807
+ "filename": "src/runner.ts",
7808
+ "line": 104
7809
+ },
7810
+ "name": "setupAccess",
7811
+ "optional": true,
7812
+ "type": {
7813
+ "fqn": "@cloudsnorkel/cdk-github-runners.LambdaAccess"
7814
+ }
7815
+ },
7816
+ {
7817
+ "abstract": true,
7818
+ "docs": {
7819
+ "default": "LambdaAccess.noAccess()",
7820
+ "remarks": "This function returns a lot of sensitive information about the runner, so you should only allow access to it from trusted IPs, if at all.",
7821
+ "stability": "experimental",
7822
+ "summary": "Access configuration for the status function."
7823
+ },
7824
+ "immutable": true,
7825
+ "locationInModule": {
7826
+ "filename": "src/runner.ts",
7827
+ "line": 123
7828
+ },
7829
+ "name": "statusAccess",
7830
+ "optional": true,
7831
+ "type": {
7832
+ "fqn": "@cloudsnorkel/cdk-github-runners.LambdaAccess"
7833
+ }
7834
+ },
7717
7835
  {
7718
7836
  "abstract": true,
7719
7837
  "docs": {
@@ -7724,7 +7842,7 @@
7724
7842
  "immutable": true,
7725
7843
  "locationInModule": {
7726
7844
  "filename": "src/runner.ts",
7727
- "line": 40
7845
+ "line": 41
7728
7846
  },
7729
7847
  "name": "vpc",
7730
7848
  "optional": true,
@@ -7742,13 +7860,32 @@
7742
7860
  "immutable": true,
7743
7861
  "locationInModule": {
7744
7862
  "filename": "src/runner.ts",
7745
- "line": 45
7863
+ "line": 46
7746
7864
  },
7747
7865
  "name": "vpcSubnets",
7748
7866
  "optional": true,
7749
7867
  "type": {
7750
7868
  "fqn": "aws-cdk-lib.aws_ec2.SubnetSelection"
7751
7869
  }
7870
+ },
7871
+ {
7872
+ "abstract": true,
7873
+ "docs": {
7874
+ "default": "LambdaAccess.lambdaUrl()",
7875
+ "remarks": "This function is called by GitHub when a new workflow job is scheduled. For an extra layer of security, you can set this to `LambdaAccess.apiGateway({ allowedIps: LambdaAccess.githubWebhookIps() })`.\n\nYou can also set this to `LambdaAccess.privateApiGateway()` if your GitHub Enterprise Server is hosted in a VPC. This will create an API Gateway endpoint that's only accessible from within the VPC.\n\n*WARNING*: changing access type may change the URL. When the URL changes, you must update GitHub as well.",
7876
+ "stability": "experimental",
7877
+ "summary": "Access configuration for the webhook function."
7878
+ },
7879
+ "immutable": true,
7880
+ "locationInModule": {
7881
+ "filename": "src/runner.ts",
7882
+ "line": 116
7883
+ },
7884
+ "name": "webhookAccess",
7885
+ "optional": true,
7886
+ "type": {
7887
+ "fqn": "@cloudsnorkel/cdk-github-runners.LambdaAccess"
7888
+ }
7752
7889
  }
7753
7890
  ],
7754
7891
  "symbolId": "src/runner:GitHubRunnersProps"
@@ -8566,6 +8703,116 @@
8566
8703
  ],
8567
8704
  "symbolId": "src/providers/image-builders/aws-image-builder/builder:ImageBuilderComponentProperties"
8568
8705
  },
8706
+ "@cloudsnorkel/cdk-github-runners.LambdaAccess": {
8707
+ "abstract": true,
8708
+ "assembly": "@cloudsnorkel/cdk-github-runners",
8709
+ "docs": {
8710
+ "remarks": "Use this to limit access to these functions.",
8711
+ "stability": "experimental",
8712
+ "summary": "Access configuration options for Lambda functions like setup and webhook function."
8713
+ },
8714
+ "fqn": "@cloudsnorkel/cdk-github-runners.LambdaAccess",
8715
+ "initializer": {
8716
+ "docs": {
8717
+ "stability": "experimental"
8718
+ }
8719
+ },
8720
+ "kind": "class",
8721
+ "locationInModule": {
8722
+ "filename": "src/access.ts",
8723
+ "line": 35
8724
+ },
8725
+ "methods": [
8726
+ {
8727
+ "docs": {
8728
+ "remarks": "This is the most secure option, but requires additional configuration. It allows you to limit access to specific IP addresses and even to a specific VPC.\n\nTo limit access to GitHub.com use:\n\n```\nLambdaAccess.apiGateway({\n allowedIps: LambdaAccess.githubWebhookIps(),\n});\n```\n\nAlternatively, get and manually update the list manually with:\n\n```\ncurl https://api.github.com/meta | jq .hooks\n```",
8729
+ "stability": "experimental",
8730
+ "summary": "Provide access using API Gateway."
8731
+ },
8732
+ "locationInModule": {
8733
+ "filename": "src/access.ts",
8734
+ "line": 67
8735
+ },
8736
+ "name": "apiGateway",
8737
+ "parameters": [
8738
+ {
8739
+ "name": "props",
8740
+ "optional": true,
8741
+ "type": {
8742
+ "fqn": "@cloudsnorkel/cdk-github-runners.ApiGatewayAccessProps"
8743
+ }
8744
+ }
8745
+ ],
8746
+ "returns": {
8747
+ "type": {
8748
+ "fqn": "@cloudsnorkel/cdk-github-runners.LambdaAccess"
8749
+ }
8750
+ },
8751
+ "static": true
8752
+ },
8753
+ {
8754
+ "docs": {
8755
+ "remarks": "Note that downloading dynamic data during deployment is not recommended in CDK. This is a workaround for the lack of a better solution.",
8756
+ "stability": "experimental",
8757
+ "summary": "Downloads the list of IP addresses used by GitHub.com for webhooks."
8758
+ },
8759
+ "locationInModule": {
8760
+ "filename": "src/access.ts",
8761
+ "line": 76
8762
+ },
8763
+ "name": "githubWebhookIps",
8764
+ "returns": {
8765
+ "type": {
8766
+ "collection": {
8767
+ "elementtype": {
8768
+ "primitive": "string"
8769
+ },
8770
+ "kind": "array"
8771
+ }
8772
+ }
8773
+ },
8774
+ "static": true
8775
+ },
8776
+ {
8777
+ "docs": {
8778
+ "remarks": "This is the default and simplest option. It puts no limits on the requester, but the Lambda functions themselves authenticate every request.",
8779
+ "stability": "experimental",
8780
+ "summary": "Provide access using Lambda URL."
8781
+ },
8782
+ "locationInModule": {
8783
+ "filename": "src/access.ts",
8784
+ "line": 46
8785
+ },
8786
+ "name": "lambdaUrl",
8787
+ "returns": {
8788
+ "type": {
8789
+ "fqn": "@cloudsnorkel/cdk-github-runners.LambdaAccess"
8790
+ }
8791
+ },
8792
+ "static": true
8793
+ },
8794
+ {
8795
+ "docs": {
8796
+ "remarks": "This is useful for the setup function after setup is done.",
8797
+ "stability": "experimental",
8798
+ "summary": "Disables access to the configured Lambda function."
8799
+ },
8800
+ "locationInModule": {
8801
+ "filename": "src/access.ts",
8802
+ "line": 39
8803
+ },
8804
+ "name": "noAccess",
8805
+ "returns": {
8806
+ "type": {
8807
+ "fqn": "@cloudsnorkel/cdk-github-runners.LambdaAccess"
8808
+ }
8809
+ },
8810
+ "static": true
8811
+ }
8812
+ ],
8813
+ "name": "LambdaAccess",
8814
+ "symbolId": "src/access:LambdaAccess"
8815
+ },
8569
8816
  "@cloudsnorkel/cdk-github-runners.LambdaRunner": {
8570
8817
  "assembly": "@cloudsnorkel/cdk-github-runners",
8571
8818
  "base": "@cloudsnorkel/cdk-github-runners.LambdaRunnerProvider",
@@ -9552,7 +9799,7 @@
9552
9799
  "kind": "interface",
9553
9800
  "locationInModule": {
9554
9801
  "filename": "src/runner.ts",
9555
- "line": 102
9802
+ "line": 129
9556
9803
  },
9557
9804
  "name": "LogOptions",
9558
9805
  "properties": [
@@ -9566,7 +9813,7 @@
9566
9813
  "immutable": true,
9567
9814
  "locationInModule": {
9568
9815
  "filename": "src/runner.ts",
9569
- "line": 113
9816
+ "line": 140
9570
9817
  },
9571
9818
  "name": "includeExecutionData",
9572
9819
  "optional": true,
@@ -9584,7 +9831,7 @@
9584
9831
  "immutable": true,
9585
9832
  "locationInModule": {
9586
9833
  "filename": "src/runner.ts",
9587
- "line": 120
9834
+ "line": 147
9588
9835
  },
9589
9836
  "name": "level",
9590
9837
  "optional": true,
@@ -9601,7 +9848,7 @@
9601
9848
  "immutable": true,
9602
9849
  "locationInModule": {
9603
9850
  "filename": "src/runner.ts",
9604
- "line": 106
9851
+ "line": 133
9605
9852
  },
9606
9853
  "name": "logGroupName",
9607
9854
  "optional": true,
@@ -9620,7 +9867,7 @@
9620
9867
  "immutable": true,
9621
9868
  "locationInModule": {
9622
9869
  "filename": "src/runner.ts",
9623
- "line": 129
9870
+ "line": 156
9624
9871
  },
9625
9872
  "name": "logRetention",
9626
9873
  "optional": true,
@@ -11974,6 +12221,6 @@
11974
12221
  "symbolId": "src/providers/image-builders/aws-image-builder/deprecated/windows-components:WindowsComponents"
11975
12222
  }
11976
12223
  },
11977
- "version": "0.9.1",
11978
- "fingerprint": "pN+Ba8VB2RduK8aFdSqAxG4DnTY/Z9GUJWMHEucUgjc="
12224
+ "version": "0.9.2",
12225
+ "fingerprint": "zmHG8ogvxM4UnuobG3q57zcoNzxuIu+sExYrdG2uOo8="
11979
12226
  }