Skip to content

Commit

Permalink
Runner variants to be aware of the lf. and lf.c. prefixes, to facilit…
Browse files Browse the repository at this point in the history
…ate migrations (#5541)
  • Loading branch information
jeanschmidt authored Aug 7, 2024
1 parent a1f5a89 commit 6e884e7
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,25 @@ runner_types:
largedisk:
disk_size: 300
ami123:
ami: ami-123`;
ami: ami-123
lf.linux.4xlarge:
instance_type: c5.2xlarge
os: linux
max_available: 1
disk_size: 150
is_ephemeral: false
variants:
ephemeral:
is_ephemeral: true
lf.c.linux.4xlarge:
instance_type: c5.2xlarge
os: linux
max_available: 1
disk_size: 150
is_ephemeral: false
variants:
ephemeral:
is_ephemeral: true`;

const getRunnerTypeResponse = new Map([
[
Expand Down Expand Up @@ -741,6 +759,50 @@ runner_types:
ami: 'ami-123',
},
],
[
'lf.linux.4xlarge',
{
runnerTypeName: 'lf.linux.4xlarge',
instance_type: 'c5.2xlarge',
os: 'linux',
max_available: 1,
disk_size: 150,
is_ephemeral: false,
},
],
[
'lf.ephemeral.linux.4xlarge',
{
runnerTypeName: 'lf.ephemeral.linux.4xlarge',
instance_type: 'c5.2xlarge',
os: 'linux',
max_available: 1,
disk_size: 150,
is_ephemeral: true,
},
],
[
'lf.c.linux.4xlarge',
{
runnerTypeName: 'lf.c.linux.4xlarge',
instance_type: 'c5.2xlarge',
os: 'linux',
max_available: 1,
disk_size: 150,
is_ephemeral: false,
},
],
[
'lf.c.ephemeral.linux.4xlarge',
{
runnerTypeName: 'lf.c.ephemeral.linux.4xlarge',
instance_type: 'c5.2xlarge',
os: 'linux',
max_available: 1,
disk_size: 150,
is_ephemeral: true,
},
],
]);

it('gets the contents, twice', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,16 @@ export async function getRunnerTypes(
return;
}

result.set(`${variant}.${key}`, { ...runnerType, ...variantType, runnerTypeName: `${variant}.${key}` });
let variantRunnTypeName: string;
if (key.startsWith('lf.c.')) {
variantRunnTypeName = `lf.c.${variant}.${key.slice(5)}`;
} else if (key.startsWith('lf.')) {
variantRunnTypeName = `lf.${variant}.${key.slice(3)}`;
} else {
variantRunnTypeName = `${variant}.${key}`;
}

result.set(variantRunnTypeName, { ...runnerType, ...variantType, runnerTypeName: variantRunnTypeName });
});
}
});
Expand Down

0 comments on commit 6e884e7

Please sign in to comment.