Skip to content

ScheduledWarmRunner Construct ​

Warm runners active during a time window specified by start time (schedule) and duration (duration).

Runners will be provisioned using the specified provider and registered in the specified repository or organization.

Registration level must match the one selected during setup.

Limitations

  • No deployment-fill: Unlike AlwaysOnWarmRunner, scheduled warm runners do not get an initial fill on deploy. The first fill happens at the next schedule occurrence. If you deploy at 1pm for a 2pm schedule, runners will not appear until 2pm.
  • Jobs will still trigger provisioning of on-demand runners, even if a warm runner ends up being used.
  • You may briefly see more than count runners when changing config or at rotation.
  • To remove: set count to 0, deploy, wait for warm runners to stop, then remove and deploy again. If you don't follow this procedure, warm runners may linger until they expire.
  • Provider failures or timeouts (like Lambda provider timing out after 15 minutes) will result in a gap in coverage until the retry succeeds. Current retry mechanism has built-in back-off rate and can be tweaked using retryOptions. This will be improved in the future.
ts
// Cron: fill at 1pm on weekdays
new ScheduledWarmRunner(stack, 'Business Hours', {
  runners,
  provider: myProvider,
  count: 3,
  owner: 'my-org',
  repo: 'my-repo',
  schedule: events.Schedule.cron({ hour: '13', minute: '0', weekDay: 'MON-FRI' }),
  duration: cdk.Duration.hours(2),
});
python
# Cron: fill at 1pm on weekdays
ScheduledWarmRunner(stack, "Business Hours",
    runners=runners,
    provider=my_provider,
    count=3,
    owner="my-org",
    repo="my-repo",
    schedule=events.Schedule.cron(hour="13", minute="0", week_day="MON-FRI"),
    duration=cdk.Duration.hours(2)
)
java
// Cron: fill at 1pm on weekdays
// Cron: fill at 1pm on weekdays
ScheduledWarmRunner.Builder.create(stack, "Business Hours")
        .runners(runners)
        .provider(myProvider)
        .count(3)
        .owner("my-org")
        .repo("my-repo")
        .schedule(events.Schedule.cron(Map.of("hour", "13", "minute", "0", "weekDay", "MON-FRI")))
        .duration(Duration.hours(2))
        .build();
csharp
// Cron: fill at 1pm on weekdays
// Cron: fill at 1pm on weekdays
new ScheduledWarmRunner(stack, "Business Hours", new Struct {
    Runners = runners,
    Provider = myProvider,
    Count = 3,
    Owner = "my-org",
    Repo = "my-repo",
    Schedule = events.Schedule.Cron(new Struct { Hour = "13", Minute = "0", WeekDay = "MON-FRI" }),
    Duration = Duration.Hours(2)
});
go
// Cron: fill at 1pm on weekdays
// Cron: fill at 1pm on weekdays
NewScheduledWarmRunner(stack, jsii.String("Business Hours"), map[string]interface{}{
	"runners": runners,
	"provider": myProvider,
	"count": jsii.Number(3),
	"owner": jsii.String("my-org"),
	"repo": jsii.String("my-repo"),
	"schedule": events.Schedule_cron(map[string]*string{
		"hour": jsii.String("13"),
		"minute": jsii.String("0"),
		"weekDay": jsii.String("MON-FRI"),
	}),
	"duration": cdk.Duration_hours(jsii.Number(2)),
})
ts
// Rate: fill every 12 hours
new ScheduledWarmRunner(stack, 'Every 12 Hours', {
  runners,
  provider: myProvider,
  count: 2,
  owner: 'my-org',
  repo: 'my-repo',
  schedule: events.Schedule.rate(cdk.Duration.hours(5)),
  duration: cdk.Duration.hours(12),
});
python
# Rate: fill every 12 hours
ScheduledWarmRunner(stack, "Every 12 Hours",
    runners=runners,
    provider=my_provider,
    count=2,
    owner="my-org",
    repo="my-repo",
    schedule=events.Schedule.rate(cdk.Duration.hours(5)),
    duration=cdk.Duration.hours(12)
)
java
// Rate: fill every 12 hours
// Rate: fill every 12 hours
ScheduledWarmRunner.Builder.create(stack, "Every 12 Hours")
        .runners(runners)
        .provider(myProvider)
        .count(2)
        .owner("my-org")
        .repo("my-repo")
        .schedule(events.Schedule.rate(Duration.hours(5)))
        .duration(Duration.hours(12))
        .build();
csharp
// Rate: fill every 12 hours
// Rate: fill every 12 hours
new ScheduledWarmRunner(stack, "Every 12 Hours", new Struct {
    Runners = runners,
    Provider = myProvider,
    Count = 2,
    Owner = "my-org",
    Repo = "my-repo",
    Schedule = events.Schedule.Rate(Duration.Hours(5)),
    Duration = Duration.Hours(12)
});
go
// Rate: fill every 12 hours
// Rate: fill every 12 hours
NewScheduledWarmRunner(stack, jsii.String("Every 12 Hours"), map[string]interface{}{
	"runners": runners,
	"provider": myProvider,
	"count": jsii.Number(2),
	"owner": jsii.String("my-org"),
	"repo": jsii.String("my-repo"),
	"schedule": events.Schedule_rate(cdk.Duration_hours(jsii.Number(5))),
	"duration": cdk.Duration_hours(jsii.Number(12)),
})

See: Setup GitHub

Initializer ​

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

new ScheduledWarmRunner(scope: Construct, id: string, props: ScheduledWarmRunnerProps)
python
import cloudsnorkel.cdk_github_runners

cloudsnorkel.cdk_github_runners.ScheduledWarmRunner(
  scope: Construct,
  id: str,
  count: typing.Union[int, float],
  duration: Duration,
  owner: str,
  provider: IRunnerProvider | ICompositeProvider,
  runners: GitHubRunners,
  schedule: Schedule,
  registration_level: str = None,
  repo: str = None
)
  • scope: Construct

  • id: str

  • count: typing.Union[int, float]

    Number of warm runners to maintain.

  • duration: Duration

    How long the warm runners should be maintained from the fill time (schedule).

    Defines the end of the window (schedule time + duration).

  • owner: str

    GitHub owner where runners will be registered (org or user login).

  • provider: IRunnerProvider | ICompositeProvider

    Provider to use.

    Warm runners bypass the provider selector — they always use this provider, regardless of job characteristics. Labels cannot be modified.

  • runners: GitHubRunners

    The GitHubRunners construct that owns the shared warm runner infrastructure.

  • schedule: Schedule

    When to start filling the pool (e.g. start of business hours).

  • registration_level?: str

    Registration level — must match how your runners are set up in GitHub.

    Choose 'org' for org-wide runners, 'repo' for repo-level. See the setup wizard for choosing repo vs org.

    Default: 'repo'

  • repo?: str

    Repository name (without owner) where runners will be registered.

    Required when registrationLevel is 'repo'.

java
import com.cloudsnorkel.cdk.github.runners.ScheduledWarmRunner;

ScheduledWarmRunner.Builder.create(Construct scope, java.lang.String id)
    .count(java.lang.Number)
    .duration(Duration)
    .owner(java.lang.String)
    .provider(IRunnerProvider|ICompositeProvider)
    .runners(GitHubRunners)
    .schedule(Schedule)
//  .registrationLevel(java.lang.String)
//  .repo(java.lang.String)
    .build();
  • scope: Construct

  • id: java.lang.String

  • count: java.lang.Number

    Number of warm runners to maintain.

  • duration: Duration

    How long the warm runners should be maintained from the fill time (schedule).

    Defines the end of the window (schedule time + duration).

  • owner: java.lang.String

    GitHub owner where runners will be registered (org or user login).

  • provider: IRunnerProvider|ICompositeProvider

    Provider to use.

    Warm runners bypass the provider selector — they always use this provider, regardless of job characteristics. Labels cannot be modified.

  • runners: GitHubRunners

    The GitHubRunners construct that owns the shared warm runner infrastructure.

  • schedule: Schedule

    When to start filling the pool (e.g. start of business hours).

  • registrationLevel?: java.lang.String

    Registration level — must match how your runners are set up in GitHub.

    Choose 'org' for org-wide runners, 'repo' for repo-level. See the setup wizard for choosing repo vs org.

    Default: 'repo'

  • repo?: java.lang.String

    Repository name (without owner) where runners will be registered.

    Required when registrationLevel is 'repo'.

csharp
using CloudSnorkel;

new ScheduledWarmRunner(Construct Scope, string Id, ScheduledWarmRunnerProps Props);
go
import "github.com/CloudSnorkel/cdk-github-runners-go/cloudsnorkelcdkgithubrunners"

cloudsnorkelcdkgithubrunners.NewScheduledWarmRunner(scope Construct, id *string, props ScheduledWarmRunnerProps) ScheduledWarmRunner

Methods ​

toString()to_string()toString()ToString()ToString() ​

Returns a string representation of this construct.

ts
public toString(): string
python
def to_string() -> str
java
public java.lang.String toString()
csharp
private string ToString()
go
func ToString() *string

with()with()with()With()With() ​

Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.

ts
public with(mixins: ...IMixin[]): IConstruct
  • mixins: ...IMixin[]

    The mixins to apply.

python
def with(
  mixins: *IMixin
) -> IConstruct
  • mixins: *IMixin

    The mixins to apply.

java
public IConstruct with(IMixin... mixins)
  • mixins: IMixin...

    The mixins to apply.

csharp
private IConstruct With(params IMixin[] Mixins)
  • Mixins: params IMixin[]

    The mixins to apply.

go
func With(mixins ...IMixin) IConstruct
  • mixins: ...IMixin

    The mixins to apply.

Static Functions ​

isConstruct()is_construct()isConstruct()IsConstruct()IsConstruct() ​

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

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

ScheduledWarmRunner.isConstruct(x: any)
  • x: any

    Any object.

python
import cloudsnorkel.cdk_github_runners

cloudsnorkel.cdk_github_runners.ScheduledWarmRunner.is_construct(
  x: typing.Any
)
  • x: typing.Any

    Any object.

java
import com.cloudsnorkel.cdk.github.runners.ScheduledWarmRunner;

ScheduledWarmRunner.isConstruct(java.lang.Object x)
  • x: java.lang.Object

    Any object.

csharp
using CloudSnorkel;

ScheduledWarmRunner.IsConstruct(object X);
  • X: object

    Any object.

go
import "github.com/CloudSnorkel/cdk-github-runners-go/cloudsnorkelcdkgithubrunners"

cloudsnorkelcdkgithubrunners.ScheduledWarmRunner_IsConstruct(x interface{}) *bool
  • x: interface{}

    Any object.

Properties ​

nodenodenodeNodeNode ​

node: Node

node: Node

node: Node

Node: Node

Node: Node

The tree node.

Released under the Apache-2.0 License.