Skip to content

GitHubRunnersProps Struct ​

Properties for GitHubRunners.

Initializer ​

ts
import { GitHubRunnersProps } from '@cloudsnorkel/cdk-github-runners'

const gitHubRunnersProps: GitHubRunnersProps = { ... }
python
import cloudsnorkel.cdk_github_runners

cloudsnorkel.cdk_github_runners.GitHubRunnersProps(
  allow_public_subnet: bool = None,
  extra_certificates: str = None,
  idle_timeout: Duration = None,
  log_options: LogOptions = None,
  providers: typing.List[IRunnerProvider | ICompositeProvider] = None,
  provider_selector: IFunction = None,
  require_self_hosted_label: bool = None,
  retry_options: ProviderRetryOptions = None,
  security_groups: typing.List[ISecurityGroup] = None,
  setup_access: LambdaAccess = None,
  status_access: LambdaAccess = None,
  vpc: IVpc = None,
  vpc_subnets: SubnetSelection = None,
  webhook_access: LambdaAccess = None
)
java
import com.cloudsnorkel.cdk.github.runners.GitHubRunnersProps;

GitHubRunnersProps.builder()
//  .allowPublicSubnet(java.lang.Boolean)
//  .extraCertificates(java.lang.String)
//  .idleTimeout(Duration)
//  .logOptions(LogOptions)
//  .providers(java.util.List<IRunnerProvider|ICompositeProvider>)
//  .providerSelector(IFunction)
//  .requireSelfHostedLabel(java.lang.Boolean)
//  .retryOptions(ProviderRetryOptions)
//  .securityGroups(java.util.List<ISecurityGroup>)
//  .setupAccess(LambdaAccess)
//  .statusAccess(LambdaAccess)
//  .vpc(IVpc)
//  .vpcSubnets(SubnetSelection)
//  .webhookAccess(LambdaAccess)
    .build();
csharp
using CloudSnorkel;

new GitHubRunnersProps {
    bool AllowPublicSubnet = null,
    string ExtraCertificates = null,
    Duration IdleTimeout = null,
    LogOptions LogOptions = null,
    (IRunnerProvider|ICompositeProvider)[] Providers = null,
    IFunction ProviderSelector = null,
    bool RequireSelfHostedLabel = null,
    ProviderRetryOptions RetryOptions = null,
    ISecurityGroup[] SecurityGroups = null,
    LambdaAccess SetupAccess = null,
    LambdaAccess StatusAccess = null,
    IVpc Vpc = null,
    SubnetSelection VpcSubnets = null,
    LambdaAccess WebhookAccess = null
};
go
import "github.com/CloudSnorkel/cdk-github-runners-go/cloudsnorkelcdkgithubrunners"

&cloudsnorkelcdkgithubrunners.GitHubRunnersProps {
	AllowPublicSubnet: *bool,
	ExtraCertificates: *string,
	IdleTimeout: github.com/aws/aws-cdk-go/awscdk/v2.Duration,
	LogOptions: github.com/CloudSnorkel/cdk-github-runners-go/cloudsnorkelcdkgithubrunners.LogOptions,
	Providers: *[]interface{},
	ProviderSelector: github.com/aws/aws-cdk-go/awscdk/v2.aws_lambda.IFunction,
	RequireSelfHostedLabel: *bool,
	RetryOptions: github.com/CloudSnorkel/cdk-github-runners-go/cloudsnorkelcdkgithubrunners.ProviderRetryOptions,
	SecurityGroups: *[]github.com/aws/aws-cdk-go/awscdk/v2.aws_ec2.ISecurityGroup,
	SetupAccess: github.com/CloudSnorkel/cdk-github-runners-go/cloudsnorkelcdkgithubrunners.LambdaAccess,
	StatusAccess: github.com/CloudSnorkel/cdk-github-runners-go/cloudsnorkelcdkgithubrunners.LambdaAccess,
	Vpc: github.com/aws/aws-cdk-go/awscdk/v2.aws_ec2.IVpc,
	VpcSubnets: github.com/aws/aws-cdk-go/awscdk/v2.aws_ec2.SubnetSelection,
	WebhookAccess: github.com/CloudSnorkel/cdk-github-runners-go/cloudsnorkelcdkgithubrunners.LambdaAccess,
}

