@cloudsnorkel/cdk-github-runners 0.14.20 β 0.14.21
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 +27 -27
- package/README.md +1 -0
- package/assets/delete-failed-runner.lambda/index.js +3248 -11227
- package/assets/idle-runner-repear.lambda/index.js +3224 -11221
- package/assets/image-builders/aws-image-builder/delete-resources.lambda/index.js +12 -2
- package/assets/image-builders/aws-image-builder/filter-failed-builds.lambda/index.js +4 -1
- package/assets/image-builders/build-image.lambda/index.js +21 -4
- package/assets/providers/ami-root-device.lambda/index.js +45 -10
- package/assets/providers/update-lambda.lambda/index.js +6 -1
- package/assets/setup.lambda/index.js +1762 -4645
- package/assets/status.lambda/index.js +2412 -10615
- package/assets/token-retriever.lambda/index.js +3228 -11221
- package/assets/webhook-handler.lambda/index.js +3264 -11236
- package/assets/webhook-redelivery.lambda/index.js +3220 -11221
- package/lib/access.js +1 -1
- package/lib/delete-failed-runner.lambda.js +22 -4
- package/lib/idle-runner-repear.lambda.js +1 -1
- package/lib/image-builders/api.js +1 -1
- package/lib/image-builders/aws-image-builder/base-image.js +2 -2
- package/lib/image-builders/aws-image-builder/builder.js +3 -3
- package/lib/image-builders/aws-image-builder/delete-resources.lambda.js +6 -2
- package/lib/image-builders/aws-image-builder/deprecated/ami.js +1 -1
- package/lib/image-builders/aws-image-builder/deprecated/container.js +1 -1
- package/lib/image-builders/aws-image-builder/deprecated/linux-components.js +1 -1
- package/lib/image-builders/aws-image-builder/deprecated/windows-components.js +1 -1
- package/lib/image-builders/aws-image-builder/filter-failed-builds.lambda.js +5 -2
- package/lib/image-builders/build-image.lambda.js +15 -4
- package/lib/image-builders/codebuild-deprecated.js +1 -1
- package/lib/image-builders/components.d.ts +12 -1
- package/lib/image-builders/components.js +48 -10
- package/lib/image-builders/static.js +1 -1
- package/lib/lambda-github.d.ts +14 -7
- package/lib/lambda-github.js +34 -8
- package/lib/lambda-helpers.js +8 -2
- package/lib/providers/ami-root-device.lambda.js +39 -10
- package/lib/providers/codebuild.js +2 -2
- package/lib/providers/common.js +3 -3
- package/lib/providers/composite.js +1 -1
- package/lib/providers/ec2.js +2 -2
- package/lib/providers/ecs.js +1 -1
- package/lib/providers/fargate.js +2 -2
- package/lib/providers/lambda.js +2 -2
- package/lib/providers/update-lambda.lambda.js +7 -2
- package/lib/runner.js +1 -1
- package/lib/secrets.js +1 -1
- package/lib/setup.lambda.js +7 -4
- package/lib/status.lambda.js +17 -8
- package/lib/token-retriever.lambda.js +8 -2
- package/lib/webhook-handler.lambda.js +39 -12
- package/lib/webhook-redelivery.lambda.js +1 -1
- package/package.json +5 -5
package/.jsii
CHANGED
|
@@ -3858,7 +3858,7 @@
|
|
|
3858
3858
|
},
|
|
3859
3859
|
"name": "@cloudsnorkel/cdk-github-runners",
|
|
3860
3860
|
"readme": {
|
|
3861
|
-
"markdown": "# GitHub Self-Hosted Runners CDK Constructs\n\n[][7]\n[][6]\n[][8]\n[][11]\n[][12]\n[](https://github.com/CloudSnorkel/cdk-github-runners/actions/workflows/release.yml)\n[](https://github.com/CloudSnorkel/cdk-github-runners/blob/main/LICENSE)\n\nUse this CDK construct to create ephemeral [self-hosted GitHub runners][1] on-demand inside your AWS account.\n\n* π§© Easy to configure GitHub integration with a web-based interface\n* π§ Customizable runners with decent defaults\n* ππ» Multiple runner configurations controlled by labels\n* π Everything fully hosted in your account\n* π Automatically updated build environment with latest runner version\n\nSelf-hosted runners in AWS are useful when:\n\n* You need easy access to internal resources in your actions\n* You want to pre-install some software for your actions\n* You want to provide some basic AWS API access (but [aws-actions/configure-aws-credentials][2] has more security controls)\n* You are using GitHub Enterprise Server\n\nEphemeral (or on-demand) runners are the [recommended way by GitHub][14] for auto-scaling, and they make sure all jobs run with a clean image. Runners are started on-demand. You don't pay unless a job is running.\n\n## API\n\nThe best way to browse API documentation is on [Constructs Hub][13]. It is available in all supported programming languages.\n\n## Providers\n\nA runner provider creates compute resources on-demand and uses [actions/runner][5] to start a runner.\n\n| | EC2 | CodeBuild | Fargate | ECS | Lambda |\n|------------------|-------------------|----------------------------|----------------|----------------|---------------|\n| **Time limit** | Unlimited | 8 hours | Unlimited | Unlimited | 15 minutes |\n| **vCPUs** | Unlimited | 2, 4, 8, or 72 | 0.25 to 4 | Unlimited | 1 to 6 |\n| **RAM** | Unlimited | 3gb, 7gb, 15gb, or 145gb | 512mb to 30gb | Unlimited | 128mb to 10gb |\n| **Storage** | Unlimited | 50gb to 824gb | 20gb to 200gb | Unlimited | Up to 10gb |\n| **Architecture** | x86_64, ARM64 | x86_64, ARM64 | x86_64, ARM64 | x86_64, ARM64 | x86_64, ARM64 |\n| **sudo** | β | β | β | β | β |\n| **Docker** | β | β (Linux only) | β | β | β |\n| **Spot pricing** | β | β | β | β | β |\n| **OS** | Linux, Windows | Linux, Windows | Linux, Windows | Linux, Windows | Linux |\n\nThe best provider to use mostly depends on your current infrastructure. When in doubt, CodeBuild is always a good choice. Execution history and logs are easy to view, and it has no restrictive limits unless you need to run for more than 8 hours.\n\n* EC2 is useful when you want runners to have complete access to the host\n* ECS is useful when you want to control the infrastructure, like leaving the runner host running for faster startups\n* Lambda is useful for short jobs that can work within time, size and readonly system constraints\n\nYou can also create your own provider by implementing `IRunnerProvider`.\n\n## Installation\n\n1. Install and use the appropriate package\n <details><summary>Python</summary>\n\n ### Install\n Available on [PyPI][6].\n ```bash\n pip install cloudsnorkel.cdk-github-runners\n ```\n ### Use\n ```python\n from aws_cdk import App, Stack\n from cloudsnorkel.cdk_github_runners import GitHubRunners\n\n app = App()\n stack = Stack(app, \"github-runners\")\n GitHubRunners(stack, \"runners\")\n\n app.synth()\n ```\n </details>\n <details><summary>TypeScript or JavaScript</summary>\n\n ### Install\n Available on [npm][7].\n ```bash\n npm i @cloudsnorkel/cdk-github-runners\n ```\n ### Use\n ```typescript\n import { App, Stack } from 'aws-cdk-lib';\n import { GitHubRunners } from '@cloudsnorkel/cdk-github-runners';\n\n const app = new App();\n const stack = new Stack(app, 'github-runners');\n new GitHubRunners(stack, 'runners');\n\n app.synth();\n ```\n </details>\n <details><summary>Java</summary>\n\n ### Install\n Available on [Maven][8].\n ```xml\n <dependency>\n <groupId>com.cloudsnorkel</groupId>\n <artifactId>cdk.github.runners</artifactId>\n </dependency>\n ```\n ### Use\n ```java\n import software.amazon.awscdk.App;\n import software.amazon.awscdk.Stack;\n import com.cloudsnorkel.cdk.github.runners.GitHubRunners;\n\n public class Example {\n public static void main(String[] args){\n App app = new App();\n Stack stack = new Stack(app, \"github-runners\");\n GitHubRunners.Builder.create(stack, \"runners\").build();\n\n app.synth();\n }\n }\n ```\n </details>\n <details><summary>Go</summary>\n\n ### Install\n Available on [GitHub][11].\n ```bash\n go get github.com/CloudSnorkel/cdk-github-runners-go/cloudsnorkelcdkgithubrunners\n ```\n ### Use\n ```go\n package main\n\n import (\n \"github.com/CloudSnorkel/cdk-github-runners-go/cloudsnorkelcdkgithubrunners\"\n \"github.com/aws/aws-cdk-go/awscdk/v2\"\n \"github.com/aws/jsii-runtime-go\"\n )\n\n func main() {\n app := awscdk.NewApp(nil)\n stack := awscdk.NewStack(app, jsii.String(\"github-runners\"), &awscdk.StackProps{})\n cloudsnorkelcdkgithubrunners.NewGitHubRunners(stack, jsii.String(\"runners\"), &cloudsnorkelcdkgithubrunners.GitHubRunnersProps{})\n\n app.Synth(nil)\n }\n ```\n </details>\n <details><summary>.NET</summary>\n\n ### Install\n Available on [Nuget][12].\n ```bash\n dotnet add package CloudSnorkel.Cdk.Github.Runners\n ```\n ### Use\n ```csharp\n using Amazon.CDK;\n using CloudSnorkel;\n\n namespace Example\n {\n sealed class Program\n {\n public static void Main(string[] args)\n {\n var app = new App();\n var stack = new Stack(app, \"github-runners\");\n new GitHubRunners(stack, \"runners\");\n app.Synth();\n }\n }\n }\n ```\n </details>\n2. Use `GitHubRunners` construct in your code (starting with default arguments is fine)\n3. Deploy your stack\n4. Look for the status command output similar to `aws --region us-east-1 lambda invoke --function-name status-XYZ123 status.json`\n ```\n β
github-runners-test\n\n β¨ Deployment time: 260.01s\n\n Outputs:\n github-runners-test.runnersstatuscommand4A30F0F5 = aws --region us-east-1 lambda invoke --function-name github-runners-test-runnersstatus1A5771C0-mvttg8oPQnQS status.json\n ```\n5. Execute the status command (you may need to specify `--profile` too) and open the resulting `status.json` file\n6. Open the URL in `github.setup.url` from `status.json` or [manually setup GitHub](SETUP_GITHUB.md) integration as an app or with personal access token\n7. Run status command again to confirm `github.auth.status` and `github.webhook.status` are OK\n8. Trigger a GitHub action that has a `self-hosted` label with `runs-on: [self-hosted, codebuild]` (or non-default labels you set in step 2)\n9. If the action is not successful, see [troubleshooting](#Troubleshooting)\n\n[](https://youtu.be/wlyv_3V8lIw)\n\n## Customizing\n\nThe default providers configured by `GitHubRunners` are useful for testing but probably not too much for actual production work. They run in the default VPC or no VPC and have no added IAM permissions. You would usually want to configure the providers yourself.\n\nFor example:\n\n```typescript\nlet vpc: ec2.Vpc;\nlet runnerSg: ec2.SecurityGroup;\nlet dbSg: ec2.SecurityGroup;\nlet bucket: s3.Bucket;\n\n// create a custom CodeBuild provider\nconst myProvider = new CodeBuildRunnerProvider(this, 'codebuild runner', {\n labels: ['my-codebuild'],\n vpc: vpc,\n securityGroups: [runnerSg],\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(this, 'runners', {\n providers: [myProvider],\n});\n```\n\nAnother way to customize runners is by modifying the image used to spin them up. The image contains the [runner][5], any required dependencies, and integration code with the provider. You may choose to customize this image by adding more packages, for example.\n\n```typescript\nconst myBuilder = FargateRunnerProvider.imageBuilder(this, 'image builder');\nmyBuilder.addComponent(\n RunnerImageComponent.custom({ commands: ['apt install -y nginx xz-utils'] }),\n);\n\nconst myProvider = new FargateRunnerProvider(this, 'fargate runner', {\n labels: ['customized-fargate'],\n imageBuilder: myBuilder,\n});\n\n// create the runner infrastructure\nnew GitHubRunners(this, 'runners', {\n providers: [myProvider],\n});\n```\n\nYour workflow will then look like:\n\n```yaml\nname: self-hosted example\non: push\njobs:\n self-hosted:\n runs-on: [self-hosted, customized-fargate]\n steps:\n - run: echo hello world\n```\n\nWindows images can also be customized the same way.\n\n```typescript\nconst myWindowsBuilder = FargateRunnerProvider.imageBuilder(this, 'Windows image builder', {\n architecture: Architecture.X86_64,\n os: Os.WINDOWS,\n});\nmyWindowsBuilder.addComponent(\n RunnerImageComponent.custom({\n name: 'Ninja',\n commands: [\n 'Invoke-WebRequest -UseBasicParsing -Uri \"https://github.com/ninja-build/ninja/releases/download/v1.11.1/ninja-win.zip\" -OutFile ninja.zip',\n 'Expand-Archive ninja.zip -DestinationPath C:\\\\actions',\n 'del ninja.zip',\n ],\n }),\n);\n\nconst myProvider = new FargateRunnerProvider(this, 'fargate runner', {\n labels: ['customized-windows-fargate'],\n imageBuilder: myWindowsBuilder,\n});\n\nnew GitHubRunners(this, 'runners', {\n providers: [myProvider],\n});\n```\n\nThe runner OS and architecture is determined by the image it is set to use. For example, to create a Fargate runner provider for ARM64 set the `architecture` property for the image builder to `Architecture.ARM64` in the image builder properties.\n\n```typescript\nnew GitHubRunners(this, 'runners', {\n providers: [\n new FargateRunnerProvider(this, 'fargate runner', {\n labels: ['arm64', 'fargate'],\n imageBuilder: FargateRunnerProvider.imageBuilder(this, 'image builder', {\n architecture: Architecture.ARM64,\n os: Os.LINUX_UBUNTU,\n }),\n }),\n ],\n});\n```\n\n### Composite Providers\n\nComposite providers allow you to combine multiple runner providers with different strategies. There are two types:\n\n**Fallback Strategy**: Try providers in order until one succeeds. Useful for trying spot instances first, then falling back to on-demand if spot capacity is unavailable.\n\n```typescript\n// Try spot instances first, fall back to on-demand if spot is unavailable\nconst ecsFallback = CompositeProvider.fallback(this, 'ECS Fallback', [\n new EcsRunnerProvider(this, 'ECS Spot', {\n labels: ['ecs', 'linux', 'x64'],\n spot: true,\n // ... other config\n }),\n new EcsRunnerProvider(this, 'ECS On-Demand', {\n labels: ['ecs', 'linux', 'x64'],\n spot: false,\n // ... other config\n }),\n]);\n\nnew GitHubRunners(this, 'runners', {\n providers: [ecsFallback],\n});\n```\n\n**Weighted Distribution Strategy**: Randomly select a provider based on weights. Useful for distributing load across multiple availability zones or instance types.\n\n```typescript\n// Distribute 60% of traffic to AZ-1, 40% to AZ-2\nconst distributedProvider = CompositeProvider.distribute(this, 'Fargate Distribution', [\n {\n weight: 3, // 3/(3+2) = 60%\n provider: new FargateRunnerProvider(this, 'Fargate AZ-1', {\n labels: ['fargate', 'linux', 'x64'],\n subnetSelection: vpc.selectSubnets({\n availabilityZones: [vpc.availabilityZones[0]],\n }),\n // ... other config\n }),\n },\n {\n weight: 2, // 2/(3+2) = 40%\n provider: new FargateRunnerProvider(this, 'Fargate AZ-2', {\n labels: ['fargate', 'linux', 'x64'],\n subnetSelection: vpc.selectSubnets({\n availabilityZones: [vpc.availabilityZones[1]],\n }),\n // ... other config\n }),\n },\n]);\n\nnew GitHubRunners(this, 'runners', {\n providers: [distributedProvider],\n});\n```\n\n**Important**: All providers in a composite must have the exact same labels. This ensures any provisioned runner can match the labels requested by the GitHub workflow job.\n\n### Custom Provider Selection\n\nBy default, providers are selected based on label matching: the first provider that has all the labels requested by the job is selected. You can customize this behavior using a provider selector Lambda function to:\n\n* Filter out certain jobs (prevent runner provisioning)\n* Dynamically select a provider based on job characteristics (repository, branch, time of day, etc.)\n* Customize labels for the runner (add, remove, or modify labels dynamically)\n\nThe selector function receives the full GitHub webhook payload, a map of all available providers and their labels, and the default provider/labels that would have been selected. It returns the provider to use (or `undefined` to skip runner creation) and the labels to assign to the runner.\n\n**Example: Route jobs to different providers based on repository**\n\n```typescript\nimport { ComputeType } from 'aws-cdk-lib/aws-codebuild';\nimport { Function, Code, Runtime } from 'aws-cdk-lib/aws-lambda';\nimport { GitHubRunners, CodeBuildRunnerProvider } from '@cloudsnorkel/cdk-github-runners';\n\nconst defaultProvider = new CodeBuildRunnerProvider(this, 'default', {\n labels: ['custom-runner', 'default'],\n});\nconst productionProvider = new CodeBuildRunnerProvider(this, 'production', {\n labels: ['custom-runner', 'production'],\n computeType: ComputeType.LARGE,\n});\n\nconst providerSelector = new Function(this, 'provider-selector', {\n runtime: Runtime.NODEJS_LATEST,\n handler: 'index.handler',\n code: Code.fromInline(`\n exports.handler = async (event) => {\n const { payload, providers, defaultProvider, defaultLabels } = event;\n\n // Route production repos to dedicated provider\n if (payload.repository.name.includes('prod')) {\n return {\n provider: '${productionProvider.node.path}',\n labels: ['custom-runner', 'production', 'modified-via-selector'],\n };\n }\n\n // Filter out draft PRs\n if (payload.workflow_job.head_branch?.startsWith('draft/')) {\n return { provider: undefined }; // Skip runner provisioning\n }\n\n // Use default for everything else\n return {\n provider: defaultProvider,\n labels: defaultLabels,\n };\n };\n `),\n});\n\nnew GitHubRunners(this, 'runners', {\n providers: [defaultProvider, productionProvider],\n providerSelector: providerSelector,\n});\n```\n\n**Example: Add dynamic labels based on job metadata**\n\n```typescript\nconst providerSelector = new Function(this, 'provider-selector', {\n runtime: Runtime.NODEJS_LATEST,\n handler: 'index.handler',\n code: Code.fromInline(`\n exports.handler = async (event) => {\n const { payload, defaultProvider, defaultLabels } = event;\n\n // Add branch name as a label\n const branch = payload.workflow_job.head_branch || 'unknown';\n const labels = [...(defaultLabels || []), 'branch:' + branch];\n\n return {\n provider: defaultProvider,\n labels: labels,\n };\n };\n `),\n});\n```\n\n**Important considerations:**\n\n* β οΈ **Label matching responsibility**: You are responsible for ensuring the selected provider's labels match what the job requires. If labels don't match, the runner will be provisioned but GitHub Actions won't assign the job to it.\n* β οΈ **No guarantee of assignment**: Provider selection only determines which provider will provision a runner. GitHub Actions may still route the job to any available runner with matching labels. For reliable provider assignment, consider repo-level runner registration (the default).\n* β‘ **Performance**: The selector runs synchronously during webhook processing. Keep it fast and efficientβthe webhook has a 30-second timeout total.\n\n## Examples\n\nWe provide comprehensive examples in the [`examples/`](examples/) folder to help you get started quickly:\n\n### Getting Started\n- **[Simple CodeBuild](examples/typescript/simple-codebuild/)** - Basic setup with just a CodeBuild provider (also available in [Python](examples/python/simple-codebuild/))\n\n### Provider Configuration\n- **[Composite Provider](examples/typescript/composite-provider/)** - Fallback and weighted distribution strategies (also available in [Python](examples/python/composite-provider/))\n- **[Provider Selector](examples/typescript/provider-selector/)** - Custom provider selection with Lambda function (also available in [Python](examples/python/provider-selector/))\n- **[EC2 Windows Provider](examples/typescript/ec2-windows-provider/)** - EC2 configuration for Windows runners (also available in [Python](examples/python/ec2-windows-provider/))\n\n### Compute & Performance\n- **[Compute Options](examples/typescript/compute-options/)** - Configure CPU, memory, and instance types for different providers (also available in [Python](examples/python/compute-options/))\n- **[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/))\n- **[Storage Options](examples/typescript/storage-options/)** - Custom EBS storage options for EC2 runners (also available in [Python](examples/python/storage-options/))\n- **[ECS Scaling](examples/typescript/ecs-scaling/)** - Custom autoscaling group scaling policies for ECS providers (also available in [Python](examples/python/ecs-scaling/))\n\n### Security & Access\n- **[IAM Permissions](examples/typescript/iam-permissions/)** - Grant AWS IAM permissions to runners (also available in [Python](examples/python/iam-permissions/))\n- **[Network Access](examples/typescript/network-access/)** - Configure network access with VPCs and security groups (also available in [Python](examples/python/network-access/))\n- **[Access Control](examples/typescript/access-control/)** - Configure access control for webhook and setup functions (also available in [Python](examples/python/access-control/))\n\n### Customization\n- **[Add Software](examples/typescript/add-software/)** - Add custom software to runner images (also available in [Python](examples/python/add-software/))\n\n### Enterprise & Monitoring\n- **[GHES](examples/typescript/ghes/)** - Configure runners for GitHub Enterprise Server (also available in [Python](examples/python/ghes/))\n- **[Monitoring](examples/typescript/monitoring/)** - Set up CloudWatch alarms and SNS notifications (also available in [Python](examples/python/monitoring/))\n\nEach example is self-contained with its own dependencies and README. Start with the simple examples and work your way up to more advanced configurations.\n\nAnother good and very full example is the [integration test](test/default.integ.ts).\n\nIf you have more to share, please open a PR adding examples to the `examples` folder.\n\n## Architecture\n\n\n\n## Troubleshooting\n\nRunners are started in response to a webhook coming in from GitHub. If there are any issues starting the runner like missing capacity or transient API issues, the provider will keep retrying for 24 hours. Configuration issue related errors like pointing to a missing AMI will not be retried. GitHub itself will cancel the job if it can't find a runner for 24 hours. If your jobs don't start, follow the steps below to examine all parts of this workflow.\n\n1. Always start with the status function, make sure no errors are reported, and confirm all status codes are OK\n2. Make sure `runs-on` in the workflow matches the expected labels set in the runner provider\n3. Diagnose relevant executions of the orchestrator step function by visiting the URL in `troubleshooting.stepFunctionUrl` from `status.json`\n 1. If the execution failed, check your runner provider configuration for errors\n 2. If the execution is still running for a long time, check the execution events to see why runner starting is being retried\n 3. If there are no relevant executions, move to the next step\n4. Confirm the webhook Lambda was called by visiting the URL in `troubleshooting.webhookHandlerUrl` from `status.json`\n 1. If it's not called or logs errors, confirm the webhook settings on the GitHub side\n 2. If you see too many errors, make sure you're only sending `workflow_job` events\n5. When using GitHub app, make sure there are active installations in `github.auth.app.installations`\n\nAll logs are saved in CloudWatch.\n* Log group names can be found in `status.json` for each provider, image builder, and other parts of the system\n* Some useful Logs Insights queries can be enabled with `GitHubRunners.createLogsInsightsQueries()`\n\nTo get `status.json`, check out the CloudFormation stack output for a command that generates it. The command looks like:\n\n```\naws --region us-east-1 lambda invoke --function-name status-XYZ123 status.json\n```\n\n## Monitoring\n\nThere are two important ways to monitor your runners:\n\n1. Make sure runners don't fail to start. When that happens, jobs may sit and wait. Use `GitHubRunners.metricFailed()` to get a metric for the number of failed runner starts. You should use this metric to trigger an alarm.\n2. Make sure runner images don't fail to build. Failed runner image builds mean you will get stuck with out-of-date software on your runners. It may lead to security vulnerabilities, or it may lead to slower runner start-ups as the runner software itself needs to be updated. Use `GitHubRunners.failedImageBuildsTopic()` to get SNS topic that gets notified of failed runner image builds. You should subscribe to this topic.\n\nOther useful metrics to track:\n\n1. Use `GitHubRunners.metricJobCompleted()` to get a metric for the number of completed jobs broken down by labels and job success.\n2. Use `GitHubRunners.metricTime()` to get a metric for the total time a runner is running. This includes the overhead of starting the runner.\n\n## Contributing\n\nIf you use and love this project, please consider contributing.\n\n1. πͺ³ If you see something, say something. [Issues][16] help improve the quality of the project.\n * Include relevant logs and package versions for bugs.\n * When possible, describe the use-case behind feature requests.\n1. π οΈ [Pull requests][17] are welcome.\n * Run `npm run build` before submitting to make sure all tests pass.\n * Allow edits from maintainers so small adjustments can be made easily.\n1. π΅ Consider [sponsoring][15] the project to show your support and optionally get your name listed below.\n\n## Other Options\n\n1. [github-aws-runners/terraform-aws-github-runner][3] if you're using Terraform\n2. [actions/actions-runner-controller][4] if you're using Kubernetes\n\n\n[1]: https://docs.github.com/en/actions/hosting-your-own-runners/about-self-hosted-runners\n[2]: https://github.com/marketplace/actions/configure-aws-credentials-action-for-github-actions\n[3]: https://github.com/github-aws-runners/terraform-aws-github-runner\n[4]: https://github.com/actions/actions-runner-controller\n[5]: https://github.com/actions/runner\n[6]: https://pypi.org/project/cloudsnorkel.cdk-github-runners\n[7]: https://www.npmjs.com/package/@cloudsnorkel/cdk-github-runners\n[8]: https://central.sonatype.com/artifact/com.cloudsnorkel/cdk.github.runners/\n[9]: https://docs.github.com/en/developers/apps/getting-started-with-apps/about-apps\n[10]: https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token\n[11]: https://pkg.go.dev/github.com/CloudSnorkel/cdk-github-runners-go/cloudsnorkelcdkgithubrunners\n[12]: https://www.nuget.org/packages/CloudSnorkel.Cdk.Github.Runners/\n[13]: https://constructs.dev/packages/@cloudsnorkel/cdk-github-runners/\n[14]: https://docs.github.com/en/actions/hosting-your-own-runners/autoscaling-with-self-hosted-runners#using-ephemeral-runners-for-autoscaling\n[15]: https://github.com/sponsors/CloudSnorkel\n[16]: https://github.com/CloudSnorkel/cdk-github-runners/issues\n[17]: https://github.com/CloudSnorkel/cdk-github-runners/pulls\n"
|
|
3861
|
+
"markdown": "# GitHub Self-Hosted Runners CDK Constructs\n\n[][7]\n[][6]\n[][8]\n[][11]\n[][12]\n[](https://github.com/CloudSnorkel/cdk-github-runners/actions/workflows/release.yml)\n[](https://github.com/CloudSnorkel/cdk-github-runners/blob/main/LICENSE)\n\nUse this CDK construct to create ephemeral [self-hosted GitHub runners][1] on-demand inside your AWS account.\n\n* π§© Easy to configure GitHub integration with a web-based interface\n* π§ Customizable runners with decent defaults\n* ππ» Multiple runner configurations controlled by labels\n* π Everything fully hosted in your account\n* π Automatically updated build environment with latest runner version\n\nSelf-hosted runners in AWS are useful when:\n\n* You need easy access to internal resources in your actions\n* You want to pre-install some software for your actions\n* You want to provide some basic AWS API access (but [aws-actions/configure-aws-credentials][2] has more security controls)\n* You are using GitHub Enterprise Server\n\nEphemeral (or on-demand) runners are the [recommended way by GitHub][14] for auto-scaling, and they make sure all jobs run with a clean image. Runners are started on-demand. You don't pay unless a job is running.\n\n## API\n\nThe best way to browse API documentation is on [Constructs Hub][13]. It is available in all supported programming languages.\n\n## Providers\n\nA runner provider creates compute resources on-demand and uses [actions/runner][5] to start a runner.\n\n| | EC2 | CodeBuild | Fargate | ECS | Lambda |\n|------------------|-------------------|----------------------------|----------------|----------------|---------------|\n| **Time limit** | Unlimited | 8 hours | Unlimited | Unlimited | 15 minutes |\n| **vCPUs** | Unlimited | 2, 4, 8, or 72 | 0.25 to 4 | Unlimited | 1 to 6 |\n| **RAM** | Unlimited | 3gb, 7gb, 15gb, or 145gb | 512mb to 30gb | Unlimited | 128mb to 10gb |\n| **Storage** | Unlimited | 50gb to 824gb | 20gb to 200gb | Unlimited | Up to 10gb |\n| **Architecture** | x86_64, ARM64 | x86_64, ARM64 | x86_64, ARM64 | x86_64, ARM64 | x86_64, ARM64 |\n| **sudo** | β | β | β | β | β |\n| **Docker** | β | β (Linux only) | β | β | β |\n| **Spot pricing** | β | β | β | β | β |\n| **OS** | Linux, Windows | Linux, Windows | Linux, Windows | Linux, Windows | Linux |\n\nThe best provider to use mostly depends on your current infrastructure. When in doubt, CodeBuild is always a good choice. Execution history and logs are easy to view, and it has no restrictive limits unless you need to run for more than 8 hours.\n\n* EC2 is useful when you want runners to have complete access to the host\n* ECS is useful when you want to control the infrastructure, like leaving the runner host running for faster startups\n* Lambda is useful for short jobs that can work within time, size and readonly system constraints\n\nYou can also create your own provider by implementing `IRunnerProvider`.\n\n## Installation\n\n1. Install and use the appropriate package\n <details><summary>Python</summary>\n\n ### Install\n Available on [PyPI][6].\n ```bash\n pip install cloudsnorkel.cdk-github-runners\n ```\n ### Use\n ```python\n from aws_cdk import App, Stack\n from cloudsnorkel.cdk_github_runners import GitHubRunners\n\n app = App()\n stack = Stack(app, \"github-runners\")\n GitHubRunners(stack, \"runners\")\n\n app.synth()\n ```\n </details>\n <details><summary>TypeScript or JavaScript</summary>\n\n ### Install\n Available on [npm][7].\n ```bash\n npm i @cloudsnorkel/cdk-github-runners\n ```\n ### Use\n ```typescript\n import { App, Stack } from 'aws-cdk-lib';\n import { GitHubRunners } from '@cloudsnorkel/cdk-github-runners';\n\n const app = new App();\n const stack = new Stack(app, 'github-runners');\n new GitHubRunners(stack, 'runners');\n\n app.synth();\n ```\n </details>\n <details><summary>Java</summary>\n\n ### Install\n Available on [Maven][8].\n ```xml\n <dependency>\n <groupId>com.cloudsnorkel</groupId>\n <artifactId>cdk.github.runners</artifactId>\n </dependency>\n ```\n ### Use\n ```java\n import software.amazon.awscdk.App;\n import software.amazon.awscdk.Stack;\n import com.cloudsnorkel.cdk.github.runners.GitHubRunners;\n\n public class Example {\n public static void main(String[] args){\n App app = new App();\n Stack stack = new Stack(app, \"github-runners\");\n GitHubRunners.Builder.create(stack, \"runners\").build();\n\n app.synth();\n }\n }\n ```\n </details>\n <details><summary>Go</summary>\n\n ### Install\n Available on [GitHub][11].\n ```bash\n go get github.com/CloudSnorkel/cdk-github-runners-go/cloudsnorkelcdkgithubrunners\n ```\n ### Use\n ```go\n package main\n\n import (\n \"github.com/CloudSnorkel/cdk-github-runners-go/cloudsnorkelcdkgithubrunners\"\n \"github.com/aws/aws-cdk-go/awscdk/v2\"\n \"github.com/aws/jsii-runtime-go\"\n )\n\n func main() {\n app := awscdk.NewApp(nil)\n stack := awscdk.NewStack(app, jsii.String(\"github-runners\"), &awscdk.StackProps{})\n cloudsnorkelcdkgithubrunners.NewGitHubRunners(stack, jsii.String(\"runners\"), &cloudsnorkelcdkgithubrunners.GitHubRunnersProps{})\n\n app.Synth(nil)\n }\n ```\n </details>\n <details><summary>.NET</summary>\n\n ### Install\n Available on [Nuget][12].\n ```bash\n dotnet add package CloudSnorkel.Cdk.Github.Runners\n ```\n ### Use\n ```csharp\n using Amazon.CDK;\n using CloudSnorkel;\n\n namespace Example\n {\n sealed class Program\n {\n public static void Main(string[] args)\n {\n var app = new App();\n var stack = new Stack(app, \"github-runners\");\n new GitHubRunners(stack, \"runners\");\n app.Synth();\n }\n }\n }\n ```\n </details>\n2. Use `GitHubRunners` construct in your code (starting with default arguments is fine)\n3. Deploy your stack\n4. Look for the status command output similar to `aws --region us-east-1 lambda invoke --function-name status-XYZ123 status.json`\n ```\n β
github-runners-test\n\n β¨ Deployment time: 260.01s\n\n Outputs:\n github-runners-test.runnersstatuscommand4A30F0F5 = aws --region us-east-1 lambda invoke --function-name github-runners-test-runnersstatus1A5771C0-mvttg8oPQnQS status.json\n ```\n5. Execute the status command (you may need to specify `--profile` too) and open the resulting `status.json` file\n6. Open the URL in `github.setup.url` from `status.json` or [manually setup GitHub](SETUP_GITHUB.md) integration as an app or with personal access token\n7. Run status command again to confirm `github.auth.status` and `github.webhook.status` are OK\n8. Trigger a GitHub action that has a `self-hosted` label with `runs-on: [self-hosted, codebuild]` (or non-default labels you set in step 2)\n9. If the action is not successful, see [troubleshooting](#Troubleshooting)\n\n[](https://youtu.be/wlyv_3V8lIw)\n\n## Customizing\n\nThe default providers configured by `GitHubRunners` are useful for testing but probably not too much for actual production work. They run in the default VPC or no VPC and have no added IAM permissions. You would usually want to configure the providers yourself.\n\nFor example:\n\n```typescript\nlet vpc: ec2.Vpc;\nlet runnerSg: ec2.SecurityGroup;\nlet dbSg: ec2.SecurityGroup;\nlet bucket: s3.Bucket;\n\n// create a custom CodeBuild provider\nconst myProvider = new CodeBuildRunnerProvider(this, 'codebuild runner', {\n labels: ['my-codebuild'],\n vpc: vpc,\n securityGroups: [runnerSg],\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(this, 'runners', {\n providers: [myProvider],\n});\n```\n\nAnother way to customize runners is by modifying the image used to spin them up. The image contains the [runner][5], any required dependencies, and integration code with the provider. You may choose to customize this image by adding more packages, for example.\n\n```typescript\nconst myBuilder = FargateRunnerProvider.imageBuilder(this, 'image builder');\nmyBuilder.addComponent(\n RunnerImageComponent.custom({ commands: ['apt install -y nginx xz-utils'] }),\n);\n\nconst myProvider = new FargateRunnerProvider(this, 'fargate runner', {\n labels: ['customized-fargate'],\n imageBuilder: myBuilder,\n});\n\n// create the runner infrastructure\nnew GitHubRunners(this, 'runners', {\n providers: [myProvider],\n});\n```\n\nYour workflow will then look like:\n\n```yaml\nname: self-hosted example\non: push\njobs:\n self-hosted:\n runs-on: [self-hosted, customized-fargate]\n steps:\n - run: echo hello world\n```\n\nWindows images can also be customized the same way.\n\n```typescript\nconst myWindowsBuilder = FargateRunnerProvider.imageBuilder(this, 'Windows image builder', {\n architecture: Architecture.X86_64,\n os: Os.WINDOWS,\n});\nmyWindowsBuilder.addComponent(\n RunnerImageComponent.custom({\n name: 'Ninja',\n commands: [\n 'Invoke-WebRequest -UseBasicParsing -Uri \"https://github.com/ninja-build/ninja/releases/download/v1.11.1/ninja-win.zip\" -OutFile ninja.zip',\n 'Expand-Archive ninja.zip -DestinationPath C:\\\\actions',\n 'del ninja.zip',\n ],\n }),\n);\n\nconst myProvider = new FargateRunnerProvider(this, 'fargate runner', {\n labels: ['customized-windows-fargate'],\n imageBuilder: myWindowsBuilder,\n});\n\nnew GitHubRunners(this, 'runners', {\n providers: [myProvider],\n});\n```\n\nThe runner OS and architecture is determined by the image it is set to use. For example, to create a Fargate runner provider for ARM64 set the `architecture` property for the image builder to `Architecture.ARM64` in the image builder properties.\n\n```typescript\nnew GitHubRunners(this, 'runners', {\n providers: [\n new FargateRunnerProvider(this, 'fargate runner', {\n labels: ['arm64', 'fargate'],\n imageBuilder: FargateRunnerProvider.imageBuilder(this, 'image builder', {\n architecture: Architecture.ARM64,\n os: Os.LINUX_UBUNTU,\n }),\n }),\n ],\n});\n```\n\n### Composite Providers\n\nComposite providers allow you to combine multiple runner providers with different strategies. There are two types:\n\n**Fallback Strategy**: Try providers in order until one succeeds. Useful for trying spot instances first, then falling back to on-demand if spot capacity is unavailable.\n\n```typescript\n// Try spot instances first, fall back to on-demand if spot is unavailable\nconst ecsFallback = CompositeProvider.fallback(this, 'ECS Fallback', [\n new EcsRunnerProvider(this, 'ECS Spot', {\n labels: ['ecs', 'linux', 'x64'],\n spot: true,\n // ... other config\n }),\n new EcsRunnerProvider(this, 'ECS On-Demand', {\n labels: ['ecs', 'linux', 'x64'],\n spot: false,\n // ... other config\n }),\n]);\n\nnew GitHubRunners(this, 'runners', {\n providers: [ecsFallback],\n});\n```\n\n**Weighted Distribution Strategy**: Randomly select a provider based on weights. Useful for distributing load across multiple availability zones or instance types.\n\n```typescript\n// Distribute 60% of traffic to AZ-1, 40% to AZ-2\nconst distributedProvider = CompositeProvider.distribute(this, 'Fargate Distribution', [\n {\n weight: 3, // 3/(3+2) = 60%\n provider: new FargateRunnerProvider(this, 'Fargate AZ-1', {\n labels: ['fargate', 'linux', 'x64'],\n subnetSelection: vpc.selectSubnets({\n availabilityZones: [vpc.availabilityZones[0]],\n }),\n // ... other config\n }),\n },\n {\n weight: 2, // 2/(3+2) = 40%\n provider: new FargateRunnerProvider(this, 'Fargate AZ-2', {\n labels: ['fargate', 'linux', 'x64'],\n subnetSelection: vpc.selectSubnets({\n availabilityZones: [vpc.availabilityZones[1]],\n }),\n // ... other config\n }),\n },\n]);\n\nnew GitHubRunners(this, 'runners', {\n providers: [distributedProvider],\n});\n```\n\n**Important**: All providers in a composite must have the exact same labels. This ensures any provisioned runner can match the labels requested by the GitHub workflow job.\n\n### Custom Provider Selection\n\nBy default, providers are selected based on label matching: the first provider that has all the labels requested by the job is selected. You can customize this behavior using a provider selector Lambda function to:\n\n* Filter out certain jobs (prevent runner provisioning)\n* Dynamically select a provider based on job characteristics (repository, branch, time of day, etc.)\n* Customize labels for the runner (add, remove, or modify labels dynamically)\n\nThe selector function receives the full GitHub webhook payload, a map of all available providers and their labels, and the default provider/labels that would have been selected. It returns the provider to use (or `undefined` to skip runner creation) and the labels to assign to the runner.\n\n**Example: Route jobs to different providers based on repository**\n\n```typescript\nimport { ComputeType } from 'aws-cdk-lib/aws-codebuild';\nimport { Function, Code, Runtime } from 'aws-cdk-lib/aws-lambda';\nimport { GitHubRunners, CodeBuildRunnerProvider } from '@cloudsnorkel/cdk-github-runners';\n\nconst defaultProvider = new CodeBuildRunnerProvider(this, 'default', {\n labels: ['custom-runner', 'default'],\n});\nconst productionProvider = new CodeBuildRunnerProvider(this, 'production', {\n labels: ['custom-runner', 'production'],\n computeType: ComputeType.LARGE,\n});\n\nconst providerSelector = new Function(this, 'provider-selector', {\n runtime: Runtime.NODEJS_LATEST,\n handler: 'index.handler',\n code: Code.fromInline(`\n exports.handler = async (event) => {\n const { payload, providers, defaultProvider, defaultLabels } = event;\n\n // Route production repos to dedicated provider\n if (payload.repository.name.includes('prod')) {\n return {\n provider: '${productionProvider.node.path}',\n labels: ['custom-runner', 'production', 'modified-via-selector'],\n };\n }\n\n // Filter out draft PRs\n if (payload.workflow_job.head_branch?.startsWith('draft/')) {\n return { provider: undefined }; // Skip runner provisioning\n }\n\n // Use default for everything else\n return {\n provider: defaultProvider,\n labels: defaultLabels,\n };\n };\n `),\n});\n\nnew GitHubRunners(this, 'runners', {\n providers: [defaultProvider, productionProvider],\n providerSelector: providerSelector,\n});\n```\n\n**Example: Add dynamic labels based on job metadata**\n\n```typescript\nconst providerSelector = new Function(this, 'provider-selector', {\n runtime: Runtime.NODEJS_LATEST,\n handler: 'index.handler',\n code: Code.fromInline(`\n exports.handler = async (event) => {\n const { payload, defaultProvider, defaultLabels } = event;\n\n // Add branch name as a label\n const branch = payload.workflow_job.head_branch || 'unknown';\n const labels = [...(defaultLabels || []), 'branch:' + branch];\n\n return {\n provider: defaultProvider,\n labels: labels,\n };\n };\n `),\n});\n```\n\n**Important considerations:**\n\n* β οΈ **Label matching responsibility**: You are responsible for ensuring the selected provider's labels match what the job requires. If labels don't match, the runner will be provisioned but GitHub Actions won't assign the job to it.\n* β οΈ **No guarantee of assignment**: Provider selection only determines which provider will provision a runner. GitHub Actions may still route the job to any available runner with matching labels. For reliable provider assignment, consider repo-level runner registration (the default).\n* β‘ **Performance**: The selector runs synchronously during webhook processing. Keep it fast and efficientβthe webhook has a 30-second timeout total.\n\n## Examples\n\nWe provide comprehensive examples in the [`examples/`](examples/) folder to help you get started quickly:\n\n### Getting Started\n- **[Simple CodeBuild](examples/typescript/simple-codebuild/)** - Basic setup with just a CodeBuild provider (also available in [Python](examples/python/simple-codebuild/))\n\n### Provider Configuration\n- **[Composite Provider](examples/typescript/composite-provider/)** - Fallback and weighted distribution strategies (also available in [Python](examples/python/composite-provider/))\n- **[Provider Selector](examples/typescript/provider-selector/)** - Custom provider selection with Lambda function (also available in [Python](examples/python/provider-selector/))\n- **[EC2 Windows Provider](examples/typescript/ec2-windows-provider/)** - EC2 configuration for Windows runners (also available in [Python](examples/python/ec2-windows-provider/))\n- **[Split Stacks](examples/typescript/split-stacks/)** - Split image builders and providers across multiple stacks (also available in [Python](examples/python/split-stacks/))\n\n### Compute & Performance\n- **[Compute Options](examples/typescript/compute-options/)** - Configure CPU, memory, and instance types for different providers (also available in [Python](examples/python/compute-options/))\n- **[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/))\n- **[Storage Options](examples/typescript/storage-options/)** - Custom EBS storage options for EC2 runners (also available in [Python](examples/python/storage-options/))\n- **[ECS Scaling](examples/typescript/ecs-scaling/)** - Custom autoscaling group scaling policies for ECS providers (also available in [Python](examples/python/ecs-scaling/))\n\n### Security & Access\n- **[IAM Permissions](examples/typescript/iam-permissions/)** - Grant AWS IAM permissions to runners (also available in [Python](examples/python/iam-permissions/))\n- **[Network Access](examples/typescript/network-access/)** - Configure network access with VPCs and security groups (also available in [Python](examples/python/network-access/))\n- **[Access Control](examples/typescript/access-control/)** - Configure access control for webhook and setup functions (also available in [Python](examples/python/access-control/))\n\n### Customization\n- **[Add Software](examples/typescript/add-software/)** - Add custom software to runner images (also available in [Python](examples/python/add-software/))\n\n### Enterprise & Monitoring\n- **[GHES](examples/typescript/ghes/)** - Configure runners for GitHub Enterprise Server (also available in [Python](examples/python/ghes/))\n- **[Monitoring](examples/typescript/monitoring/)** - Set up CloudWatch alarms and SNS notifications (also available in [Python](examples/python/monitoring/))\n\nEach example is self-contained with its own dependencies and README. Start with the simple examples and work your way up to more advanced configurations.\n\nAnother good and very full example is the [integration test](test/default.integ.ts).\n\nIf you have more to share, please open a PR adding examples to the `examples` folder.\n\n## Architecture\n\n\n\n## Troubleshooting\n\nRunners are started in response to a webhook coming in from GitHub. If there are any issues starting the runner like missing capacity or transient API issues, the provider will keep retrying for 24 hours. Configuration issue related errors like pointing to a missing AMI will not be retried. GitHub itself will cancel the job if it can't find a runner for 24 hours. If your jobs don't start, follow the steps below to examine all parts of this workflow.\n\n1. Always start with the status function, make sure no errors are reported, and confirm all status codes are OK\n2. Make sure `runs-on` in the workflow matches the expected labels set in the runner provider\n3. Diagnose relevant executions of the orchestrator step function by visiting the URL in `troubleshooting.stepFunctionUrl` from `status.json`\n 1. If the execution failed, check your runner provider configuration for errors\n 2. If the execution is still running for a long time, check the execution events to see why runner starting is being retried\n 3. If there are no relevant executions, move to the next step\n4. Confirm the webhook Lambda was called by visiting the URL in `troubleshooting.webhookHandlerUrl` from `status.json`\n 1. If it's not called or logs errors, confirm the webhook settings on the GitHub side\n 2. If you see too many errors, make sure you're only sending `workflow_job` events\n5. When using GitHub app, make sure there are active installations in `github.auth.app.installations`\n\nAll logs are saved in CloudWatch.\n* Log group names can be found in `status.json` for each provider, image builder, and other parts of the system\n* Some useful Logs Insights queries can be enabled with `GitHubRunners.createLogsInsightsQueries()`\n\nTo get `status.json`, check out the CloudFormation stack output for a command that generates it. The command looks like:\n\n```\naws --region us-east-1 lambda invoke --function-name status-XYZ123 status.json\n```\n\n## Monitoring\n\nThere are two important ways to monitor your runners:\n\n1. Make sure runners don't fail to start. When that happens, jobs may sit and wait. Use `GitHubRunners.metricFailed()` to get a metric for the number of failed runner starts. You should use this metric to trigger an alarm.\n2. Make sure runner images don't fail to build. Failed runner image builds mean you will get stuck with out-of-date software on your runners. It may lead to security vulnerabilities, or it may lead to slower runner start-ups as the runner software itself needs to be updated. Use `GitHubRunners.failedImageBuildsTopic()` to get SNS topic that gets notified of failed runner image builds. You should subscribe to this topic.\n\nOther useful metrics to track:\n\n1. Use `GitHubRunners.metricJobCompleted()` to get a metric for the number of completed jobs broken down by labels and job success.\n2. Use `GitHubRunners.metricTime()` to get a metric for the total time a runner is running. This includes the overhead of starting the runner.\n\n## Contributing\n\nIf you use and love this project, please consider contributing.\n\n1. πͺ³ If you see something, say something. [Issues][16] help improve the quality of the project.\n * Include relevant logs and package versions for bugs.\n * When possible, describe the use-case behind feature requests.\n1. π οΈ [Pull requests][17] are welcome.\n * Run `npm run build` before submitting to make sure all tests pass.\n * Allow edits from maintainers so small adjustments can be made easily.\n1. π΅ Consider [sponsoring][15] the project to show your support and optionally get your name listed below.\n\n## Other Options\n\n1. [github-aws-runners/terraform-aws-github-runner][3] if you're using Terraform\n2. [actions/actions-runner-controller][4] if you're using Kubernetes\n\n\n[1]: https://docs.github.com/en/actions/hosting-your-own-runners/about-self-hosted-runners\n[2]: https://github.com/marketplace/actions/configure-aws-credentials-action-for-github-actions\n[3]: https://github.com/github-aws-runners/terraform-aws-github-runner\n[4]: https://github.com/actions/actions-runner-controller\n[5]: https://github.com/actions/runner\n[6]: https://pypi.org/project/cloudsnorkel.cdk-github-runners\n[7]: https://www.npmjs.com/package/@cloudsnorkel/cdk-github-runners\n[8]: https://central.sonatype.com/artifact/com.cloudsnorkel/cdk.github.runners/\n[9]: https://docs.github.com/en/developers/apps/getting-started-with-apps/about-apps\n[10]: https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token\n[11]: https://pkg.go.dev/github.com/CloudSnorkel/cdk-github-runners-go/cloudsnorkelcdkgithubrunners\n[12]: https://www.nuget.org/packages/CloudSnorkel.Cdk.Github.Runners/\n[13]: https://constructs.dev/packages/@cloudsnorkel/cdk-github-runners/\n[14]: https://docs.github.com/en/actions/hosting-your-own-runners/autoscaling-with-self-hosted-runners#using-ephemeral-runners-for-autoscaling\n[15]: https://github.com/sponsors/CloudSnorkel\n[16]: https://github.com/CloudSnorkel/cdk-github-runners/issues\n[17]: https://github.com/CloudSnorkel/cdk-github-runners/pulls\n"
|
|
3862
3862
|
},
|
|
3863
3863
|
"repository": {
|
|
3864
3864
|
"type": "git",
|
|
@@ -13934,7 +13934,7 @@
|
|
|
13934
13934
|
"kind": "class",
|
|
13935
13935
|
"locationInModule": {
|
|
13936
13936
|
"filename": "src/image-builders/components.ts",
|
|
13937
|
-
"line":
|
|
13937
|
+
"line": 42
|
|
13938
13938
|
},
|
|
13939
13939
|
"methods": [
|
|
13940
13940
|
{
|
|
@@ -13944,7 +13944,7 @@
|
|
|
13944
13944
|
},
|
|
13945
13945
|
"locationInModule": {
|
|
13946
13946
|
"filename": "src/image-builders/components.ts",
|
|
13947
|
-
"line":
|
|
13947
|
+
"line": 184
|
|
13948
13948
|
},
|
|
13949
13949
|
"name": "awsCli",
|
|
13950
13950
|
"returns": {
|
|
@@ -13961,7 +13961,7 @@
|
|
|
13961
13961
|
},
|
|
13962
13962
|
"locationInModule": {
|
|
13963
13963
|
"filename": "src/image-builders/components.ts",
|
|
13964
|
-
"line":
|
|
13964
|
+
"line": 110
|
|
13965
13965
|
},
|
|
13966
13966
|
"name": "cloudWatchAgent",
|
|
13967
13967
|
"returns": {
|
|
@@ -13979,7 +13979,7 @@
|
|
|
13979
13979
|
},
|
|
13980
13980
|
"locationInModule": {
|
|
13981
13981
|
"filename": "src/image-builders/components.ts",
|
|
13982
|
-
"line":
|
|
13982
|
+
"line": 52
|
|
13983
13983
|
},
|
|
13984
13984
|
"name": "custom",
|
|
13985
13985
|
"parameters": [
|
|
@@ -14005,7 +14005,7 @@
|
|
|
14005
14005
|
},
|
|
14006
14006
|
"locationInModule": {
|
|
14007
14007
|
"filename": "src/image-builders/components.ts",
|
|
14008
|
-
"line":
|
|
14008
|
+
"line": 402
|
|
14009
14009
|
},
|
|
14010
14010
|
"name": "docker",
|
|
14011
14011
|
"returns": {
|
|
@@ -14023,7 +14023,7 @@
|
|
|
14023
14023
|
},
|
|
14024
14024
|
"locationInModule": {
|
|
14025
14025
|
"filename": "src/image-builders/components.ts",
|
|
14026
|
-
"line":
|
|
14026
|
+
"line": 480
|
|
14027
14027
|
},
|
|
14028
14028
|
"name": "dockerInDocker",
|
|
14029
14029
|
"returns": {
|
|
@@ -14041,7 +14041,7 @@
|
|
|
14041
14041
|
},
|
|
14042
14042
|
"locationInModule": {
|
|
14043
14043
|
"filename": "src/image-builders/components.ts",
|
|
14044
|
-
"line":
|
|
14044
|
+
"line": 597
|
|
14045
14045
|
},
|
|
14046
14046
|
"name": "environmentVariables",
|
|
14047
14047
|
"parameters": [
|
|
@@ -14072,7 +14072,7 @@
|
|
|
14072
14072
|
},
|
|
14073
14073
|
"locationInModule": {
|
|
14074
14074
|
"filename": "src/image-builders/components.ts",
|
|
14075
|
-
"line":
|
|
14075
|
+
"line": 490
|
|
14076
14076
|
},
|
|
14077
14077
|
"name": "extraCertificates",
|
|
14078
14078
|
"parameters": [
|
|
@@ -14109,7 +14109,7 @@
|
|
|
14109
14109
|
},
|
|
14110
14110
|
"locationInModule": {
|
|
14111
14111
|
"filename": "src/image-builders/components.ts",
|
|
14112
|
-
"line":
|
|
14112
|
+
"line": 263
|
|
14113
14113
|
},
|
|
14114
14114
|
"name": "git",
|
|
14115
14115
|
"returns": {
|
|
@@ -14126,7 +14126,7 @@
|
|
|
14126
14126
|
},
|
|
14127
14127
|
"locationInModule": {
|
|
14128
14128
|
"filename": "src/image-builders/components.ts",
|
|
14129
|
-
"line":
|
|
14129
|
+
"line": 220
|
|
14130
14130
|
},
|
|
14131
14131
|
"name": "githubCli",
|
|
14132
14132
|
"returns": {
|
|
@@ -14144,7 +14144,7 @@
|
|
|
14144
14144
|
},
|
|
14145
14145
|
"locationInModule": {
|
|
14146
14146
|
"filename": "src/image-builders/components.ts",
|
|
14147
|
-
"line":
|
|
14147
|
+
"line": 307
|
|
14148
14148
|
},
|
|
14149
14149
|
"name": "githubRunner",
|
|
14150
14150
|
"parameters": [
|
|
@@ -14173,7 +14173,7 @@
|
|
|
14173
14173
|
},
|
|
14174
14174
|
"locationInModule": {
|
|
14175
14175
|
"filename": "src/image-builders/components.ts",
|
|
14176
|
-
"line":
|
|
14176
|
+
"line": 554
|
|
14177
14177
|
},
|
|
14178
14178
|
"name": "lambdaEntrypoint",
|
|
14179
14179
|
"returns": {
|
|
@@ -14190,7 +14190,7 @@
|
|
|
14190
14190
|
},
|
|
14191
14191
|
"locationInModule": {
|
|
14192
14192
|
"filename": "src/image-builders/components.ts",
|
|
14193
|
-
"line":
|
|
14193
|
+
"line": 77
|
|
14194
14194
|
},
|
|
14195
14195
|
"name": "requiredPackages",
|
|
14196
14196
|
"returns": {
|
|
@@ -14207,7 +14207,7 @@
|
|
|
14207
14207
|
},
|
|
14208
14208
|
"locationInModule": {
|
|
14209
14209
|
"filename": "src/image-builders/components.ts",
|
|
14210
|
-
"line":
|
|
14210
|
+
"line": 153
|
|
14211
14211
|
},
|
|
14212
14212
|
"name": "runnerUser",
|
|
14213
14213
|
"returns": {
|
|
@@ -14225,7 +14225,7 @@
|
|
|
14225
14225
|
},
|
|
14226
14226
|
"locationInModule": {
|
|
14227
14227
|
"filename": "src/image-builders/components.ts",
|
|
14228
|
-
"line":
|
|
14228
|
+
"line": 634
|
|
14229
14229
|
},
|
|
14230
14230
|
"name": "getAssets",
|
|
14231
14231
|
"parameters": [
|
|
@@ -14262,7 +14262,7 @@
|
|
|
14262
14262
|
},
|
|
14263
14263
|
"locationInModule": {
|
|
14264
14264
|
"filename": "src/image-builders/components.ts",
|
|
14265
|
-
"line":
|
|
14265
|
+
"line": 629
|
|
14266
14266
|
},
|
|
14267
14267
|
"name": "getCommands",
|
|
14268
14268
|
"parameters": [
|
|
@@ -14298,7 +14298,7 @@
|
|
|
14298
14298
|
},
|
|
14299
14299
|
"locationInModule": {
|
|
14300
14300
|
"filename": "src/image-builders/components.ts",
|
|
14301
|
-
"line":
|
|
14301
|
+
"line": 643
|
|
14302
14302
|
},
|
|
14303
14303
|
"name": "getDockerCommands",
|
|
14304
14304
|
"parameters": [
|
|
@@ -14333,7 +14333,7 @@
|
|
|
14333
14333
|
},
|
|
14334
14334
|
"locationInModule": {
|
|
14335
14335
|
"filename": "src/image-builders/components.ts",
|
|
14336
|
-
"line":
|
|
14336
|
+
"line": 650
|
|
14337
14337
|
},
|
|
14338
14338
|
"name": "shouldReboot",
|
|
14339
14339
|
"parameters": [
|
|
@@ -14369,7 +14369,7 @@
|
|
|
14369
14369
|
"immutable": true,
|
|
14370
14370
|
"locationInModule": {
|
|
14371
14371
|
"filename": "src/image-builders/components.ts",
|
|
14372
|
-
"line":
|
|
14372
|
+
"line": 624
|
|
14373
14373
|
},
|
|
14374
14374
|
"name": "name",
|
|
14375
14375
|
"type": {
|
|
@@ -14389,7 +14389,7 @@
|
|
|
14389
14389
|
"kind": "interface",
|
|
14390
14390
|
"locationInModule": {
|
|
14391
14391
|
"filename": "src/image-builders/components.ts",
|
|
14392
|
-
"line":
|
|
14392
|
+
"line": 11
|
|
14393
14393
|
},
|
|
14394
14394
|
"name": "RunnerImageComponentCustomProps",
|
|
14395
14395
|
"properties": [
|
|
@@ -14402,7 +14402,7 @@
|
|
|
14402
14402
|
"immutable": true,
|
|
14403
14403
|
"locationInModule": {
|
|
14404
14404
|
"filename": "src/image-builders/components.ts",
|
|
14405
|
-
"line":
|
|
14405
|
+
"line": 27
|
|
14406
14406
|
},
|
|
14407
14407
|
"name": "assets",
|
|
14408
14408
|
"optional": true,
|
|
@@ -14424,7 +14424,7 @@
|
|
|
14424
14424
|
"immutable": true,
|
|
14425
14425
|
"locationInModule": {
|
|
14426
14426
|
"filename": "src/image-builders/components.ts",
|
|
14427
|
-
"line":
|
|
14427
|
+
"line": 22
|
|
14428
14428
|
},
|
|
14429
14429
|
"name": "commands",
|
|
14430
14430
|
"optional": true,
|
|
@@ -14447,7 +14447,7 @@
|
|
|
14447
14447
|
"immutable": true,
|
|
14448
14448
|
"locationInModule": {
|
|
14449
14449
|
"filename": "src/image-builders/components.ts",
|
|
14450
|
-
"line":
|
|
14450
|
+
"line": 36
|
|
14451
14451
|
},
|
|
14452
14452
|
"name": "dockerCommands",
|
|
14453
14453
|
"optional": true,
|
|
@@ -14470,7 +14470,7 @@
|
|
|
14470
14470
|
"immutable": true,
|
|
14471
14471
|
"locationInModule": {
|
|
14472
14472
|
"filename": "src/image-builders/components.ts",
|
|
14473
|
-
"line":
|
|
14473
|
+
"line": 17
|
|
14474
14474
|
},
|
|
14475
14475
|
"name": "name",
|
|
14476
14476
|
"optional": true,
|
|
@@ -15431,6 +15431,6 @@
|
|
|
15431
15431
|
"symbolId": "src/image-builders/aws-image-builder/deprecated/windows-components:WindowsComponents"
|
|
15432
15432
|
}
|
|
15433
15433
|
},
|
|
15434
|
-
"version": "0.14.
|
|
15435
|
-
"fingerprint": "
|
|
15434
|
+
"version": "0.14.21",
|
|
15435
|
+
"fingerprint": "2WzIvXgat3AOnVsbA/7Ybt3zV5R6H4ZljlJYEWj0qbU="
|
|
15436
15436
|
}
|
package/README.md
CHANGED
|
@@ -456,6 +456,7 @@ We provide comprehensive examples in the [`examples/`](examples/) folder to help
|
|
|
456
456
|
- **[Composite Provider](examples/typescript/composite-provider/)** - Fallback and weighted distribution strategies (also available in [Python](examples/python/composite-provider/))
|
|
457
457
|
- **[Provider Selector](examples/typescript/provider-selector/)** - Custom provider selection with Lambda function (also available in [Python](examples/python/provider-selector/))
|
|
458
458
|
- **[EC2 Windows Provider](examples/typescript/ec2-windows-provider/)** - EC2 configuration for Windows runners (also available in [Python](examples/python/ec2-windows-provider/))
|
|
459
|
+
- **[Split Stacks](examples/typescript/split-stacks/)** - Split image builders and providers across multiple stacks (also available in [Python](examples/python/split-stacks/))
|
|
459
460
|
|
|
460
461
|
### Compute & Performance
|
|
461
462
|
- **[Compute Options](examples/typescript/compute-options/)** - Configure CPU, memory, and instance types for different providers (also available in [Python](examples/python/compute-options/))
|