@cloudsnorkel/cdk-github-runners 0.14.6 → 0.14.8
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 +32 -32
- package/README.md +6 -0
- package/assets/delete-failed-runner.lambda/index.js +25 -9
- package/assets/idle-runner-repear.lambda/index.js +25 -9
- package/assets/image-builders/aws-image-builder/versioner.lambda/index.js +25 -9
- package/assets/setup.lambda/index.html +8 -10
- package/assets/status.lambda/index.js +25 -9
- package/assets/token-retriever.lambda/index.js +25 -9
- package/assets/webhook-handler.lambda/index.js +25 -9
- package/lib/access.js +1 -1
- package/lib/delete-failed-runner-function.js +2 -2
- package/lib/idle-runner-repear-function.js +2 -2
- package/lib/image-builders/api.js +1 -1
- package/lib/image-builders/aws-image-builder/builder.d.ts +1 -1
- package/lib/image-builders/aws-image-builder/builder.js +2 -2
- package/lib/image-builders/aws-image-builder/delete-resources-function.js +2 -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-function.js +2 -2
- package/lib/image-builders/aws-image-builder/versioner-function.js +2 -2
- package/lib/image-builders/build-image-function.js +2 -2
- package/lib/image-builders/codebuild-deprecated.js +1 -1
- package/lib/image-builders/components.js +1 -1
- package/lib/image-builders/static.js +1 -1
- package/lib/providers/ami-root-device-function.js +2 -2
- package/lib/providers/codebuild.js +2 -2
- package/lib/providers/common.js +3 -3
- package/lib/providers/ec2.js +8 -3
- package/lib/providers/ecs.js +1 -1
- package/lib/providers/fargate.js +4 -4
- package/lib/providers/lambda.js +2 -2
- package/lib/providers/update-lambda-function.js +2 -2
- package/lib/runner.js +1 -1
- package/lib/secrets.js +1 -1
- package/lib/setup-function.js +2 -2
- package/lib/status-function.js +2 -2
- package/lib/token-retriever-function.js +2 -2
- package/lib/webhook-handler-function.js +2 -2
- package/package.json +25 -24
package/.jsii
CHANGED
|
@@ -3834,7 +3834,7 @@
|
|
|
3834
3834
|
"stability": "experimental"
|
|
3835
3835
|
},
|
|
3836
3836
|
"homepage": "https://github.com/CloudSnorkel/cdk-github-runners.git",
|
|
3837
|
-
"jsiiVersion": "5.5
|
|
3837
|
+
"jsiiVersion": "5.8.5 (build 2b48a8e)",
|
|
3838
3838
|
"keywords": [
|
|
3839
3839
|
"aws",
|
|
3840
3840
|
"aws-cdk",
|
|
@@ -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## 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. [philips-labs/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/philips-labs/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## Examples\n\nBeyond the code snippets above, the fullest example available is the [integration test](test/default.integ.ts).\n\nIf you have more to share, please open a PR adding them 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. [philips-labs/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/philips-labs/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",
|
|
@@ -6821,7 +6821,7 @@
|
|
|
6821
6821
|
},
|
|
6822
6822
|
"locationInModule": {
|
|
6823
6823
|
"filename": "src/providers/ec2.ts",
|
|
6824
|
-
"line":
|
|
6824
|
+
"line": 380
|
|
6825
6825
|
},
|
|
6826
6826
|
"parameters": [
|
|
6827
6827
|
{
|
|
@@ -6848,7 +6848,7 @@
|
|
|
6848
6848
|
"kind": "class",
|
|
6849
6849
|
"locationInModule": {
|
|
6850
6850
|
"filename": "src/providers/ec2.ts",
|
|
6851
|
-
"line":
|
|
6851
|
+
"line": 621
|
|
6852
6852
|
},
|
|
6853
6853
|
"name": "Ec2Runner",
|
|
6854
6854
|
"symbolId": "src/providers/ec2:Ec2Runner"
|
|
@@ -6868,7 +6868,7 @@
|
|
|
6868
6868
|
},
|
|
6869
6869
|
"locationInModule": {
|
|
6870
6870
|
"filename": "src/providers/ec2.ts",
|
|
6871
|
-
"line":
|
|
6871
|
+
"line": 380
|
|
6872
6872
|
},
|
|
6873
6873
|
"parameters": [
|
|
6874
6874
|
{
|
|
@@ -6898,7 +6898,7 @@
|
|
|
6898
6898
|
"kind": "class",
|
|
6899
6899
|
"locationInModule": {
|
|
6900
6900
|
"filename": "src/providers/ec2.ts",
|
|
6901
|
-
"line":
|
|
6901
|
+
"line": 308
|
|
6902
6902
|
},
|
|
6903
6903
|
"methods": [
|
|
6904
6904
|
{
|
|
@@ -6909,7 +6909,7 @@
|
|
|
6909
6909
|
},
|
|
6910
6910
|
"locationInModule": {
|
|
6911
6911
|
"filename": "src/providers/ec2.ts",
|
|
6912
|
-
"line":
|
|
6912
|
+
"line": 327
|
|
6913
6913
|
},
|
|
6914
6914
|
"name": "imageBuilder",
|
|
6915
6915
|
"parameters": [
|
|
@@ -6948,7 +6948,7 @@
|
|
|
6948
6948
|
},
|
|
6949
6949
|
"locationInModule": {
|
|
6950
6950
|
"filename": "src/providers/ec2.ts",
|
|
6951
|
-
"line":
|
|
6951
|
+
"line": 443
|
|
6952
6952
|
},
|
|
6953
6953
|
"name": "getStepFunctionTask",
|
|
6954
6954
|
"overrides": "@cloudsnorkel/cdk-github-runners.IRunnerProvider",
|
|
@@ -6977,7 +6977,7 @@
|
|
|
6977
6977
|
},
|
|
6978
6978
|
"locationInModule": {
|
|
6979
6979
|
"filename": "src/providers/ec2.ts",
|
|
6980
|
-
"line":
|
|
6980
|
+
"line": 561
|
|
6981
6981
|
},
|
|
6982
6982
|
"name": "grantStateMachine",
|
|
6983
6983
|
"overrides": "@cloudsnorkel/cdk-github-runners.IRunnerProvider",
|
|
@@ -7046,7 +7046,7 @@
|
|
|
7046
7046
|
},
|
|
7047
7047
|
"locationInModule": {
|
|
7048
7048
|
"filename": "src/providers/ec2.ts",
|
|
7049
|
-
"line":
|
|
7049
|
+
"line": 591
|
|
7050
7050
|
},
|
|
7051
7051
|
"name": "status",
|
|
7052
7052
|
"overrides": "@cloudsnorkel/cdk-github-runners.IRunnerProvider",
|
|
@@ -7075,7 +7075,7 @@
|
|
|
7075
7075
|
"immutable": true,
|
|
7076
7076
|
"locationInModule": {
|
|
7077
7077
|
"filename": "src/providers/ec2.ts",
|
|
7078
|
-
"line":
|
|
7078
|
+
"line": 613
|
|
7079
7079
|
},
|
|
7080
7080
|
"name": "connections",
|
|
7081
7081
|
"overrides": "aws-cdk-lib.aws_ec2.IConnectable",
|
|
@@ -7091,7 +7091,7 @@
|
|
|
7091
7091
|
"immutable": true,
|
|
7092
7092
|
"locationInModule": {
|
|
7093
7093
|
"filename": "src/providers/ec2.ts",
|
|
7094
|
-
"line":
|
|
7094
|
+
"line": 353
|
|
7095
7095
|
},
|
|
7096
7096
|
"name": "grantPrincipal",
|
|
7097
7097
|
"overrides": "aws-cdk-lib.aws_iam.IGrantable",
|
|
@@ -7107,7 +7107,7 @@
|
|
|
7107
7107
|
"immutable": true,
|
|
7108
7108
|
"locationInModule": {
|
|
7109
7109
|
"filename": "src/providers/ec2.ts",
|
|
7110
|
-
"line":
|
|
7110
|
+
"line": 348
|
|
7111
7111
|
},
|
|
7112
7112
|
"name": "labels",
|
|
7113
7113
|
"overrides": "@cloudsnorkel/cdk-github-runners.IRunnerProvider",
|
|
@@ -7129,7 +7129,7 @@
|
|
|
7129
7129
|
"immutable": true,
|
|
7130
7130
|
"locationInModule": {
|
|
7131
7131
|
"filename": "src/providers/ec2.ts",
|
|
7132
|
-
"line":
|
|
7132
|
+
"line": 360
|
|
7133
7133
|
},
|
|
7134
7134
|
"name": "logGroup",
|
|
7135
7135
|
"overrides": "@cloudsnorkel/cdk-github-runners.IRunnerProvider",
|
|
@@ -7145,7 +7145,7 @@
|
|
|
7145
7145
|
"immutable": true,
|
|
7146
7146
|
"locationInModule": {
|
|
7147
7147
|
"filename": "src/providers/ec2.ts",
|
|
7148
|
-
"line":
|
|
7148
|
+
"line": 362
|
|
7149
7149
|
},
|
|
7150
7150
|
"name": "retryableErrors",
|
|
7151
7151
|
"overrides": "@cloudsnorkel/cdk-github-runners.IRunnerProvider",
|
|
@@ -7175,7 +7175,7 @@
|
|
|
7175
7175
|
"kind": "interface",
|
|
7176
7176
|
"locationInModule": {
|
|
7177
7177
|
"filename": "src/providers/ec2.ts",
|
|
7178
|
-
"line":
|
|
7178
|
+
"line": 190
|
|
7179
7179
|
},
|
|
7180
7180
|
"name": "Ec2RunnerProviderProps",
|
|
7181
7181
|
"properties": [
|
|
@@ -7188,7 +7188,7 @@
|
|
|
7188
7188
|
"immutable": true,
|
|
7189
7189
|
"locationInModule": {
|
|
7190
7190
|
"filename": "src/providers/ec2.ts",
|
|
7191
|
-
"line":
|
|
7191
|
+
"line": 203
|
|
7192
7192
|
},
|
|
7193
7193
|
"name": "amiBuilder",
|
|
7194
7194
|
"optional": true,
|
|
@@ -7207,7 +7207,7 @@
|
|
|
7207
7207
|
"immutable": true,
|
|
7208
7208
|
"locationInModule": {
|
|
7209
7209
|
"filename": "src/providers/ec2.ts",
|
|
7210
|
-
"line":
|
|
7210
|
+
"line": 228
|
|
7211
7211
|
},
|
|
7212
7212
|
"name": "group",
|
|
7213
7213
|
"optional": true,
|
|
@@ -7226,7 +7226,7 @@
|
|
|
7226
7226
|
"immutable": true,
|
|
7227
7227
|
"locationInModule": {
|
|
7228
7228
|
"filename": "src/providers/ec2.ts",
|
|
7229
|
-
"line":
|
|
7229
|
+
"line": 198
|
|
7230
7230
|
},
|
|
7231
7231
|
"name": "imageBuilder",
|
|
7232
7232
|
"optional": true,
|
|
@@ -7244,7 +7244,7 @@
|
|
|
7244
7244
|
"immutable": true,
|
|
7245
7245
|
"locationInModule": {
|
|
7246
7246
|
"filename": "src/providers/ec2.ts",
|
|
7247
|
-
"line":
|
|
7247
|
+
"line": 235
|
|
7248
7248
|
},
|
|
7249
7249
|
"name": "instanceType",
|
|
7250
7250
|
"optional": true,
|
|
@@ -7263,7 +7263,7 @@
|
|
|
7263
7263
|
"immutable": true,
|
|
7264
7264
|
"locationInModule": {
|
|
7265
7265
|
"filename": "src/providers/ec2.ts",
|
|
7266
|
-
"line":
|
|
7266
|
+
"line": 214
|
|
7267
7267
|
},
|
|
7268
7268
|
"name": "labels",
|
|
7269
7269
|
"optional": true,
|
|
@@ -7287,7 +7287,7 @@
|
|
|
7287
7287
|
"immutable": true,
|
|
7288
7288
|
"locationInModule": {
|
|
7289
7289
|
"filename": "src/providers/ec2.ts",
|
|
7290
|
-
"line":
|
|
7290
|
+
"line": 256
|
|
7291
7291
|
},
|
|
7292
7292
|
"name": "securityGroup",
|
|
7293
7293
|
"optional": true,
|
|
@@ -7305,7 +7305,7 @@
|
|
|
7305
7305
|
"immutable": true,
|
|
7306
7306
|
"locationInModule": {
|
|
7307
7307
|
"filename": "src/providers/ec2.ts",
|
|
7308
|
-
"line":
|
|
7308
|
+
"line": 263
|
|
7309
7309
|
},
|
|
7310
7310
|
"name": "securityGroups",
|
|
7311
7311
|
"optional": true,
|
|
@@ -7329,7 +7329,7 @@
|
|
|
7329
7329
|
"immutable": true,
|
|
7330
7330
|
"locationInModule": {
|
|
7331
7331
|
"filename": "src/providers/ec2.ts",
|
|
7332
|
-
"line":
|
|
7332
|
+
"line": 293
|
|
7333
7333
|
},
|
|
7334
7334
|
"name": "spot",
|
|
7335
7335
|
"optional": true,
|
|
@@ -7347,7 +7347,7 @@
|
|
|
7347
7347
|
"immutable": true,
|
|
7348
7348
|
"locationInModule": {
|
|
7349
7349
|
"filename": "src/providers/ec2.ts",
|
|
7350
|
-
"line":
|
|
7350
|
+
"line": 300
|
|
7351
7351
|
},
|
|
7352
7352
|
"name": "spotMaxPrice",
|
|
7353
7353
|
"optional": true,
|
|
@@ -7364,7 +7364,7 @@
|
|
|
7364
7364
|
"immutable": true,
|
|
7365
7365
|
"locationInModule": {
|
|
7366
7366
|
"filename": "src/providers/ec2.ts",
|
|
7367
|
-
"line":
|
|
7367
|
+
"line": 247
|
|
7368
7368
|
},
|
|
7369
7369
|
"name": "storageOptions",
|
|
7370
7370
|
"optional": true,
|
|
@@ -7383,7 +7383,7 @@
|
|
|
7383
7383
|
"immutable": true,
|
|
7384
7384
|
"locationInModule": {
|
|
7385
7385
|
"filename": "src/providers/ec2.ts",
|
|
7386
|
-
"line":
|
|
7386
|
+
"line": 242
|
|
7387
7387
|
},
|
|
7388
7388
|
"name": "storageSize",
|
|
7389
7389
|
"optional": true,
|
|
@@ -7402,7 +7402,7 @@
|
|
|
7402
7402
|
"immutable": true,
|
|
7403
7403
|
"locationInModule": {
|
|
7404
7404
|
"filename": "src/providers/ec2.ts",
|
|
7405
|
-
"line":
|
|
7405
|
+
"line": 272
|
|
7406
7406
|
},
|
|
7407
7407
|
"name": "subnet",
|
|
7408
7408
|
"optional": true,
|
|
@@ -7421,7 +7421,7 @@
|
|
|
7421
7421
|
"immutable": true,
|
|
7422
7422
|
"locationInModule": {
|
|
7423
7423
|
"filename": "src/providers/ec2.ts",
|
|
7424
|
-
"line":
|
|
7424
|
+
"line": 286
|
|
7425
7425
|
},
|
|
7426
7426
|
"name": "subnetSelection",
|
|
7427
7427
|
"optional": true,
|
|
@@ -7439,7 +7439,7 @@
|
|
|
7439
7439
|
"immutable": true,
|
|
7440
7440
|
"locationInModule": {
|
|
7441
7441
|
"filename": "src/providers/ec2.ts",
|
|
7442
|
-
"line":
|
|
7442
|
+
"line": 279
|
|
7443
7443
|
},
|
|
7444
7444
|
"name": "vpc",
|
|
7445
7445
|
"optional": true,
|
|
@@ -14276,6 +14276,6 @@
|
|
|
14276
14276
|
"symbolId": "src/image-builders/aws-image-builder/deprecated/windows-components:WindowsComponents"
|
|
14277
14277
|
}
|
|
14278
14278
|
},
|
|
14279
|
-
"version": "0.14.
|
|
14280
|
-
"fingerprint": "
|
|
14279
|
+
"version": "0.14.8",
|
|
14280
|
+
"fingerprint": "jTdC8359Yk3LXhBUPB+8gmZzU7/wIZ07nBnUkJlo2uY="
|
|
14281
14281
|
}
|
package/README.md
CHANGED
|
@@ -296,6 +296,12 @@ new GitHubRunners(this, 'runners', {
|
|
|
296
296
|
});
|
|
297
297
|
```
|
|
298
298
|
|
|
299
|
+
## Examples
|
|
300
|
+
|
|
301
|
+
Beyond the code snippets above, the fullest example available is the [integration test](test/default.integ.ts).
|
|
302
|
+
|
|
303
|
+
If you have more to share, please open a PR adding them to the `examples` folder.
|
|
304
|
+
|
|
299
305
|
## Architecture
|
|
300
306
|
|
|
301
307
|

|
|
@@ -5688,6 +5688,7 @@ var require_re = __commonJS({
|
|
|
5688
5688
|
var re = exports2.re = [];
|
|
5689
5689
|
var safeRe = exports2.safeRe = [];
|
|
5690
5690
|
var src = exports2.src = [];
|
|
5691
|
+
var safeSrc = exports2.safeSrc = [];
|
|
5691
5692
|
var t = exports2.t = {};
|
|
5692
5693
|
var R = 0;
|
|
5693
5694
|
var LETTERDASHNUMBER = "[a-zA-Z0-9-]";
|
|
@@ -5708,6 +5709,7 @@ var require_re = __commonJS({
|
|
|
5708
5709
|
debug(name, index, value);
|
|
5709
5710
|
t[name] = index;
|
|
5710
5711
|
src[index] = value;
|
|
5712
|
+
safeSrc[index] = safe;
|
|
5711
5713
|
re[index] = new RegExp(value, isGlobal ? "g" : void 0);
|
|
5712
5714
|
safeRe[index] = new RegExp(safe, isGlobal ? "g" : void 0);
|
|
5713
5715
|
};
|
|
@@ -5807,7 +5809,7 @@ var require_semver = __commonJS({
|
|
|
5807
5809
|
"use strict";
|
|
5808
5810
|
var debug = require_debug();
|
|
5809
5811
|
var { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
|
|
5810
|
-
var { safeRe: re, t } = require_re();
|
|
5812
|
+
var { safeRe: re, safeSrc: src, t } = require_re();
|
|
5811
5813
|
var parseOptions = require_parse_options();
|
|
5812
5814
|
var { compareIdentifiers } = require_identifiers();
|
|
5813
5815
|
var SemVer = class _SemVer {
|
|
@@ -5947,6 +5949,18 @@ var require_semver = __commonJS({
|
|
|
5947
5949
|
// preminor will bump the version up to the next minor release, and immediately
|
|
5948
5950
|
// down to pre-release. premajor and prepatch work the same way.
|
|
5949
5951
|
inc(release, identifier, identifierBase) {
|
|
5952
|
+
if (release.startsWith("pre")) {
|
|
5953
|
+
if (!identifier && identifierBase === false) {
|
|
5954
|
+
throw new Error("invalid increment argument: identifier is empty");
|
|
5955
|
+
}
|
|
5956
|
+
if (identifier) {
|
|
5957
|
+
const r = new RegExp(`^${this.options.loose ? src[t.PRERELEASELOOSE] : src[t.PRERELEASE]}$`);
|
|
5958
|
+
const match = `-${identifier}`.match(r);
|
|
5959
|
+
if (!match || match[1] !== identifier) {
|
|
5960
|
+
throw new Error(`invalid identifier: ${identifier}`);
|
|
5961
|
+
}
|
|
5962
|
+
}
|
|
5963
|
+
}
|
|
5950
5964
|
switch (release) {
|
|
5951
5965
|
case "premajor":
|
|
5952
5966
|
this.prerelease.length = 0;
|
|
@@ -5974,6 +5988,12 @@ var require_semver = __commonJS({
|
|
|
5974
5988
|
}
|
|
5975
5989
|
this.inc("pre", identifier, identifierBase);
|
|
5976
5990
|
break;
|
|
5991
|
+
case "release":
|
|
5992
|
+
if (this.prerelease.length === 0) {
|
|
5993
|
+
throw new Error(`version ${this.raw} is not a prerelease`);
|
|
5994
|
+
}
|
|
5995
|
+
this.prerelease.length = 0;
|
|
5996
|
+
break;
|
|
5977
5997
|
case "major":
|
|
5978
5998
|
if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
|
|
5979
5999
|
this.major++;
|
|
@@ -5999,9 +6019,6 @@ var require_semver = __commonJS({
|
|
|
5999
6019
|
// 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
|
|
6000
6020
|
case "pre": {
|
|
6001
6021
|
const base = Number(identifierBase) ? 1 : 0;
|
|
6002
|
-
if (!identifier && identifierBase === false) {
|
|
6003
|
-
throw new Error("invalid increment argument: identifier is empty");
|
|
6004
|
-
}
|
|
6005
6022
|
if (this.prerelease.length === 0) {
|
|
6006
6023
|
this.prerelease = [base];
|
|
6007
6024
|
} else {
|
|
@@ -6141,13 +6158,12 @@ var require_diff = __commonJS({
|
|
|
6141
6158
|
if (!lowVersion.patch && !lowVersion.minor) {
|
|
6142
6159
|
return "major";
|
|
6143
6160
|
}
|
|
6144
|
-
if (highVersion
|
|
6161
|
+
if (lowVersion.compareMain(highVersion) === 0) {
|
|
6162
|
+
if (lowVersion.minor && !lowVersion.patch) {
|
|
6163
|
+
return "minor";
|
|
6164
|
+
}
|
|
6145
6165
|
return "patch";
|
|
6146
6166
|
}
|
|
6147
|
-
if (highVersion.minor) {
|
|
6148
|
-
return "minor";
|
|
6149
|
-
}
|
|
6150
|
-
return "major";
|
|
6151
6167
|
}
|
|
6152
6168
|
const prefix = highHasPre ? "pre" : "";
|
|
6153
6169
|
if (v1.major !== v2.major) {
|
|
@@ -5688,6 +5688,7 @@ var require_re = __commonJS({
|
|
|
5688
5688
|
var re = exports2.re = [];
|
|
5689
5689
|
var safeRe = exports2.safeRe = [];
|
|
5690
5690
|
var src = exports2.src = [];
|
|
5691
|
+
var safeSrc = exports2.safeSrc = [];
|
|
5691
5692
|
var t = exports2.t = {};
|
|
5692
5693
|
var R = 0;
|
|
5693
5694
|
var LETTERDASHNUMBER = "[a-zA-Z0-9-]";
|
|
@@ -5708,6 +5709,7 @@ var require_re = __commonJS({
|
|
|
5708
5709
|
debug(name, index, value);
|
|
5709
5710
|
t[name] = index;
|
|
5710
5711
|
src[index] = value;
|
|
5712
|
+
safeSrc[index] = safe;
|
|
5711
5713
|
re[index] = new RegExp(value, isGlobal ? "g" : void 0);
|
|
5712
5714
|
safeRe[index] = new RegExp(safe, isGlobal ? "g" : void 0);
|
|
5713
5715
|
};
|
|
@@ -5807,7 +5809,7 @@ var require_semver = __commonJS({
|
|
|
5807
5809
|
"use strict";
|
|
5808
5810
|
var debug = require_debug();
|
|
5809
5811
|
var { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
|
|
5810
|
-
var { safeRe: re, t } = require_re();
|
|
5812
|
+
var { safeRe: re, safeSrc: src, t } = require_re();
|
|
5811
5813
|
var parseOptions = require_parse_options();
|
|
5812
5814
|
var { compareIdentifiers } = require_identifiers();
|
|
5813
5815
|
var SemVer = class _SemVer {
|
|
@@ -5947,6 +5949,18 @@ var require_semver = __commonJS({
|
|
|
5947
5949
|
// preminor will bump the version up to the next minor release, and immediately
|
|
5948
5950
|
// down to pre-release. premajor and prepatch work the same way.
|
|
5949
5951
|
inc(release, identifier, identifierBase) {
|
|
5952
|
+
if (release.startsWith("pre")) {
|
|
5953
|
+
if (!identifier && identifierBase === false) {
|
|
5954
|
+
throw new Error("invalid increment argument: identifier is empty");
|
|
5955
|
+
}
|
|
5956
|
+
if (identifier) {
|
|
5957
|
+
const r = new RegExp(`^${this.options.loose ? src[t.PRERELEASELOOSE] : src[t.PRERELEASE]}$`);
|
|
5958
|
+
const match = `-${identifier}`.match(r);
|
|
5959
|
+
if (!match || match[1] !== identifier) {
|
|
5960
|
+
throw new Error(`invalid identifier: ${identifier}`);
|
|
5961
|
+
}
|
|
5962
|
+
}
|
|
5963
|
+
}
|
|
5950
5964
|
switch (release) {
|
|
5951
5965
|
case "premajor":
|
|
5952
5966
|
this.prerelease.length = 0;
|
|
@@ -5974,6 +5988,12 @@ var require_semver = __commonJS({
|
|
|
5974
5988
|
}
|
|
5975
5989
|
this.inc("pre", identifier, identifierBase);
|
|
5976
5990
|
break;
|
|
5991
|
+
case "release":
|
|
5992
|
+
if (this.prerelease.length === 0) {
|
|
5993
|
+
throw new Error(`version ${this.raw} is not a prerelease`);
|
|
5994
|
+
}
|
|
5995
|
+
this.prerelease.length = 0;
|
|
5996
|
+
break;
|
|
5977
5997
|
case "major":
|
|
5978
5998
|
if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
|
|
5979
5999
|
this.major++;
|
|
@@ -5999,9 +6019,6 @@ var require_semver = __commonJS({
|
|
|
5999
6019
|
// 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
|
|
6000
6020
|
case "pre": {
|
|
6001
6021
|
const base = Number(identifierBase) ? 1 : 0;
|
|
6002
|
-
if (!identifier && identifierBase === false) {
|
|
6003
|
-
throw new Error("invalid increment argument: identifier is empty");
|
|
6004
|
-
}
|
|
6005
6022
|
if (this.prerelease.length === 0) {
|
|
6006
6023
|
this.prerelease = [base];
|
|
6007
6024
|
} else {
|
|
@@ -6141,13 +6158,12 @@ var require_diff = __commonJS({
|
|
|
6141
6158
|
if (!lowVersion.patch && !lowVersion.minor) {
|
|
6142
6159
|
return "major";
|
|
6143
6160
|
}
|
|
6144
|
-
if (highVersion
|
|
6161
|
+
if (lowVersion.compareMain(highVersion) === 0) {
|
|
6162
|
+
if (lowVersion.minor && !lowVersion.patch) {
|
|
6163
|
+
return "minor";
|
|
6164
|
+
}
|
|
6145
6165
|
return "patch";
|
|
6146
6166
|
}
|
|
6147
|
-
if (highVersion.minor) {
|
|
6148
|
-
return "minor";
|
|
6149
|
-
}
|
|
6150
|
-
return "major";
|
|
6151
6167
|
}
|
|
6152
6168
|
const prefix = highHasPre ? "pre" : "";
|
|
6153
6169
|
if (v1.major !== v2.major) {
|
|
@@ -86,6 +86,7 @@ var require_re = __commonJS({
|
|
|
86
86
|
var re = exports2.re = [];
|
|
87
87
|
var safeRe = exports2.safeRe = [];
|
|
88
88
|
var src = exports2.src = [];
|
|
89
|
+
var safeSrc = exports2.safeSrc = [];
|
|
89
90
|
var t = exports2.t = {};
|
|
90
91
|
var R = 0;
|
|
91
92
|
var LETTERDASHNUMBER = "[a-zA-Z0-9-]";
|
|
@@ -106,6 +107,7 @@ var require_re = __commonJS({
|
|
|
106
107
|
debug(name, index, value);
|
|
107
108
|
t[name] = index;
|
|
108
109
|
src[index] = value;
|
|
110
|
+
safeSrc[index] = safe;
|
|
109
111
|
re[index] = new RegExp(value, isGlobal ? "g" : void 0);
|
|
110
112
|
safeRe[index] = new RegExp(safe, isGlobal ? "g" : void 0);
|
|
111
113
|
};
|
|
@@ -205,7 +207,7 @@ var require_semver = __commonJS({
|
|
|
205
207
|
"use strict";
|
|
206
208
|
var debug = require_debug();
|
|
207
209
|
var { MAX_LENGTH, MAX_SAFE_INTEGER } = require_constants();
|
|
208
|
-
var { safeRe: re, t } = require_re();
|
|
210
|
+
var { safeRe: re, safeSrc: src, t } = require_re();
|
|
209
211
|
var parseOptions = require_parse_options();
|
|
210
212
|
var { compareIdentifiers } = require_identifiers();
|
|
211
213
|
var SemVer = class _SemVer {
|
|
@@ -345,6 +347,18 @@ var require_semver = __commonJS({
|
|
|
345
347
|
// preminor will bump the version up to the next minor release, and immediately
|
|
346
348
|
// down to pre-release. premajor and prepatch work the same way.
|
|
347
349
|
inc(release, identifier, identifierBase) {
|
|
350
|
+
if (release.startsWith("pre")) {
|
|
351
|
+
if (!identifier && identifierBase === false) {
|
|
352
|
+
throw new Error("invalid increment argument: identifier is empty");
|
|
353
|
+
}
|
|
354
|
+
if (identifier) {
|
|
355
|
+
const r = new RegExp(`^${this.options.loose ? src[t.PRERELEASELOOSE] : src[t.PRERELEASE]}$`);
|
|
356
|
+
const match = `-${identifier}`.match(r);
|
|
357
|
+
if (!match || match[1] !== identifier) {
|
|
358
|
+
throw new Error(`invalid identifier: ${identifier}`);
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
}
|
|
348
362
|
switch (release) {
|
|
349
363
|
case "premajor":
|
|
350
364
|
this.prerelease.length = 0;
|
|
@@ -372,6 +386,12 @@ var require_semver = __commonJS({
|
|
|
372
386
|
}
|
|
373
387
|
this.inc("pre", identifier, identifierBase);
|
|
374
388
|
break;
|
|
389
|
+
case "release":
|
|
390
|
+
if (this.prerelease.length === 0) {
|
|
391
|
+
throw new Error(`version ${this.raw} is not a prerelease`);
|
|
392
|
+
}
|
|
393
|
+
this.prerelease.length = 0;
|
|
394
|
+
break;
|
|
375
395
|
case "major":
|
|
376
396
|
if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) {
|
|
377
397
|
this.major++;
|
|
@@ -397,9 +417,6 @@ var require_semver = __commonJS({
|
|
|
397
417
|
// 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction.
|
|
398
418
|
case "pre": {
|
|
399
419
|
const base = Number(identifierBase) ? 1 : 0;
|
|
400
|
-
if (!identifier && identifierBase === false) {
|
|
401
|
-
throw new Error("invalid increment argument: identifier is empty");
|
|
402
|
-
}
|
|
403
420
|
if (this.prerelease.length === 0) {
|
|
404
421
|
this.prerelease = [base];
|
|
405
422
|
} else {
|
|
@@ -539,13 +556,12 @@ var require_diff = __commonJS({
|
|
|
539
556
|
if (!lowVersion.patch && !lowVersion.minor) {
|
|
540
557
|
return "major";
|
|
541
558
|
}
|
|
542
|
-
if (highVersion
|
|
559
|
+
if (lowVersion.compareMain(highVersion) === 0) {
|
|
560
|
+
if (lowVersion.minor && !lowVersion.patch) {
|
|
561
|
+
return "minor";
|
|
562
|
+
}
|
|
543
563
|
return "patch";
|
|
544
564
|
}
|
|
545
|
-
if (highVersion.minor) {
|
|
546
|
-
return "minor";
|
|
547
|
-
}
|
|
548
|
-
return "major";
|
|
549
565
|
}
|
|
550
566
|
const prefix = highHasPre ? "pre" : "";
|
|
551
567
|
if (v1.major !== v2.major) {
|