Properties ​

allowPublicSubnetallow_public_subnetallowPublicSubnetAllowPublicSubnetAllowPublicSubnet ​

allowPublicSubnet?: boolean

allow_public_subnet?: bool

allowPublicSubnet?: java.lang.Boolean

AllowPublicSubnet?: bool

AllowPublicSubnet?: *bool

Allow management functions to run in public subnets. Lambda Functions in a public subnet can NOT access the internet.

Note: This only affects management functions that interact with GitHub. Lambda functions that help with runner image building and don't interact with GitHub are NOT affected by this setting.

Default: false

extraCertificatesextra_certificatesextraCertificatesExtraCertificatesExtraCertificates ​

extraCertificates?: string

extra_certificates?: str

extraCertificates?: java.lang.String

ExtraCertificates?: string

ExtraCertificates?: *string

Path to a certificate file (.pem or .crt) or a directory containing certificate files (.pem or .crt) required to trust GitHub Enterprise Server. Use this when GitHub Enterprise Server certificates are self-signed.

If a directory is provided, all .pem and .crt files in that directory will be used. The certificates will be concatenated into a single file for use by Node.js.

You may also want to use custom images for your runner providers that contain the same certificates. See RunnerImageComponent.extraCertificates().

ts
const selfSignedCertificates = 'certs/ghes.pem'; // or 'path-to-my-extra-certs-folder' for a directory
const imageBuilder = CodeBuildRunnerProvider.imageBuilder(this, 'Image Builder with Certs');
imageBuilder.addComponent(RunnerImageComponent.extraCertificates(selfSignedCertificates, 'private-ca'));

const provider = new CodeBuildRunnerProvider(this, 'CodeBuild', {
    imageBuilder: imageBuilder,
});

new GitHubRunners(
  this,
  'runners',
  {
    providers: [provider],
    extraCertificates: selfSignedCertificates,
  }
);
python
self_signed_certificates = "certs/ghes.pem" # or 'path-to-my-extra-certs-folder' for a directory
image_builder = CodeBuildRunnerProvider.image_builder(self, "Image Builder with Certs")
image_builder.add_component(RunnerImageComponent.extra_certificates(self_signed_certificates, "private-ca"))

provider = CodeBuildRunnerProvider(self, "CodeBuild",
    image_builder=image_builder
)

GitHubRunners(self, "runners",
    providers=[provider],
    extra_certificates=self_signed_certificates
)
java
String selfSignedCertificates = "certs/ghes.pem"; // or 'path-to-my-extra-certs-folder' for a directory
Object imageBuilder = CodeBuildRunnerProvider.imageBuilder(this, "Image Builder with Certs");
imageBuilder.addComponent(RunnerImageComponent.extraCertificates(selfSignedCertificates, "private-ca"));

Object provider = CodeBuildRunnerProvider.Builder.create(this, "CodeBuild")
        .imageBuilder(imageBuilder)
        .build();

GitHubRunners.Builder.create(this, "runners")
        .providers(List.of(provider))
        .extraCertificates(selfSignedCertificates)
        .build();
csharp
var selfSignedCertificates = "certs/ghes.pem"; // or 'path-to-my-extra-certs-folder' for a directory
var imageBuilder = CodeBuildRunnerProvider.ImageBuilder(this, "Image Builder with Certs");
imageBuilder.AddComponent(RunnerImageComponent.ExtraCertificates(selfSignedCertificates, "private-ca"));

var provider = new CodeBuildRunnerProvider(this, "CodeBuild", new Struct {
    ImageBuilder = imageBuilder
});

new GitHubRunners(this, "runners", new Struct {
    Providers = new [] { provider },
    ExtraCertificates = selfSignedCertificates
});
go
selfSignedCertificates := "certs/ghes.pem" // or 'path-to-my-extra-certs-folder' for a directory
imageBuilder := codeBuildRunnerProvider_ImageBuilder(this, jsii.String("Image Builder with Certs"))
ImageBuilder.addComponent(runnerImageComponent_ExtraCertificates(selfSignedCertificates, jsii.String("private-ca")))

