@cloudsnorkel/cdk-github-runners 0.14.15 → 0.14.16

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 (59) hide show
  1. package/.jsii +800 -274
  2. package/API.md +480 -6
  3. package/README.md +149 -0
  4. package/SETUP_GITHUB.md +99 -3
  5. package/assets/delete-failed-runner.lambda/index.js +40 -31
  6. package/assets/idle-runner-repear.lambda/index.js +40 -31
  7. package/assets/setup.lambda/index.html +12 -7
  8. package/assets/setup.lambda/index.js +26 -26
  9. package/assets/status.lambda/index.js +40 -31
  10. package/assets/token-retriever.lambda/index.js +40 -31
  11. package/assets/webhook-handler.lambda/index.js +110 -43
  12. package/assets/webhook-redelivery.lambda/index.js +40 -31
  13. package/lib/access.js +1 -1
  14. package/lib/image-builders/api.js +1 -1
  15. package/lib/image-builders/aws-image-builder/ami.d.ts +1 -2
  16. package/lib/image-builders/aws-image-builder/ami.js +6 -13
  17. package/lib/image-builders/aws-image-builder/builder.d.ts +4 -2
  18. package/lib/image-builders/aws-image-builder/builder.js +36 -34
  19. package/lib/image-builders/aws-image-builder/container.d.ts +2 -2
  20. package/lib/image-builders/aws-image-builder/container.js +7 -12
  21. package/lib/image-builders/aws-image-builder/deprecated/ami.js +1 -1
  22. package/lib/image-builders/aws-image-builder/deprecated/container.js +1 -1
  23. package/lib/image-builders/aws-image-builder/deprecated/linux-components.js +1 -1
  24. package/lib/image-builders/aws-image-builder/deprecated/windows-components.js +1 -1
  25. package/lib/image-builders/aws-image-builder/index.d.ts +0 -1
  26. package/lib/image-builders/aws-image-builder/index.js +1 -2
  27. package/lib/image-builders/aws-image-builder/workflow.d.ts +4 -4
  28. package/lib/image-builders/aws-image-builder/workflow.js +7 -10
  29. package/lib/image-builders/codebuild-deprecated.js +1 -1
  30. package/lib/image-builders/components.js +1 -1
  31. package/lib/image-builders/static.js +1 -1
  32. package/lib/index.d.ts +1 -0
  33. package/lib/index.js +2 -1
  34. package/lib/providers/codebuild.js +16 -10
  35. package/lib/providers/common.d.ts +53 -0
  36. package/lib/providers/common.js +11 -4
  37. package/lib/providers/composite.d.ts +61 -0
  38. package/lib/providers/composite.js +229 -0
  39. package/lib/providers/ec2.js +9 -8
  40. package/lib/providers/ecs.js +11 -6
  41. package/lib/providers/fargate.js +14 -9
  42. package/lib/providers/index.d.ts +1 -0
  43. package/lib/providers/index.js +2 -1
  44. package/lib/providers/lambda.js +6 -5
  45. package/lib/runner.d.ts +29 -5
  46. package/lib/runner.js +57 -24
  47. package/lib/secrets.js +1 -1
  48. package/lib/webhook-handler.lambda.d.ts +11 -0
  49. package/lib/webhook-handler.lambda.js +81 -14
  50. package/lib/webhook.d.ts +52 -7
  51. package/lib/webhook.js +4 -2
  52. package/package.json +15 -19
  53. package/assets/image-builders/aws-image-builder/versioner.lambda/index.js +0 -2115
  54. package/lib/image-builders/aws-image-builder/common.d.ts +0 -10
  55. package/lib/image-builders/aws-image-builder/common.js +0 -48
  56. package/lib/image-builders/aws-image-builder/versioner-function.d.ts +0 -13
  57. package/lib/image-builders/aws-image-builder/versioner-function.js +0 -23
  58. package/lib/image-builders/aws-image-builder/versioner.lambda.d.ts +0 -7
  59. package/lib/image-builders/aws-image-builder/versioner.lambda.js +0 -115
package/API.md CHANGED
@@ -3539,7 +3539,7 @@ Any object.
3539
3539
  | --- | --- | --- |
3540
3540
  | <code><a href="#@cloudsnorkel/cdk-github-runners.GitHubRunners.property.node">node</a></code> | <code>constructs.Node</code> | The tree node. |
3541
3541
  | <code><a href="#@cloudsnorkel/cdk-github-runners.GitHubRunners.property.connections">connections</a></code> | <code>aws-cdk-lib.aws_ec2.Connections</code> | Manage the connections of all management functions. |
3542
- | <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. |
3542
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.GitHubRunners.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> | Configured runner providers. |
3543
3543
  | <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. |
3544
3544
  | <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.* |
3545
3545
 
