-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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 function for docker compose to return stdout #665
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.
Had some comments for improving the implementation slightly.
The one other thing to add is a unit or integration test for this function. You should be able to reuse the test for RunDockerCompose
for this purpose (https://github.com/gruntwork-io/terratest/blob/master/test/packer_docker_example_test.go)
Co-authored-by: Yoriyasu Yano <430092+yorinasub17@users.noreply.github.com>
@yorinasub17 This test is failing, added in this commit, because the stdout actually includes a lot more stuff than I expect. The
|
Ahhhh this might not be possible then... Frustratingly, I can't find the docs on where they output the logs to. Let me try a few things to see if I can empirically validate. |
Ok yea both So it looks like this approach and function is not going to work 😞 |
We probably need to add a function that extracts the stdout and stderr logs using the raw log files. I found the command that gives you the path to the raw log file which has the metadata on where it came from
But... this is only accessible from the VM on mac osx so you can't actually see it directly and we'd need to yak shave a way to get into the VM... |
Co-authored-by: Yevgeniy Brikman <brikis98@users.noreply.github.com>
@yorinasub17 However, when I source this change here locally in the TLS script, it's able to pull just the right info that's echoed to stdout, meaning the ARN. I was trying to figure out what the difference would be. Any ideas why it would work when used in service catalog but not here? |
Ah, I solved the problem. If I call the bash_script with |
…test into docker-compose-stdout
🎉 Thanks @brikis98 and @yorinasub17! Ready for (final?) review. |
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.
Updates LGTM (assuming build passes)! Found one more nit where we should expose another function, but we can punt that to another PR to avoid another test cycle.
out, err := runDockerComposeE(t, true, options, args...) | ||
require.NoError(t, err) | ||
return out | ||
} |
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.
Just realized that we should probably expose a RunDockerComposeAndGetStdOutE
function as well.
Thanks for the review! Failures are not related to this change, so merging. |
Don't forget to cut a new release! |
Okay! Thanks for that. I was waiting for feedback on this! Will go ahead now. |
Ah, before I do, did you see my comment in Slack? I wanted to make sure we were safe to do it, i.e. passing tests on the main branch. There were a few small failures in this branch but I merged because they were unrelated to this change. That's a bit of risky logic, though, and not how I'd normally like to do things. So my idea was to wait for green on |
It looks like #665 added the ability to run `docker-compose` and get `stdout`. As part of this work, a new example in `examples/docker-compose-stdout-example` was added that had a `bash_script.sh` that was used for testing. All this works fine, but it looks like #665 _also_ added a reference to `bash_script.sh` to the `docker-compose.yml` in `examples/packer-docker-example`... But not `bash_script.sh` itself, so it's making tests fail. This seems like a copy/paste error, or perhaps a leftover of some previous test, so I'm removing this mention.
It looks like gruntwork-io#665 added the ability to run `docker-compose` and get `stdout`. As part of this work, a new example in `examples/docker-compose-stdout-example` was added that had a `bash_script.sh` that was used for testing. All this works fine, but it looks like gruntwork-io#665 _also_ added a reference to `bash_script.sh` to the `docker-compose.yml` in `examples/packer-docker-example`... But not `bash_script.sh` itself, so it's making tests fail. This seems like a copy/paste error, or perhaps a leftover of some previous test, so I'm removing this mention.
What else does this PR need?
Purpose: I've just added a function that lets docker compose return only
stdout
, so that TLS Scripts followups can get just the Certificate ARN fromstdout
and clean up the resource during the test cleanup stage.