provider := NewCodeBuildRunnerProvider(this, jsii.String("CodeBuild"), map[string]interface{}{
	"imageBuilder": ImageBuilder,
})

NewGitHubRunners(this, jsii.String("runners"), map[string]interface{}{
	"providers": []interface{}{
		provider,
	},
	"extraCertificates": selfSignedCertificates,
})

idleTimeoutidle_timeoutidleTimeoutIdleTimeoutIdleTimeout ​

idleTimeout?: Duration

idle_timeout?: Duration

idleTimeout?: Duration

IdleTimeout?: Duration

IdleTimeout?: Duration

Time to wait before stopping a runner that remains idle.

If the user cancelled the job, or if another runner stole it, this stops the runner to avoid wasting resources.

Default: 5 minutes

logOptionslog_optionslogOptionsLogOptionsLogOptions ​

logOptions?: LogOptions

log_options?: LogOptions

logOptions?: LogOptions

LogOptions?: LogOptions

LogOptions?: LogOptions

Logging options for the state machine that manages the runners.

Default: no logs

providersprovidersprovidersProvidersProviders ​

providers?: typing.List[IRunnerProvider | ICompositeProvider]

providers?: java.util.List<IRunnerProvider|ICompositeProvider>

Providers?: *[]interface{}

List of runner providers to use.

At least one provider is required. Provider will be selected when its label matches the labels requested by the workflow job.

Default: CodeBuild, Lambda and Fargate runners with all the defaults (no VPC or default account VPC)

providerSelectorprovider_selectorproviderSelectorProviderSelectorProviderSelector ​

providerSelector?: IFunction

provider_selector?: IFunction

providerSelector?: IFunction

ProviderSelector?: IFunction

ProviderSelector?: IFunction

Optional Lambda function to customize provider selection logic and label assignment.

  • The function receives the webhook payload along with default provider and its labels as ProviderSelectorInput
  • The function returns a selected provider and its labels as ProviderSelectorResult
  • You can decline to provision a runner by returning undefined as the provider in the selector result
  • You can fully customize the labels for the about-to-be-provisioned runner (add, remove, modify, dynamic labels, etc.)
  • Labels don't have to match the labels originally configured for the provider, but see warnings below
  • This function will be called synchronously during webhook processing, so it should be fast and efficient (webhook limit is 30 seconds total)

WARNING: It is your responsibility to ensure the selected provider's labels match the job's required labels. If you return the wrong labels, the runner will be created but GitHub Actions will not assign the job to it.

WARNING: Provider selection is not a guarantee that a specific provider will be assigned for the job. GitHub Actions may assign the job to any runner with matching labels. The provider selector only determines which provider's runner will be created, but GitHub Actions may route the job to any available runner with the required labels.

**For reliable provider assignment based on job characteristics, consider using repo-level runner registration where you can control which runners are available for specific repositories. This information is also available while using the setup wizard.

See: Setup GitHub

requireSelfHostedLabelrequire_self_hosted_labelrequireSelfHostedLabelRequireSelfHostedLabelRequireSelfHostedLabel ​

requireSelfHostedLabel?: boolean

require_self_hosted_label?: bool

requireSelfHostedLabel?: java.lang.Boolean

RequireSelfHostedLabel?: bool

RequireSelfHostedLabel?: *bool

Whether to require the self-hosted label.

If true, the runner will only start if the workflow job explicitly requests the self-hosted label.

Be careful when setting this to false. Avoid setting up providers with generic label requirements like linux as they may match workflows that are not meant to run on self-hosted runners.

Default: true

retryOptionsretry_optionsretryOptionsRetryOptionsRetryOptions ​

retryOptions?: ProviderRetryOptions

retry_options?: ProviderRetryOptions

retryOptions?: ProviderRetryOptions

RetryOptions?: ProviderRetryOptions

RetryOptions?: ProviderRetryOptions

Options to retry operation in case of failure like missing capacity, or API quota issues.

GitHub jobs time out after not being able to get a runner for 24 hours. You should not retry for more than 24 hours.

Retries use full jitter, so total time spent waiting is about half the sum of min(interval * backoffRate ^ attempt, maxDelay) over all attempts.

Default: retry 210 times over a bit more than 24 hours