@@ -3576,10 +3576,10 @@ This cannot be used to manage connections of the runners. Use the `connections`
3576
3576
  ##### `providers`<sup>Required</sup> <a name="providers" id="@cloudsnorkel/cdk-github-runners.GitHubRunners.property.providers"></a>
3577
3577
 
3578
3578
  ```typescript
3579
- public readonly providers: IRunnerProvider[];
3579
+ public readonly providers: (IRunnerProvider | ICompositeProvider)[];
3580
3580
  ```
3581
3581
 
3582
- - *Type:* <a href="#@cloudsnorkel/cdk-github-runners.IRunnerProvider">IRunnerProvider</a>[]
3582
+ - *Type:* <a href="#@cloudsnorkel/cdk-github-runners.IRunnerProvider">IRunnerProvider</a> | <a href="#@cloudsnorkel/cdk-github-runners.ICompositeProvider">ICompositeProvider</a>[]
3583
3583
 
3584
3584
  Configured runner providers.
3585
3585
 
@@ -7221,7 +7221,8 @@ const gitHubRunnersProps: GitHubRunnersProps = { ... }
7221
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. |
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
- | <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. |
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. |
7225
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.GitHubRunnersProps.property.providerSelector">providerSelector</a></code> | <code>aws-cdk-lib.aws_lambda.IFunction</code> | Optional Lambda function to customize provider selection logic and label assignment. |
7225
7226
  | <code><a href="#@cloudsnorkel/cdk-github-runners.GitHubRunnersProps.property.requireSelfHostedLabel">requireSelfHostedLabel</a></code> | <code>boolean</code> | Whether to require the `self-hosted` label. |
7226
7227
  | <code><a href="#@cloudsnorkel/cdk-github-runners.GitHubRunnersProps.property.retryOptions">retryOptions</a></code> | <code><a href="#@cloudsnorkel/cdk-github-runners.ProviderRetryOptions">ProviderRetryOptions</a></code> | Options to retry operation in case of failure like missing capacity, or API quota issues. |
7227
7228
  | <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. |
@@ -7312,10 +7313,10 @@ Logging options for the state machine that manages the runners.
7312
7313
  ##### `providers`<sup>Optional</sup> <a name="providers" id="@cloudsnorkel/cdk-github-runners.GitHubRunnersProps.property.providers"></a>
7313
7314
 
7314
7315
  ```typescript
7315
- public readonly providers: IRunnerProvider[];
7316
+ public readonly providers: (IRunnerProvider | ICompositeProvider)[];
7316
7317
  ```
7317
7318
 
7318
- - *Type:* <a href="#@cloudsnorkel/cdk-github-runners.IRunnerProvider">IRunnerProvider</a>[]
7319
+ - *Type:* <a href="#@cloudsnorkel/cdk-github-runners.IRunnerProvider">IRunnerProvider</a> | <a href="#@cloudsnorkel/cdk-github-runners.ICompositeProvider">ICompositeProvider</a>[]
7319
7320
  - *Default:* CodeBuild, Lambda and Fargate runners with all the defaults (no VPC or default account VPC)
7320
7321
 
7321
7322
  List of runner providers to use.
@@ -7324,6 +7325,31 @@ At least one provider is required. Provider will be selected when its label matc
7324
7325
 
7325
7326
  ---
7326
7327
 
7328
+ ##### `providerSelector`<sup>Optional</sup> <a name="providerSelector" id="@cloudsnorkel/cdk-github-runners.GitHubRunnersProps.property.providerSelector"></a>
7329
+
7330
+ ```typescript
7331
+ public readonly providerSelector: IFunction;
7332
+ ```
7333
+
7334
+ - *Type:* aws-cdk-lib.aws_lambda.IFunction
7335
+
7336
+ Optional Lambda function to customize provider selection logic and label assignment.
7337
+
7338
+ * The function receives the webhook payload along with default provider and its labels as {@link ProviderSelectorInput }
7339
+ * The function returns a selected provider and its labels as {@link ProviderSelectorResult }
7340
+ * You can decline to provision a runner by returning undefined as the provider selector result
7341
+ * You can fully customize the labels for the about-to-be-provisioned runner (add, remove, modify, dynamic labels, etc.)
7342
+ * Labels don't have to match the labels originally configured for the provider, but see warnings below
7343
+ * This function will be called synchronously during webhook processing, so it should be fast and efficient (webhook limit is 30 seconds total)
7344
+
7345
+ **WARNING: It is your responsibility to ensure the selected provider's labels match the job's required labels. If you return the wrong labels, the runner will be created but GitHub Actions will not assign the job to it.**
7346
+
7347
+ **WARNING: Provider selection is not a guarantee that a specific provider will be assigned for the job. GitHub Actions may assign the job to any runner with matching labels. The provider selector only determines which provider's runner will be *created*, but GitHub Actions may route the job to any available runner with the required labels.**
7348
+
7349
+ **For reliable provider assignment based on job characteristics, consider using repo-level runner registration where you can control which runners are available for specific repositories. See {@link SETUP_GITHUB.md } for more details on the different registration levels. This information is also available while using the setup wizard.
7350
+
7351
+ ---
7352
+
7327
7353
  ##### `requireSelfHostedLabel`<sup>Optional</sup> <a name="requireSelfHostedLabel" id="@cloudsnorkel/cdk-github-runners.GitHubRunnersProps.property.requireSelfHostedLabel"></a>
7328
7354
 
7329
7355
  ```typescript
@@ -8022,6 +8048,138 @@ Which failures generate a retry depends on the specific provider.
8022
8048
 
8023
8049
  ---
8024
8050
 
8051
+ ### ProviderSelectorInput <a name="ProviderSelectorInput" id="@cloudsnorkel/cdk-github-runners.ProviderSelectorInput"></a>
8052
+
8053
+ Input to the provider selector Lambda function.
8054
+
8055
+ #### Initializer <a name="Initializer" id="@cloudsnorkel/cdk-github-runners.ProviderSelectorInput.Initializer"></a>
8056
+
8057
+ ```typescript
8058
+ import { ProviderSelectorInput } from '@cloudsnorkel/cdk-github-runners'
8059
+
8060
+ const providerSelectorInput: ProviderSelectorInput = { ... }
8061
+ ```
8062
+
8063
+ #### Properties <a name="Properties" id="Properties"></a>
8064
+
8065
+ | **Name** | **Type** | **Description** |
8066
+ | --- | --- | --- |
8067
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.ProviderSelectorInput.property.payload">payload</a></code> | <code>any</code> | Full GitHub webhook payload (workflow_job event structure with action="queued"). |
8068
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.ProviderSelectorInput.property.providers">providers</a></code> | <code>{[ key: string ]: string[]}</code> | Map of available provider node paths to their configured labels. |
8069
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.ProviderSelectorInput.property.defaultLabels">defaultLabels</a></code> | <code>string[]</code> | Labels that would have been used by default (the selected provider's labels). |
8070
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.ProviderSelectorInput.property.defaultProvider">defaultProvider</a></code> | <code>string</code> | Provider node path that would have been selected by default label matching. |
8071
+
8072
+ ---
8073
+
8074
+ ##### `payload`<sup>Required</sup> <a name="payload" id="@cloudsnorkel/cdk-github-runners.ProviderSelectorInput.property.payload"></a>
8075
+
8076
+ ```typescript
8077
+ public readonly payload: any;
8078
+ ```
8079
+
8080
+ - *Type:* any
8081
+
8082
+ Full GitHub webhook payload (workflow_job event structure with action="queued").
8083
+
8084
+ * Original labels requested by the workflow job can be found at `payload.workflow_job.labels`.
8085
+ * Repository path (e.g. CloudSnorkel/cdk-github-runners) is at `payload.repository.full_name`.
8086
+ * Commit hash is at `payload.workflow_job.head_sha`.
8087
+
8088
+ > [https://docs.github.com/en/webhooks/webhook-events-and-payloads?actionType=queued#workflow_job](https://docs.github.com/en/webhooks/webhook-events-and-payloads?actionType=queued#workflow_job)
8089
+
8090
+ ---
8091
+
8092
+ ##### `providers`<sup>Required</sup> <a name="providers" id="@cloudsnorkel/cdk-github-runners.ProviderSelectorInput.property.providers"></a>
8093
+
8094
+ ```typescript
8095
+ public readonly providers: {[ key: string ]: string[]};
8096
+ ```
8097
+
8098
+ - *Type:* {[ key: string ]: string[]}
8099
+
8100
+ Map of available provider node paths to their configured labels.
8101
+
8102
+ Example: { "MyStack/Small": ["linux", "small"], "MyStack/Large": ["linux", "large"] }
8103
+
8104
+ ---
8105
+
8106
+ ##### `defaultLabels`<sup>Optional</sup> <a name="defaultLabels" id="@cloudsnorkel/cdk-github-runners.ProviderSelectorInput.property.defaultLabels"></a>
8107
+
8108
+ ```typescript
8109
+ public readonly defaultLabels: string[];
8110
+ ```
8111
+
8112
+ - *Type:* string[]
8113
+
8114
+ Labels that would have been used by default (the selected provider's labels).
8115
+
8116
+ May be undefined if no provider matched by default.
8117
+
8118
+ ---
8119
+
8120
+ ##### `defaultProvider`<sup>Optional</sup> <a name="defaultProvider" id="@cloudsnorkel/cdk-github-runners.ProviderSelectorInput.property.defaultProvider"></a>
8121
+
8122
+ ```typescript
8123
+ public readonly defaultProvider: string;
8124
+ ```
8125
+
8126
+ - *Type:* string
8127
+
8128
+ Provider node path that would have been selected by default label matching.
8129
+
8130
+ Use this to easily return the default selection: `{ provider: input.defaultProvider, labels: input.defaultLabels }`
8131
+ May be undefined if no provider matched by default.
8132
+
8133
+ ---
8134
+
8135
+ ### ProviderSelectorResult <a name="ProviderSelectorResult" id="@cloudsnorkel/cdk-github-runners.ProviderSelectorResult"></a>
8136
+
8137
+ Result from the provider selector Lambda function.
8138
+
8139
+ #### Initializer <a name="Initializer" id="@cloudsnorkel/cdk-github-runners.ProviderSelectorResult.Initializer"></a>
8140
+
8141
+ ```typescript
8142
+ import { ProviderSelectorResult } from '@cloudsnorkel/cdk-github-runners'
8143
+
8144
+ const providerSelectorResult: ProviderSelectorResult = { ... }
8145
+ ```
8146
+
8147
+ #### Properties <a name="Properties" id="Properties"></a>
8148
+
8149
+ | **Name** | **Type** | **Description** |
8150
+ | --- | --- | --- |
8151
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.ProviderSelectorResult.property.labels">labels</a></code> | <code>string[]</code> | Labels to use when registering the runner. |
8152
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.ProviderSelectorResult.property.provider">provider</a></code> | <code>string</code> | Node path of the provider to use (e.g., "MyStack/MyProvider"). Must match one of the configured provider node paths from the input. If not provided, the job will be skipped (no runner created). |
8153
+
8154
+ ---
8155
+
8156
+ ##### `labels`<sup>Optional</sup> <a name="labels" id="@cloudsnorkel/cdk-github-runners.ProviderSelectorResult.property.labels"></a>
8157
+
8158
+ ```typescript
8159
+ public readonly labels: string[];
8160
+ ```
8161
+
8162
+ - *Type:* string[]
8163
+
8164
+ Labels to use when registering the runner.
8165
+
8166
+ Must be returned when a provider is selected.
8167
+ Can be used to add, remove, or modify labels.
8168
+
8169
+ ---
8170
+
8171
+ ##### `provider`<sup>Optional</sup> <a name="provider" id="@cloudsnorkel/cdk-github-runners.ProviderSelectorResult.property.provider"></a>
8172
+
8173
+ ```typescript
8174
+ public readonly provider: string;
8175
+ ```
8176
+
8177
+ - *Type:* string
8178
+
8179
+ Node path of the provider to use (e.g., "MyStack/MyProvider"). Must match one of the configured provider node paths from the input. If not provided, the job will be skipped (no runner created).
8180
+
8181
+ ---
8182
+
8025
8183
  ### RunnerAmi <a name="RunnerAmi" id="@cloudsnorkel/cdk-github-runners.RunnerAmi"></a>
8026
8184
 
8027
8185
  Description of a AMI built by {@link RunnerImageBuilder }.
@@ -8696,6 +8854,7 @@ const runnerRuntimeParameters: RunnerRuntimeParameters = { ... }
8696
8854
  | **Name** | **Type** | **Description** |
8697
8855
  | --- | --- | --- |
8698
8856
  | <code><a href="#@cloudsnorkel/cdk-github-runners.RunnerRuntimeParameters.property.githubDomainPath">githubDomainPath</a></code> | <code>string</code> | Path to GitHub domain. |
8857
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.RunnerRuntimeParameters.property.labelsPath">labelsPath</a></code> | <code>string</code> | Path to comma-separated labels string to use for runner. |
8699
8858
  | <code><a href="#@cloudsnorkel/cdk-github-runners.RunnerRuntimeParameters.property.ownerPath">ownerPath</a></code> | <code>string</code> | Path to repository owner name. |
8700
8859
  | <code><a href="#@cloudsnorkel/cdk-github-runners.RunnerRuntimeParameters.property.registrationUrl">registrationUrl</a></code> | <code>string</code> | Repository or organization URL to register runner at. |
8701
8860
  | <code><a href="#@cloudsnorkel/cdk-github-runners.RunnerRuntimeParameters.property.repoPath">repoPath</a></code> | <code>string</code> | Path to repository name. |
@@ -8718,6 +8877,18 @@ Most of the time this will be github.com but for self-hosted GitHub instances, t
8718
8877
 
8719
8878
  ---
8720
8879
 
8880
+ ##### `labelsPath`<sup>Required</sup> <a name="labelsPath" id="@cloudsnorkel/cdk-github-runners.RunnerRuntimeParameters.property.labelsPath"></a>
8881
+
8882
+ ```typescript
8883
+ public readonly labelsPath: string;
8884
+ ```
8885
+
8886
+ - *Type:* string
8887
+
8888
+ Path to comma-separated labels string to use for runner.
8889
+
8890
+ ---
8891
+
8721
8892
  ##### `ownerPath`<sup>Required</sup> <a name="ownerPath" id="@cloudsnorkel/cdk-github-runners.RunnerRuntimeParameters.property.ownerPath"></a>
8722
8893
 
8723
8894
  ```typescript
