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

Bug - Fixed a bug where -version fails due to its dependency on docker client #1118

Merged
merged 1 commit into from
Dec 1, 2017

Conversation

yhlee-aws
Copy link
Contributor

@yhlee-aws yhlee-aws commented Nov 29, 2017

Summary

Implementation details

Testing

  • Builds on Linux (make release)
  • Builds on Windows (go build -out amazon-ecs-agent.exe ./agent)
  • Unit tests on Linux (make test) pass
  • Unit tests on Windows (go test -timeout=25s ./agent/...) pass
  • Integration tests on Linux (make run-integ-tests) pass
  • Integration tests on Windows (.\scripts\run-integ-tests.ps1) pass
  • Functional tests on Linux (make run-functional-tests) pass
  • Functional tests on Windows (.\scripts\run-functional-tests.ps1) pass

New 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:

Copy link
Contributor

@nmeyerhans nmeyerhans left a 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.

@yhlee-aws yhlee-aws changed the title Version api agent, formatting: version flag fix Nov 29, 2017
@yhlee-aws yhlee-aws changed the title agent, formatting: version flag fix Bug - Fixed a bug where -version fails due to its dependency on docker client Nov 30, 2017
Copy link
Contributor

@jhaynes jhaynes left a 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?)

"fmt"

"github.com/aws/amazon-ecs-agent/agent/sighandlers/exitcodes"
)

type Versioner interface {
Copy link
Contributor

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?

Copy link
Contributor Author

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 {
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

@samuelkarp samuelkarp left a 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.

@aaithal
Copy link
Contributor

aaithal commented Nov 30, 2017

@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)

@nmeyerhans
Copy link
Contributor

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 docker info. This -info flag could provide some additional information about the agent's runtime environment, including some Docker details.

@samuelkarp
Copy link
Contributor

@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 -info satisfies that, so I'd be okay removing Docker version if we implement something like -info.

@aaithal
Copy link
Contributor

aaithal commented Nov 30, 2017

makes sense. just noting that we don't usually ask customers to run the -version command in our trouble-shooting guide. let's get rid of Docker version from -version with a plan to add -info in the future.

Copy link
Contributor

@aaithal aaithal left a 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)
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@@ -26,7 +26,7 @@ type Versioner interface {
// Version: 0.0.3
// Commit: 4bdc7fc
// DockerVersion: 1.5.0
func PrintVersion(extra ...Versioner) {
func PrintVersion() int {

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@nmeyerhans
Copy link
Contributor

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.

Copy link
Contributor

@jhaynes jhaynes left a 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.

@yhlee-aws yhlee-aws merged commit 6527d7d into aws:dev Dec 1, 2017
@yhlee-aws yhlee-aws deleted the version-api branch December 5, 2017 20:53
@aaithal aaithal mentioned this pull request Dec 18, 2017
8 tasks
@aaithal aaithal added this to the 1.17.0 milestone Jan 18, 2018
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.

6 participants