-
Notifications
You must be signed in to change notification settings - Fork 301
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
Add task-def and file flags to local down/ps #789
Add task-def and file flags to local down/ps #789
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you run through the checklist in the PR description:
- Run
make test
to make sure the unit tests pass - Run
make integ-test
to make sure our e2e tests pass - Add manual tests to illustrate your changes
- Also add e2e tests for the new flags.
Also please update the title of the PR to be more description such as "Add task-def and file flags to local down/ps"
Looks great! @iamhopaul123 can you also run the integration tests to validate that nothing breaks? |
Manual TestingConfigurationParameters# docker-compose.yml
version: "3"
networks:
ecs-local-network:
external: true
services:
app:
build:
context: .
ports:
- "6001:80"
networks:
- ecs-local-network
environment:
AWS_DEFAULT_REGION: "us-east-1"
AWS_CONTAINER_CREDENTIALS_RELATIVE_URI: "/creds"
ECS_CONTAINER_METADATA_URI: "http://169.254.170.2/v3"
labels:
ecsLocalTaskDefType: 'remoteFile'
ecsLocalTaskDefVal: 'arn:aws:ecs:us-east-1:685593908319:task-definition/efe-test:1' #Dockerfile
FROM ubuntu:latest
RUN apt-get update \
&& apt-get -y install curl \
&& apt-get -y install awscli \
&& apt-get -y install jq \
&& apt-get -y install net-tools
CMD /bin/bash -c 'while true; do sleep 30; done;' Note that, I put several "docker-compose.yml" in different directories to avoid recreation. Environment Setup
TestsLists all running containers matching the task family or ARN
Lists all running containers matching the task definition file path
List all running containers matching the task definition file path and task family or ARN
Stops and removes all running containers matching the task definition file path
Stops and removes all running containers matching the task family or ARN
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 🚀
) | ||
|
||
const ( | ||
ecsLocalDockerComposeFileName = "docker-compose.local.yml" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a different constant name for this: LocalOutDefaultFileName
https://github.com/aws/amazon-ecs-cli/pull/785/files#diff-c72fc3b09ef311d6734cb6f6b9c9b9a6R36. Was this name discussed outside of the context of the Create PR?
const ( | ||
localTaskDefType = "localFile" | ||
remoteTaskDefType = "remoteFile" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm also a little confused why these four constants are defined in create_app.go
right now, as I don't see them being used in the create function. Perhaps it would make sense to move these constants to a different file still under the local
package namespace?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the idea is that eventually Create()
will eventually add these as Docker labels to the containers so that we know if the containers were started with a localFile
or remoteFile
.
func Create(c *cli.Context) { | ||
// 1. read in task def (from file or arn) | ||
// 2. parse task def into go object | ||
// 3. write to docker-compose.local.yml file | ||
fmt.Println("foo") // placeholder | ||
} | ||
|
||
func validateOptions(c *cli.Context) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly, not sure why this function lives in this file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The flags that are being validated apply to all the sub-commands (create
, up
, down
, ps
). Should this live in some other file? 🤔 I think we decided to move it in create_app.go
because it's the first command that users will use for local but I can see how that's not a strong reason.
Issue #, if available:
Description of changes:
Added two flags "--task-def" and "--file" for "ps" and "down" options for ecs-cli local for filtering.
Enter
[N/A]
in the box, if an item is not applicable to your change.Testing
Documentation
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.