@@ -8852,6 +9023,54 @@ The EBS volume type.
8852
9023
 
8853
9024
  ---
8854
9025
 
9026
+ ### WeightedRunnerProvider <a name="WeightedRunnerProvider" id="@cloudsnorkel/cdk-github-runners.WeightedRunnerProvider"></a>
9027
+
9028
+ Configuration for weighted distribution of runners.
9029
+
9030
+ #### Initializer <a name="Initializer" id="@cloudsnorkel/cdk-github-runners.WeightedRunnerProvider.Initializer"></a>
9031
+
9032
+ ```typescript
9033
+ import { WeightedRunnerProvider } from '@cloudsnorkel/cdk-github-runners'
9034
+
9035
+ const weightedRunnerProvider: WeightedRunnerProvider = { ... }
9036
+ ```
9037
+
9038
+ #### Properties <a name="Properties" id="Properties"></a>
9039
+
9040
+ | **Name** | **Type** | **Description** |
9041
+ | --- | --- | --- |
9042
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.WeightedRunnerProvider.property.provider">provider</a></code> | <code><a href="#@cloudsnorkel/cdk-github-runners.IRunnerProvider">IRunnerProvider</a></code> | The runner provider to use. |
9043
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.WeightedRunnerProvider.property.weight">weight</a></code> | <code>number</code> | Weight for this provider. |
9044
+
9045
+ ---
9046
+
9047
+ ##### `provider`<sup>Required</sup> <a name="provider" id="@cloudsnorkel/cdk-github-runners.WeightedRunnerProvider.property.provider"></a>
9048
+
9049
+ ```typescript
9050
+ public readonly provider: IRunnerProvider;
9051
+ ```
9052
+
9053
+ - *Type:* <a href="#@cloudsnorkel/cdk-github-runners.IRunnerProvider">IRunnerProvider</a>
9054
+
9055
+ The runner provider to use.
9056
+
9057
+ ---
9058
+
9059
+ ##### `weight`<sup>Required</sup> <a name="weight" id="@cloudsnorkel/cdk-github-runners.WeightedRunnerProvider.property.weight"></a>
9060
+
9061
+ ```typescript
9062
+ public readonly weight: number;
9063
+ ```
9064
+
9065
+ - *Type:* number
9066
+
9067
+ Weight for this provider.
9068
+
9069
+ Higher weights mean higher probability of selection.
9070
+ Must be a positive number.
9071
+
9072
+ ---
9073
+
8855
9074
  ## Classes <a name="Classes" id="Classes"></a>
