Skip to content
This repository has been archived by the owner on Nov 27, 2024. It is now read-only.

Commit

Permalink
Release v0.2.6 Name sync, regions and types (iterative#273,iterative#320
Browse files Browse the repository at this point in the history
,iterative#282,iterative#305,iterative#306,iterative#322) (iterative#338)

* cml-cloud-runner name sync

* change cli help

* fix template

* bump version
  • Loading branch information
DavidGOrtega authored Nov 12, 2020
1 parent ce414d1 commit c73b6ff
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 17 deletions.
22 changes: 11 additions & 11 deletions bin/cml-cloud-runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ const setup_runners = async (opts) => {
username = 'ubuntu',
labels: runner_labels,
'idle-timeout': runner_idle_timeout,
name: runner_name = randid(),
image = 'dvcorg/cml:latest',
'rsa-private-key': rsa_private_key,
attached
Expand All @@ -78,7 +77,7 @@ const setup_runners = async (opts) => {
console.log('Instance', instance);

const {
attributes: { instance_ip: host, key_private }
attributes: { instance_name, instance_ip: host, key_private }
} = instance;

if (!host)
Expand All @@ -105,11 +104,11 @@ const setup_runners = async (opts) => {
-e AWS_ACCESS_KEY_ID=${process.env.AWS_ACCESS_KEY_ID} \
-v $(pwd)/terraform.tfstate:/terraform.tfstate \
-v $(pwd)/main.tf:/main.tf \
-e "RUNNER_TF_NAME=iterative_machine.${resource.name}" \
-e "repo_token=${token}" \
-e "RUNNER_TF_NAME=iterative_machine.${resource.name}" \
-e "RUNNER_REPO=${repo}" \
-e "RUNNER_DRIVER=${driver}" \
-e "RUNNER_NAME=${runner_name}" \
-e "RUNNER_NAME=${instance_name}" \
${runner_labels ? `-e "RUNNER_LABELS=${runner_labels}"` : ''} \
${
runner_idle_timeout
Expand All @@ -124,20 +123,20 @@ const setup_runners = async (opts) => {

if (start_runner_cmd_out.code)
throw new Error(
`Error starting the runner. $${start_runner_cmd_out.stdout}`
`Error starting the runner. ${start_runner_cmd_out.stdout}`
);

await ssh.dispose();
await cml.await_runner({ name: instance_name });
}

await cml.await_runner({ name: runner_name });
};

const run_terraform = async (opts) => {
console.log('Initializing terraform...');

const {
region,
name: instance_name = `cml_${randid()}`,
type: instance_type,
'hdd-size': instance_hdd_size,
'tf-file': tf_file,
Expand Down Expand Up @@ -165,7 +164,7 @@ terraform {
required_providers {
iterative = {
source = "DavidGOrtega/iterative"
version = "0.4.0"
version = "0.5.0"
}
}
}
Expand All @@ -174,6 +173,7 @@ provider "iterative" {}
resource "iterative_machine" "machine" {
${region ? `region = "${region}"` : ''}
${instance_name ? `instance_name = "${instance_name}"` : ''}
${instance_type ? `instance_type = "${instance_type}"` : ''}
${instance_hdd_size ? `instance_hdd_size = "${instance_hdd_size}"` : ''}
${
Expand Down Expand Up @@ -243,11 +243,11 @@ const argv = yargs
.default('region')
.describe(
'region',
'Region where the instance is deployed. Defaults to us-east-1.'
'Region where the instance is deployed. Defaults to us-west.'
)
.describe('type', 'Instance type. Defaults to t2.micro.')
.describe('type', 'Instance type. Defaults to m.')
.default('hdd-size')
.describe('hdd-size', 'HDD size in GB. Defaults to 100. Minimum is 100.')
.describe('hdd-size', 'HDD size in GB. Defaults to 10.')
.default('tf-file')
.describe(
'tf-file',
Expand Down
7 changes: 3 additions & 4 deletions bin/cml-cloud-runner.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@ describe('CML e2e', () => {
before shutting down. Defaults to 5 min
--image Docker image. Defaults to dvcorg/cml:latest
--name Name displayed in the repo once registered.
--region Region where the instance is deployed. Defaults to
us-east-1.
--type Instance type. Defaults to t2.micro.
--hdd-size HDD size in GB. Defaults to 100. Minimum is 100.
--region Region where the instance is deployed. Defaults to us-west.
--type Instance type. Defaults to m.
--hdd-size HDD size in GB. Defaults to 10.
--tf-file Use a tf file configuration ignoring region, type and
hdd_size.
--rsa-private-key Your private RSA SHH key. If not provided will be generated
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dvcorg/cml",
"version": "0.2.5",
"version": "0.2.6",
"author": {
"name": "DVC",
"url": "http://cml.dev"
Expand Down

0 comments on commit c73b6ff

Please sign in to comment.