-
Notifications
You must be signed in to change notification settings - Fork 616
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
Bug - Fixed a bug where -version fails due to its dependency on docker client #1118
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.
Our changelog entries should follow the format in CHANGELOG.md, and should be included in that file.
It'd also be good to squash the commits in this PR into a single one before we merge.
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.
Should/can we add any tests around this change? (e.g. make sure we can get the version without a successful Docker API call?)
agent/version/formatting.go
Outdated
"fmt" | ||
|
||
"github.com/aws/amazon-ecs-agent/agent/sighandlers/exitcodes" | ||
) | ||
|
||
type Versioner interface { |
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.
Is there a reason to leave this interface around?
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.
Versioner interface isn't used anywhere regardless of this change, removing it.
@@ -170,12 +167,6 @@ func newAgent( | |||
}, nil | |||
} | |||
|
|||
// printVersion prints the ECS Agent version string | |||
func (agent *ecsAgent) printVersion() int { |
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.
It looks like agent/app/agent_integ_test.go
calls printVersion
. There is also a windows mock that can probably go away here: agent/app/agent_windows_test.go
.
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.
For the agent_integ_test, I'll replace the call to printVersion with printECSAttributes, now that printVersion doesn't actually depend on newAgent call.
Removing the mock from agent_window_test.
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'd prefer not to eliminate the Docker version from the output here, but rather to just skip it when it's unavailable.
@samuelkarp why would prefer to keep docker version being printed with Agent version? Can't you get it from other sources? I'm not sure if we really need to print docker version when printing agent version (I'm trying to think of use-cases which would require it, but can't seem to think of any) |
IMO the -version flag should get us the agent version and little, if anything, else. We could consider adding a -info flag or similar that gives us additional info, similar to |
@aaithal I'd like an easy way for us to ask customers to run one command that gives enough information for troubleshooting. @nmeyerhans's suggestion of |
makes sense. just noting that we don't usually ask customers to run the |
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.
please rewrite the commit history before merging this so that we can get rid of messages like the one in 86d5030. looks good otherwise 🛥
CHANGELOG.md
Outdated
@@ -1,5 +1,8 @@ | |||
#Changelog | |||
|
|||
## Unreleased | |||
* Bug - Fixed a bug where -version fails due to its dependency on docker client. [#1118](https://github.com/aws/amazon-ecs-agent/pull/1118) |
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.
nit: -version
would be better
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.
fixed
agent/version/formatting.go
Outdated
@@ -26,7 +26,7 @@ type Versioner interface { | |||
// Version: 0.0.3 | |||
// Commit: 4bdc7fc | |||
// DockerVersion: 1.5.0 | |||
func PrintVersion(extra ...Versioner) { | |||
func PrintVersion() int { |
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 update the comments also.
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.
fixed
a08982c
to
79c0e50
Compare
955ec68
to
d71caff
Compare
LGTM. My only request is that the commit message be fleshed out a little bit. https://chris.beams.io/posts/git-commit/ has some good guidelines for how to structure the text. |
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 with @nmeyerhans' suggestion about the commit message.
Summary
Implementation details
Testing
make release
)go build -out amazon-ecs-agent.exe ./agent
)make test
) passgo test -timeout=25s ./agent/...
) passmake run-integ-tests
) pass.\scripts\run-integ-tests.ps1
) passmake run-functional-tests
) pass.\scripts\run-functional-tests.ps1
) passNew tests cover the changes:
Description for the changelog
Making -version flag for agent independent of docker client, and removing docker version from output.
% docker run --rm --env-file ~/env.txt amazon/amazon-ecs-agent:make -version
Amazon ECS Agent:
Version: 1.16.0
Commit: c2836d6
Dirty: true
Licensing
This contribution is under the terms of the Apache 2.0 License: