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

Make ecs-cli prefixes configurable. #103

Merged
merged 1 commit into from
Apr 11, 2016

Conversation

uttarasridhar
Copy link
Contributor

closes #51

Fields:

  • ecs-cli up : CFNStackName
  • ecs-cli compose : ComposeProjectNamePrefix used for
    • task definition name
    • started by for tasks
  • ecs-cli compose service : ComposeServiceNamePrefix used for
    • service name

$ make clean
rm -rf ./ecs-cli/vendor/pkg ||:
rm -rf ./bin/ ||:
rm -rf ./ecs-cli/vendor/bin ||:
$ make build
. ./scripts/shared_env && ./scripts/build_binary.sh ./bin/local
Built ecs-cli

TESTING

Unit Test

$ make test
. ./scripts/shared_env && env -i PATH=$PATH GOPATH=$GOPATH GOROOT=$GOROOT go test -timeout=120s -v -cover ./ecs-cli/license/... ./ecs-cli/modules/...

PASS

Manual Integration Test

EXISTING USERS : Works as it is

Config doesn't have prefixes

$ cat ~/.ecs/config
[ecs]
cluster = test
aws_profile = 
region = us-west-2
aws_access_key_id = 
aws_secret_access_key = 
$ ./bin/local/ecs-cli compose --project-name test-prefix service create
INFO[0000] Using ECS task definition                     TaskDefinition=ecscompose-test-prefix:1
INFO[0000] Created an ECS service                        service=ecscompose-service-test-prefix taskDefinition=ecscompose-test-prefix:1
$ ./bin/local/ecs-cli up --capability-iam --keypair ecs_key_pair
INFO[0000] Created cluster                               cluster=test
INFO[0000] Waiting for your cluster resources to be created 
INFO[0000] Cloudformation stack status                   stackStatus=CREATE_IN_PROGRESS
INFO[0061] Cloudformation stack status                   stackStatus=CREATE_IN_PROGRESS
====> Creating CFN Stack amazon-ecs-cli-setup-test

EXISTING USERS + NEW USERS : who call configure

$ ./bin/local/ecs-cli configure -help
NAME:
   configure - Configures your AWS credentials, the AWS region to use, and the ECS cluster name to use with the Amazon ECS CLI. The resulting configuration is stored in the ~/.ecs/config file.

USAGE:
   command configure [command options] [arguments...]

OPTIONS:
   --region, -r                     Specifies the AWS region to use. If the AWS_REGION environment variable is set when ecs-cli configure is run, then the AWS region is set to the value of that environment variable. [$AWS_REGION]
   --access-key                     Specifies the AWS access key to use. If the AWS_ACCESS_KEY_ID environment variable is set when ecs-cli configure is run, then the AWS access key ID is set to the value of that environment variable. [$AWS_ACCESS_KEY_ID]
   --secret-key                     Specifies the AWS secret key to use. If the AWS_SECRET_ACCESS_KEY environment variable is set when ecs-cli configure is run, then the AWS secret access key is set to the value of that environment variable. [$AWS_SECRET_ACCESS_KEY]
   --profile, -p                    Specifies your AWS credentials with an existing named profile from ~/.aws/credentials. If the AWS_PROFILE environment variable is set when ecs-cli configure is run, then the AWS named profile is set to the value of that environment variable. [$AWS_PROFILE]
   --cluster, -c                    Specifies the ECS cluster name to use. If the cluster does not exist, it is created when you try to add resources to it with the ecs-cli up command.
   --compose-project-name-prefix "ecscompose-"      [Optional] Specifies the prefix added to an ECS task definition created from a compose file. Format <prefix><project-name>.
   --compose-service-name-prefix "ecscompose-service-"  [Optional] Specifies the prefix added to an ECS service created from a compose file. Format <prefix><project-name>.
   --cfn-stack-name-prefix "amazon-ecs-cli-setup-"  [Optional] Specifies the prefix added to the AWS CloudFormation stack created on ecs-cli up. Format <prefix><cluster-name>.
$ ./bin/local/ecs-cli configure --cluster test --region us-west-2 --compose-service-name-prefix "" --cfn-stack-name-prefix "ecs-cli-"
INFO[0000] Saved ECS CLI configuration for cluster (test) 

$ cat ~/.ecs/config 
[ecs]
cluster = test
aws_profile = 
region = us-west-2
aws_access_key_id = 
aws_secret_access_key = 
compose-project-name-prefix = ecscompose-       // Picks the default (for backward compatibility)
compose-service-name-prefix =                   // User defined string="empty"
cfn-stack-name-prefix = ecs-cli-                // User defined string

CloudFormation

$ ./bin/local/ecs-cli up --capability-iam --keypair ecs_key_pair
INFO[0000] Created cluster                               cluster=test
INFO[0000] Waiting for your cluster resources to be created 
INFO[0000] Cloudformation stack status                   stackStatus=CREATE_IN_PROGRESS
INFO[0061] Cloudformation stack status                   stackStatus=CREATE_IN_PROGRESS
INFO[0121] Cloudformation stack status                   stackStatus=CREATE_IN_PROGRESS
INFO[0181] Cloudformation stack status                   stackStatus=CREATE_IN_PROGRESS
INFO[0241] Cloudformation stack status                   stackStatus=CREATE_IN_PROGRESS

Checked the CFN Console to see : ecs-cli-test. NOTE: used the prefix for CFN stack that we set

Compose commands

$ ./bin/local/ecs-cli compose --project-name test-prefix service create
INFO[0000] Using ECS task definition                     TaskDefinition=ecscompose-test-prefix:1
INFO[0000] Created an ECS service                        service=test-prefix taskDefinition=ecscompose-test-prefix:1

NOTE : used the empty prefix for service name that we set, and for task definition it uses "ecscompose-" prefix

closes aws#51

Fields:
* ecs-cli up : CFNStackName
* ecs-cli compose : ComposeProjectNamePrefix used for
 * task definition name
 * started by for tasks
* ecs-cli compose service : ComposeServiceNamePrefix used for
 * service name
@samuelkarp
Copy link
Contributor

👍

@uttarasridhar uttarasridhar merged commit a3e3eee into aws:master Apr 11, 2016
@uttarasridhar uttarasridhar deleted the configurable-prefix branch April 11, 2016 17:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ecscompose-service Prefix
2 participants