-
Notifications
You must be signed in to change notification settings - Fork 362
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
DockerLogsContainer implementation #181
Conversation
@double16 thanks for the PR! A few things:
|
logsCommand.withTimestamps(showTimestamps) | ||
} | ||
|
||
logsCommand.withStdOut(true).withStdErr(true) |
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 make these variables and default to true. If it's an option then it should be exposed to users to toggle whichever they may need.
I'll address these and one more thing ... I forgot to add documentation. 😊 |
On further thinking: lets keep the functional tests where you have them now. Our all-in-one functional test class is getting quite big and I think making it bigger, if only to keep tests in one place, is not the way to go. |
I've addressed your comments. For the tail, I opted to go with two tail options similar to the docker-java API and throw an exception if both are specified. |
logsCommand.withStdOut(getStdOut()).withStdErr(getStdErr()) | ||
|
||
if (getTailAll() != null && getTailCount() != null) { | ||
throw new InvalidUserDataException("Conflicting parameters: only one of tailAll and tailCount can be specified") |
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.
Throw GradleException instead. It's standard to expect as much from a gradle plugin.
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.
InvalidUserDataException extends GradleException, so being more specific isn't hurting handling the more generic case, right? According to Gradle API, InvalidUserDataException is appropriate here:
A InvalidUserDataException is thrown, if a user is providing illegal data for the build.
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.
Ahhhh gotcha. I assumed it was java exception. Ok lets keep it. The standard we've been keeping thus far is to use the generic GradleException in all places. Having something a bit more specific can't hurt.
@double16 just a couple minor things related to logging and I think we are set. Have you run the integration tests yet? |
@cdancy I have run all of the tests for the project and they pass, except for three that push to DockerHub and private repos, which I didn't configure. |
@double16 lgtm. Squash and rebase then I'll merge. |
c7ac40a
to
0338f38
Compare
@cdancy squashed and ready to go |
DockerLogsContainer implementation
Thanks @double16! |
@double16 have you used this task at all? I'm more wondering how you are using it assuming you're doing so. My thoughts surround the capturing of the logs themselves and if you're doing so through some mechanism. I'm thinking of putting together some sort of |
I am currently using this task in a Bamboo plan. Bamboo captures the Gradle output and saves the logs so if something goes wrong (or it succeeds), the logs can be inspected. I've really only used the logs to review when something goes wrong. I avoid making decisions based on log output. I rely on output files with a specific purpose such as JUnit XML, or JSON, etc. Allowing a sink to be specified sounds like a good idea, as long as it's optional. I'd really like to keep the functionality to output to stdout/stderr so CI tools like Bamboo or Jenkins can capture the output. |
Aaahhhh a fellow Bamboo user! Our use case here is more for checking when a given container is "live" by waiting for our app to print out an "init is complete" message. I'd definitely keep the functionality as-is, as we've already released and folks will have come to depend on it. Any additions would be purely optional at this point. Thanks for the info. |
This task implements
docker logs
. Fixes #132