8856
9075
 
8857
9076
  ### Architecture <a name="Architecture" id="@cloudsnorkel/cdk-github-runners.Architecture"></a>
@@ -8968,6 +9187,120 @@ X86_64.
8968
9187
 
8969
9188
  ---
8970
9189
 
9190
+ ### CompositeProvider <a name="CompositeProvider" id="@cloudsnorkel/cdk-github-runners.CompositeProvider"></a>
9191
+
9192
+ A composite runner provider that implements fallback and distribution strategies.
9193
+
9194
+ #### Initializers <a name="Initializers" id="@cloudsnorkel/cdk-github-runners.CompositeProvider.Initializer"></a>
9195
+
9196
+ ```typescript
9197
+ import { CompositeProvider } from '@cloudsnorkel/cdk-github-runners'
9198
+
9199
+ new CompositeProvider()
9200
+ ```
9201
+
9202
+ | **Name** | **Type** | **Description** |
9203
+ | --- | --- | --- |
9204
+
9205
+ ---
9206
+
9207
+
9208
+ #### Static Functions <a name="Static Functions" id="Static Functions"></a>
9209
+
9210
+ | **Name** | **Description** |
9211
+ | --- | --- |
9212
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.CompositeProvider.distribute">distribute</a></code> | Creates a weighted distribution runner provider that randomly selects a provider based on weights. |
9213
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.CompositeProvider.fallback">fallback</a></code> | Creates a fallback runner provider that tries each provider in order until one succeeds. |
9214
+
9215
+ ---
9216
+
9217
+ ##### `distribute` <a name="distribute" id="@cloudsnorkel/cdk-github-runners.CompositeProvider.distribute"></a>
9218
+
9219
+ ```typescript
9220
+ import { CompositeProvider } from '@cloudsnorkel/cdk-github-runners'
9221
+
9222
+ CompositeProvider.distribute(scope: Construct, id: string, weightedProviders: WeightedRunnerProvider[])
9223
+ ```
9224
+
9225
+ Creates a weighted distribution runner provider that randomly selects a provider based on weights.
9226
+
9227
+ For example, given providers A (weight 10), B (weight 20), C (weight 30):
9228
+ - Total weight = 60
9229
+ - Probability of selecting A = 10/60 = 16.67%
9230
+ - Probability of selecting B = 20/60 = 33.33%
9231
+ - Probability of selecting C = 30/60 = 50%
9232
+
9233
+ You can use this to distribute load across multiple instance types or availability zones.
9234
+
9235
+ ###### `scope`<sup>Required</sup> <a name="scope" id="@cloudsnorkel/cdk-github-runners.CompositeProvider.distribute.parameter.scope"></a>
9236
+
9237
+ - *Type:* constructs.Construct
9238
+
9239
+ The scope in which to define this construct.
9240
+
9241
+ ---
9242
+
9243
+ ###### `id`<sup>Required</sup> <a name="id" id="@cloudsnorkel/cdk-github-runners.CompositeProvider.distribute.parameter.id"></a>
9244
+
9245
+ - *Type:* string
9246
+
9247
+ The scoped construct ID.
9248
+
9249
+ ---
9250
+
9251
+ ###### `weightedProviders`<sup>Required</sup> <a name="weightedProviders" id="@cloudsnorkel/cdk-github-runners.CompositeProvider.distribute.parameter.weightedProviders"></a>
9252
+
9253
+ - *Type:* <a href="#@cloudsnorkel/cdk-github-runners.WeightedRunnerProvider">WeightedRunnerProvider</a>[]
9254
+
9255
+ List of weighted runner providers.
9256
+
9257
+ ---
9258
+
9259
+ ##### `fallback` <a name="fallback" id="@cloudsnorkel/cdk-github-runners.CompositeProvider.fallback"></a>
9260
+
9261
+ ```typescript
9262
+ import { CompositeProvider } from '@cloudsnorkel/cdk-github-runners'
9263
+
9264
+ CompositeProvider.fallback(scope: Construct, id: string, providers: IRunnerProvider[])
9265
+ ```
9266
+
9267
+ Creates a fallback runner provider that tries each provider in order until one succeeds.
9268
+
9269
+ For example, given providers A, B, C:
9270
+ - Try A first
9271
+ - If A fails, try B
9272
+ - If B fails, try C
9273
+
9274
+ You can use this to try spot instance first, and switch to on-demand instances if spot is unavailable.
9275
+
9276
+ Or you can use this to try different instance types in order of preference.
9277
+
9278
+ ###### `scope`<sup>Required</sup> <a name="scope" id="@cloudsnorkel/cdk-github-runners.CompositeProvider.fallback.parameter.scope"></a>
9279
+
9280
+ - *Type:* constructs.Construct
9281
+
9282
+ The scope in which to define this construct.
9283
+
9284
+ ---
9285
+
9286
+ ###### `id`<sup>Required</sup> <a name="id" id="@cloudsnorkel/cdk-github-runners.CompositeProvider.fallback.parameter.id"></a>
9287
+
9288
+ - *Type:* string
9289
+
9290
+ The scoped construct ID.
9291
+
9292
+ ---
9293
+
9294
+ ###### `providers`<sup>Required</sup> <a name="providers" id="@cloudsnorkel/cdk-github-runners.CompositeProvider.fallback.parameter.providers"></a>
9295
+
9296
+ - *Type:* <a href="#@cloudsnorkel/cdk-github-runners.IRunnerProvider">IRunnerProvider</a>[]
9297
+
9298
+ List of runner providers to try in order.
9299
+
9300
+ ---
9301
+
9302
+
9303
+
8971
9304
  ### LambdaAccess <a name="LambdaAccess" id="@cloudsnorkel/cdk-github-runners.LambdaAccess"></a>
