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

duffle driver ignores operation writer, writes directly to stdout #78

Closed
carolynvs opened this issue Jun 5, 2019 · 7 comments · Fixed by #234
Closed

duffle driver ignores operation writer, writes directly to stdout #78

carolynvs opened this issue Jun 5, 2019 · 7 comments · Fixed by #234

Comments

@carolynvs
Copy link
Contributor

The docker driver is passed on the Operation struct a writer for any output, but instead it is writing directly to stdout.

As part of Porter we are implementing a verbose flag and would like to be able to show/hide this output, but it is printing directly so we can't control it. Would you be up for a pull request that switches the driver over to using op.Out?

@glyn
Copy link
Contributor

glyn commented Jun 6, 2019

Seems reasonable to me.

@benpatt
Copy link

benpatt commented Jul 23, 2019

The docker driver is passed on the Operation struct a writer for any output, but instead it is writing directly to stdout.

Is this still the case? If so, can you give a pointer?

@carolynvs
Copy link
Contributor Author

Yup, it's still the case. 😀 You feel like tackling it?

The driver implements the common interface for a driver, but in it's exec function it ignores the writer field coming in on the op argument to exec.

https://github.com/deislabs/duffle/blob/08636d6a7f3651ee05cba1f2fb2cdaaa3d405fae/pkg/driver/docker_driver.go#L202

@glyn
Copy link
Contributor

glyn commented Jul 23, 2019

When discussing this issue with @benpatt, I wondered if there was a distinction between the output stream for the logs from the docker driver and from the container that the docker drive runs. @carolynvs would you say that all the logs from the driver itself and from the container should be sent to the same output stream (the one in the Operation struct)?

@carolynvs
Copy link
Contributor Author

The driver doesn't seem to print much (just 1 error message about pulling the image). Outputting everything to the Operation writer would be just fine by me.

@silvin-lubecki
Copy link
Contributor

As said on this PR review cnabio/duffle#808 (review)

Well we are actually using those 2 methods here in docker/app
https://github.com/docker/app/blob/master/internal/commands/cnab.go#L191
If I remember correctly we are using the container output stdout and stderr for our custom actions (ex: our render action which can fail or print a result), but we still need to mute the driver itself using the dockerCli stdout and stderr pointing to ioutil.Discard.
By the way, I'm wondering why we are still using the drivers here, as they were moved to cnab-go 🤔
https://github.com/deislabs/cnab-go/blob/master/driver/docker/docker.go

@glyn
Copy link
Contributor

glyn commented Jul 24, 2019

As said on this PR review #808 (review)

Well we are actually using those 2 methods here in docker/app
https://github.com/docker/app/blob/master/internal/commands/cnab.go#L191
If I remember correctly we are using the container output stdout and stderr for our custom actions (ex: our render action which can fail or print a result), but we still need to mute the driver itself using the dockerCli stdout and stderr pointing to ioutil.Discard.

It would be good to add a driver test to tie down the behaviour. Otherwise, it is bound to break docker/app in future.

By the way, I'm wondering why we are still using the drivers here, as they were moved to cnab-go 🤔
https://github.com/deislabs/cnab-go/blob/master/driver/docker/docker.go

Good catch. Raised cnabio/duffle#809 to delete the old code. We also need to move this issue to cnab-go which is now its proper home.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants