Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat(runners): refactor source type to use LambdaRunnerSource in runn…
…er configurations
  • Loading branch information
stuartp44 committed Mar 18, 2026
commit 41d4debc7b48374dcf6552fe3000730a08db661b
3 changes: 2 additions & 1 deletion lambdas/functions/control-plane/src/aws/runners.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { DefaultTargetCapacityType, SpotAllocationStrategy } from '@aws-sdk/client-ec2';
import { LambdaRunnerSource } from '../scale-runners/scale-up';

export type RunnerType = 'Org' | 'Repo';

Expand Down Expand Up @@ -42,7 +43,7 @@ export interface RunnerInputParameters {
instanceAllocationStrategy: SpotAllocationStrategy;
};
numberOfRunners: number;
source: 'scale-up-lambda' | 'pool-lambda';
source: LambdaRunnerSource;
amiIdSsmParameterName?: string;
tracingEnabled?: boolean;
onDemandFailoverOnError?: string[];
Expand Down
5 changes: 3 additions & 2 deletions lambdas/functions/control-plane/src/aws/runners.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { beforeEach, describe, expect, it, vi } from 'vitest';
import ScaleError from './../scale-runners/ScaleError';
import { createRunner, listEC2Runners, tag, terminateRunner, untag } from './runners';
import type { RunnerInfo, RunnerInputParameters, RunnerType } from './runners.d';
import { LambdaRunnerSource } from '../scale-runners/scale-up';

process.env.AWS_REGION = 'eu-east-1';
const mockEC2Client = mockClient(EC2Client);
Expand Down Expand Up @@ -753,7 +754,7 @@ interface RunnerConfig {
tracingEnabled?: boolean;
onDemandFailoverOnError?: string[];
scaleErrors: string[];
source: 'scale-up-lambda' | 'pool-lambda';
source: LambdaRunnerSource;
}

function createRunnerConfig(runnerConfig: RunnerConfig): RunnerInputParameters {
Expand Down Expand Up @@ -786,7 +787,7 @@ interface ExpectedFleetRequestValues {
totalTargetCapacity: number;
imageId?: string;
tracingEnabled?: boolean;
source: 'scale-up-lambda' | 'pool-lambda';
source: LambdaRunnerSource;
}

function expectedCreateFleetRequest(expectedValues: ExpectedFleetRequestValues): CreateFleetCommandInput {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import { publishRetryMessage } from './job-retry';

const logger = createChildLogger('scale-up');

export type LambdaRunnerSource = 'scale-up-lambda' | 'pool-lambda';

export interface RunnerGroup {
name: string;
id: number;
Expand Down Expand Up @@ -248,7 +250,7 @@ export async function createRunners(
ec2RunnerConfig: CreateEC2RunnerConfig,
numberOfRunners: number,
ghClient: Octokit,
source: 'scale-up-lambda' | 'pool-lambda' = 'scale-up-lambda',
source: LambdaRunnerSource = 'scale-up-lambda',
): Promise<string[]> {
const instances = await createRunner({
runnerType: githubRunnerConfig.runnerType,
Expand Down Expand Up @@ -509,6 +511,7 @@ export async function scaleUp(payloads: ActionRequestMessageSQS[]): Promise<stri
},
newRunners,
githubInstallationClient,
'scale-up-lambda'
);

// Not all runners we wanted were created, let's reject enough items so that
Expand Down