8972
9305
 
8973
9306
  Access configuration options for Lambda functions like setup and webhook function. Use this to limit access to these functions.
@@ -10283,6 +10616,134 @@ WindowsComponents.githubRunner(scope: Construct, id: string, runnerVersion: Runn
10283
10616
 
10284
10617
  ## Protocols <a name="Protocols" id="Protocols"></a>
10285
10618
 
10619
+ ### ICompositeProvider <a name="ICompositeProvider" id="@cloudsnorkel/cdk-github-runners.ICompositeProvider"></a>
10620
+
10621
+ - *Extends:* constructs.IConstruct
10622
+
10623
+ - *Implemented By:* <a href="#@cloudsnorkel/cdk-github-runners.ICompositeProvider">ICompositeProvider</a>
10624
+
10625
+ Interface for composite runner providers that interact with multiple sub-providers.
10626
+
10627
+ Unlike IRunnerProvider, composite providers do not have connections, grant capabilities,
10628
+ log groups, or retryable errors as they delegate to their sub-providers.
10629
+
10630
+ #### Methods <a name="Methods" id="Methods"></a>
10631
+
10632
+ | **Name** | **Description** |
10633
+ | --- | --- |
10634
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.ICompositeProvider.getStepFunctionTask">getStepFunctionTask</a></code> | Generate step function tasks that execute the runner. |
10635
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.ICompositeProvider.grantStateMachine">grantStateMachine</a></code> | An optional method that modifies the role of the state machine after all the tasks have been generated. |
10636
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.ICompositeProvider.status">status</a></code> | Return statuses of all sub-providers to be used in the main status function. |
10637
+
10638
+ ---
10639
+
10640
+ ##### `getStepFunctionTask` <a name="getStepFunctionTask" id="@cloudsnorkel/cdk-github-runners.ICompositeProvider.getStepFunctionTask"></a>
10641
+
10642
+ ```typescript
10643
+ public getStepFunctionTask(parameters: RunnerRuntimeParameters): IChainable
10644
+ ```
10645
+
10646
+ Generate step function tasks that execute the runner.
10647
+
10648
+ Called by GithubRunners and shouldn't be called manually.
10649
+
10650
+ ###### `parameters`<sup>Required</sup> <a name="parameters" id="@cloudsnorkel/cdk-github-runners.ICompositeProvider.getStepFunctionTask.parameter.parameters"></a>
10651
+
10652
+ - *Type:* <a href="#@cloudsnorkel/cdk-github-runners.RunnerRuntimeParameters">RunnerRuntimeParameters</a>
10653
+
10654
+ specific build parameters.
10655
+
10656
+ ---
10657
+
10658
+ ##### `grantStateMachine` <a name="grantStateMachine" id="@cloudsnorkel/cdk-github-runners.ICompositeProvider.grantStateMachine"></a>
10659
+
10660
+ ```typescript
10661
+ public grantStateMachine(stateMachineRole: IGrantable): void
10662
+ ```
10663
+
10664
+ An optional method that modifies the role of the state machine after all the tasks have been generated.
10665
+
10666
+ This can be used to add additional policy
10667
+ statements to the state machine role that are not automatically added by the task returned from {@link getStepFunctionTask}.
10668
+
10669
+ ###### `stateMachineRole`<sup>Required</sup> <a name="stateMachineRole" id="@cloudsnorkel/cdk-github-runners.ICompositeProvider.grantStateMachine.parameter.stateMachineRole"></a>
10670
+
10671
+ - *Type:* aws-cdk-lib.aws_iam.IGrantable
10672
+
10673
+ role for the state machine that executes the task returned from {@link getStepFunctionTask}.
10674
+
10675
+ ---
10676
+
10677
+ ##### `status` <a name="status" id="@cloudsnorkel/cdk-github-runners.ICompositeProvider.status"></a>
10678
+
10679
+ ```typescript
10680
+ public status(statusFunctionRole: IGrantable): IRunnerProviderStatus[]
10681
+ ```
10682
+
10683
+ Return statuses of all sub-providers to be used in the main status function.
10684
+
10685
+ Also gives the status function any needed permissions to query the Docker images or AMIs.
10686
+
10687
+ ###### `statusFunctionRole`<sup>Required</sup> <a name="statusFunctionRole" id="@cloudsnorkel/cdk-github-runners.ICompositeProvider.status.parameter.statusFunctionRole"></a>
10688
+
10689
+ - *Type:* aws-cdk-lib.aws_iam.IGrantable
10690
+
10691
+ grantable for the status function.
10692
+
10693
+ ---
10694
+
10695
+ #### Properties <a name="Properties" id="Properties"></a>
10696
+
10697
+ | **Name** | **Type** | **Description** |
10698
+ | --- | --- | --- |
10699
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.ICompositeProvider.property.node">node</a></code> | <code>constructs.Node</code> | The tree node. |
10700
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.ICompositeProvider.property.labels">labels</a></code> | <code>string[]</code> | GitHub Actions labels used for this provider. |
10701
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.ICompositeProvider.property.providers">providers</a></code> | <code><a href="#@cloudsnorkel/cdk-github-runners.IRunnerProvider">IRunnerProvider</a>[]</code> | All sub-providers contained in this composite provider. |
10702
+
10703
+ ---
10704
+
10705
+ ##### `node`<sup>Required</sup> <a name="node" id="@cloudsnorkel/cdk-github-runners.ICompositeProvider.property.node"></a>
10706
+
10707
+ ```typescript
10708
+ public readonly node: Node;
10709
+ ```
10710
+
10711
+ - *Type:* constructs.Node
10712
+
10713
+ The tree node.
10714
+
10715
+ ---
10716
+
10717
+ ##### `labels`<sup>Required</sup> <a name="labels" id="@cloudsnorkel/cdk-github-runners.ICompositeProvider.property.labels"></a>
10718
+
10719
+ ```typescript
10720
+ public readonly labels: string[];
10721
+ ```
10722
+
10723
+ - *Type:* string[]
10724
+
10725
+ GitHub Actions labels used for this provider.
10726
+
10727
+ These labels are used to identify which provider should spawn a new on-demand runner. Every job sends a webhook with the labels it's looking for
10728
+ based on runs-on. We use match the labels from the webhook with the labels specified here. If all the labels specified here are present in the
10729
+ job's labels, this provider will be chosen and spawn a new runner.
10730
+
10731
+ ---
10732
+
10733
+ ##### `providers`<sup>Required</sup> <a name="providers" id="@cloudsnorkel/cdk-github-runners.ICompositeProvider.property.providers"></a>
10734
+
10735
+ ```typescript
10736
+ public readonly providers: IRunnerProvider[];
10737
+ ```
10738
+
10739
+ - *Type:* <a href="#@cloudsnorkel/cdk-github-runners.IRunnerProvider">IRunnerProvider</a>[]
10740
+
10741
+ All sub-providers contained in this composite provider.
10742
+
10743
+ This is used to extract providers for metric filters and other operations.
10744
+
10745
+ ---
10746
+
10286
10747
  ### IConfigurableRunnerImageBuilder <a name="IConfigurableRunnerImageBuilder" id="@cloudsnorkel/cdk-github-runners.IConfigurableRunnerImageBuilder"></a>
10287
10748
 
10288
10749
  - *Extends:* <a href="#@cloudsnorkel/cdk-github-runners.IRunnerImageBuilder">IRunnerImageBuilder</a>, aws-cdk-lib.aws_ec2.IConnectable, aws-cdk-lib.aws_iam.IGrantable
@@ -10692,6 +11153,7 @@ Interface for runner image status used by status.json.
10692
11153
  | <code><a href="#@cloudsnorkel/cdk-github-runners.IRunnerProviderStatus.property.labels">labels</a></code> | <code>string[]</code> | Labels associated with provider. |
10693
11154
  | <code><a href="#@cloudsnorkel/cdk-github-runners.IRunnerProviderStatus.property.type">type</a></code> | <code>string</code> | Runner provider type. |
10694
11155
  | <code><a href="#@cloudsnorkel/cdk-github-runners.IRunnerProviderStatus.property.ami">ami</a></code> | <code><a href="#@cloudsnorkel/cdk-github-runners.IRunnerAmiStatus">IRunnerAmiStatus</a></code> | Details about AMI used by this runner provider. |
11156
+ | <code><a href="#@cloudsnorkel/cdk-github-runners.IRunnerProviderStatus.property.constructPath">constructPath</a></code> | <code>string</code> | CDK construct node path for this provider. |
10695
11157
  | <code><a href="#@cloudsnorkel/cdk-github-runners.IRunnerProviderStatus.property.image">image</a></code> | <code><a href="#@cloudsnorkel/cdk-github-runners.IRunnerImageStatus">IRunnerImageStatus</a></code> | Details about Docker image used by this runner provider. |
10696
11158
  | <code><a href="#@cloudsnorkel/cdk-github-runners.IRunnerProviderStatus.property.logGroup">logGroup</a></code> | <code>string</code> | Log group for runners. |
10697
11159
  | <code><a href="#@cloudsnorkel/cdk-github-runners.IRunnerProviderStatus.property.roleArn">roleArn</a></code> | <code>string</code> | Role attached to runners. |
@@ -10736,6 +11198,18 @@ Details about AMI used by this runner provider.
10736
11198
 
10737
11199
  ---
10738
11200
 
11201
+ ##### `constructPath`<sup>Optional</sup> <a name="constructPath" id="@cloudsnorkel/cdk-github-runners.IRunnerProviderStatus.property.constructPath"></a>
11202
+
11203
+ ```typescript
11204
+ public readonly constructPath: string;
11205
+ ```
11206
+
11207
+ - *Type:* string
11208
+
11209
+ CDK construct node path for this provider.
11210
+
11211
+ ---
11212
+
10739
11213
  ##### `image`<sup>Optional</sup> <a name="image" id="@cloudsnorkel/cdk-github-runners.IRunnerProviderStatus.property.image"></a>
10740
11214
 
10741
11215
  ```typescript