securityGroupssecurity_groupssecurityGroupsSecurityGroupsSecurityGroups ​

securityGroups?: ISecurityGroup[]

security_groups?: typing.List[ISecurityGroup]

securityGroups?: java.util.List<ISecurityGroup>

SecurityGroups?: ISecurityGroup[]

SecurityGroups?: *[]ISecurityGroup

Security groups attached to all management functions.

Use this to provide outbound access from management functions to GitHub Enterprise Server hosted inside a VPC.

Note: This only affects management functions that interact with GitHub. Lambda functions that help with runner image building and don't interact with GitHub are NOT affected by this setting.

Note: Defining inbound rules on this security group does nothing. This security group only controls outbound access FROM the management functions. To limit access TO the webhook or setup functions, use GitHubRunnersProps.webhookAccess and GitHubRunnersProps.setupAccess instead.

setupAccesssetup_accesssetupAccessSetupAccessSetupAccess ​

setupAccess?: LambdaAccess

setup_access?: LambdaAccess

setupAccess?: LambdaAccess

SetupAccess?: LambdaAccess

SetupAccess?: LambdaAccess

Access configuration for the setup function.

Once you finish the setup process, you can set this to LambdaAccess.noAccess() to remove access to the setup function. You can also use LambdaAccess.apiGateway({ allowedIps: ['my-ip/0']}) to limit access to your IP only.

Default: LambdaAccess.lambdaUrl()

statusAccessstatus_accessstatusAccessStatusAccessStatusAccess ​

statusAccess?: LambdaAccess

status_access?: LambdaAccess

statusAccess?: LambdaAccess

StatusAccess?: LambdaAccess

StatusAccess?: LambdaAccess

Access configuration for the status function.

This function returns a lot of sensitive information about the runner, so you should only allow access to it from trusted IPs, if at all.

Default: LambdaAccess.noAccess()

vpcvpcvpcVpcVpc ​

vpc?: IVpc

vpc?: IVpc

vpc?: IVpc

Vpc?: IVpc

Vpc?: IVpc

VPC used for all management functions. Use this with GitHub Enterprise Server hosted that's inaccessible from outside the VPC.

Note: This only affects management functions that interact with GitHub. Lambda functions that help with runner image building and don't interact with GitHub are NOT affected by this setting and will run outside the VPC.

Make sure the selected VPC and subnets have access to the following with either NAT Gateway or VPC Endpoints:

  • GitHub Enterprise Server
  • Secrets Manager
  • SQS
  • Step Functions
  • DynamoDB
  • Lambda (only with GitHubRunnersProps.providerSelector)
  • CloudFormation (status function only)
  • EC2
  • ECR (status function only)

vpcSubnetsvpc_subnetsvpcSubnetsVpcSubnetsVpcSubnets ​

vpcSubnets?: SubnetSelection

vpc_subnets?: SubnetSelection

vpcSubnets?: SubnetSelection

VpcSubnets?: SubnetSelection

VpcSubnets?: SubnetSelection

VPC subnets used for all management functions.

Use this with GitHub Enterprise Server hosted that's inaccessible from outside the VPC.

Note: This only affects management functions that interact with GitHub. Lambda functions that help with runner image building and don't interact with GitHub are NOT affected by this setting.

webhookAccesswebhook_accesswebhookAccessWebhookAccessWebhookAccess ​

webhookAccess?: LambdaAccess

webhook_access?: LambdaAccess

webhookAccess?: LambdaAccess

WebhookAccess?: LambdaAccess

WebhookAccess?: LambdaAccess

Access configuration for the webhook function.

This function is called by GitHub when a new workflow job is scheduled. For an extra layer of security, you can set this to LambdaAccess.apiGateway({ allowedIps: LambdaAccess.githubWebhookIps() }).

You can also set this to LambdaAccess.apiGateway({allowedVpc: vpc, allowedIps: ['GHES.IP.ADDRESS/32']}) if your GitHub Enterprise Server is hosted in a VPC. This will create an API Gateway endpoint that's only accessible from within the VPC.

WARNING: changing access type may change the URL. When the URL changes, you must update GitHub as well.

Default: LambdaAccess.lambdaUrl()

Released under the Apache-2.0 License.