Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename --cloud-aws-subnet-id to --cloud-aws-subnet #869

Merged
merged 3 commits into from
Jan 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions bin/cml/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ const runCloud = async (opts) => {
cloudSpotPrice: spotPrice,
cloudStartupScript: startupScript,
cloudAwsSecurityGroup: awsSecurityGroup,
cloudAwsSubnetId: awsSubnetId,
cloudAwsSubnet: awsSubnet,
tfFile,
workdir
} = opts;
Expand Down Expand Up @@ -163,7 +163,7 @@ const runCloud = async (opts) => {
spotPrice,
startupScript,
awsSecurityGroup,
awsSubnetId
awsSubnet
});
}

Expand Down Expand Up @@ -532,10 +532,11 @@ exports.builder = (yargs) =>
default: '',
description: 'Specifies the security group in AWS'
},
cloudAwsSubnetId: {
cloudAwsSubnet: {
type: 'string',
default: '',
description: 'Specifies the subnet to use within AWS'
description: 'Specifies the subnet to use within AWS',
alias: 'cloud-aws-subnet-id'
},
tfResource: {
hidden: true,
Expand Down
129 changes: 72 additions & 57 deletions bin/cml/runner.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,64 +5,79 @@ describe('CML e2e', () => {
const output = await exec(`echo none | node ./bin/cml.js runner --help`);

expect(output).toMatchInlineSnapshot(`
"cml.js runner
"cml.js runner

Launch and register a self-hosted runner
Launch and register a self-hosted runner

Options:
--help Show help [boolean]
--version Show version number [boolean]
--log Maximum log level
[string] [choices: \\"error\\", \\"warn\\", \\"info\\", \\"debug\\"] [default: \\"info\\"]
--labels One or more user-defined labels for this runner
(delimited with commas) [string] [default: \\"cml\\"]
--idle-timeout Seconds to wait for jobs before shutting down. Set
to -1 to disable timeout [number] [default: 300]
--name Name displayed in the repository once registered
[string] [default: cml-{ID}]
--no-retry Do not restart workflow terminated due to instance
disposal or GitHub Actions timeout [boolean]
--single Exit after running a single job [boolean]
--reuse Don't launch a new runner if an existing one has
the same name or overlapping labels [boolean]
--driver Platform where the repository is hosted. If not
specified, it will be inferred from the
environment [string] [choices: \\"github\\", \\"gitlab\\"]
--repo Repository to be used for registering the runner.
If not specified, it will be inferred from the
environment [string]
--token Personal access token to register a self-hosted
runner on the repository. If not specified, it
will be inferred from the environment [string]
--cloud Cloud to deploy the runner
[string] [choices: \\"aws\\", \\"azure\\", \\"gcp\\", \\"kubernetes\\"]
--cloud-region Region where the instance is deployed. Choices:
[us-east, us-west, eu-west, eu-north]. Also
accepts native cloud regions
[string] [default: \\"us-west\\"]
--cloud-type Instance type. Choices: [m, l, xl]. Also supports
native types like i.e. t2.micro [string]
--cloud-permission-set Specifies the instance profile in AWS or instance
service account in GCP [string] [default: \\"\\"]
--cloud-metadata Key Value pairs to associate cml-runner instance
on the provider i.e. tags/labels \\"key=value\\"
[array] [default: []]
--cloud-gpu GPU type.
[string] [choices: \\"nogpu\\", \\"k80\\", \\"v100\\", \\"tesla\\"]
--cloud-hdd-size HDD size in GB [number]
--cloud-ssh-private Custom private RSA SSH key. If not provided an
automatically generated throwaway key will be used
[string]
--cloud-spot Request a spot instance [boolean]
--cloud-spot-price Maximum spot instance bidding price in USD.
Defaults to the current spot bidding price
[number] [default: -1]
--cloud-startup-script Run the provided Base64-encoded Linux shell script
during the instance initialization [string]
--cloud-aws-security-group Specifies the security group in AWS
[string] [default: \\"\\"]
--cloud-aws-subnet-id Specifies the subnet to use within AWS
[string] [default: \\"\\"]"
`);
Options:
--help Show help [boolean]
--version Show version number [boolean]
--log Maximum log level
[string] [choices: \\"error\\", \\"warn\\", \\"info\\", \\"debug\\"] [default: \\"info\\"]
--labels One or more user-defined labels for
this runner (delimited with commas)
[string] [default: \\"cml\\"]
--idle-timeout Seconds to wait for jobs before
shutting down. Set to -1 to disable
timeout [number] [default: 300]
--name Name displayed in the repository
once registered
[string] [default: cml-{ID}]
--no-retry Do not restart workflow terminated
due to instance disposal or GitHub
Actions timeout [boolean]
--single Exit after running a single job
[boolean]
--reuse Don't launch a new runner if an
existing one has the same name or
overlapping labels [boolean]
--driver Platform where the repository is
hosted. If not specified, it will be
inferred from the environment
[string] [choices: \\"github\\", \\"gitlab\\"]
--repo Repository to be used for
registering the runner. If not
specified, it will be inferred from
the environment [string]
--token Personal access token to register a
self-hosted runner on the
repository. If not specified, it
will be inferred from the
environment [string]
--cloud Cloud to deploy the runner
[string] [choices: \\"aws\\", \\"azure\\", \\"gcp\\", \\"kubernetes\\"]
--cloud-region Region where the instance is
deployed. Choices: [us-east,
us-west, eu-west, eu-north]. Also
accepts native cloud regions
[string] [default: \\"us-west\\"]
--cloud-type Instance type. Choices: [m, l, xl].
Also supports native types like i.e.
t2.micro [string]
--cloud-permission-set Specifies the instance profile in
AWS or instance service account in
GCP [string] [default: \\"\\"]
--cloud-metadata Key Value pairs to associate
cml-runner instance on the provider
i.e. tags/labels \\"key=value\\"
[array] [default: []]
--cloud-gpu GPU type.
[string] [choices: \\"nogpu\\", \\"k80\\", \\"v100\\", \\"tesla\\"]
--cloud-hdd-size HDD size in GB [number]
--cloud-ssh-private Custom private RSA SSH key. If not
provided an automatically generated
throwaway key will be used [string]
--cloud-spot Request a spot instance [boolean]
--cloud-spot-price Maximum spot instance bidding price
in USD. Defaults to the current spot
bidding price [number] [default: -1]
--cloud-startup-script Run the provided Base64-encoded
Linux shell script during the
instance initialization [string]
--cloud-aws-security-group Specifies the security group in AWS
[string] [default: \\"\\"]
--cloud-aws-subnet, Specifies the subnet to use within
--cloud-aws-subnet-id AWS [string] [default: \\"\\"]"
`);
});
});
1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/terraform.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const iterativeCmlRunnerTpl = (opts = {}) => {
spotPrice,
startupScript,
awsSecurityGroup,
awsSubnetId
awsSubnet
} = opts;

const template = `
Expand Down Expand Up @@ -115,7 +115,7 @@ resource "iterative_cml_runner" "runner" {
${spotPrice ? `spot_price = ${spotPrice}` : ''}
${startupScript ? `startup_script = "${startupScript}"` : ''}
${awsSecurityGroup ? `aws_security_group = "${awsSecurityGroup}"` : ''}
${awsSubnetId ? `aws_subnet_id = "${awsSubnetId}"` : ''}
${awsSubnet ? `aws_subnet_id = "${awsSubnet}"` : ''}
${
metadata
? `metadata = {\n ${mapCloudMetadata(metadata).join('\n ')}\n }`
Expand Down