Skip to content

Conversation

@software-opal
Copy link
Contributor

This PR fixes #327 by uploading docker-compose logs when the services fail to start up.

I've done this by copy-pasting the log upload code from the end of the run.sh file to below the code that starts up the dependent services.

I've verified that these changes correctly fix the issue using the BuildKite pipeline and docker-compose file in the issue.

@toote
Copy link
Contributor

toote commented Sep 16, 2022

Great idea! I would suggest 2 changes, though:

1- instead of copying and pasting the code from the run.sh file, move it to the shared.sh file inside of a function and call it from both places (thus avoiding code duplication)
2- instead of messing with the -e option I believe you shoud just enclose the run_docker_compose calls in an if ! run_docker_compose .... I believe that the end result will be the same and the code will be cleaner (avoiding the need to explain why you are doing something that looks wrong :P)

Fixes Container logs are not uploaded when dependencies fail to start #327
@software-opal
Copy link
Contributor Author

software-opal commented Sep 21, 2022

Thanks for the feedback, I've gone back and made some changes. I've moved the failed services table and log upload into functions in the run.bash shared file. I've also added a test for the 'dependencies fail to start' scenario.

I made some other changes to the tests in tests/output.bats because I wasn't confident that my changes were working correctly and I realised the output-checking parts of the test could have passed without the plugin actually running the test cases(the substring being checked for was present in the dependency output too). Happy to revert those changes if they are undesired

@toote toote mentioned this pull request Sep 21, 2022
Copy link
Contributor

@toote toote left a comment

Choose a reason for hiding this comment

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

Just a few minor comments. There is only one important one (to preserve the exit code), all the rest are mostly aesthetic. Sorry for being so nit-picky but I believe that this is the last one as you are obviously did a wonderful job

@software-opal software-opal requested a review from toote September 22, 2022 05:55
Copy link
Contributor

@toote toote left a comment

Choose a reason for hiding this comment

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

A single minor detail that I caused when suggesting the name change that also caused one of the pipeline steps to fail. I tried to change it myself as it was VERY simple but I didn't have access to push to your branch so it falls to you again. Sorry

@software-opal
Copy link
Contributor Author

software-opal commented Sep 22, 2022

I'm seeing a README linting failure which I don't think is caused by this PR:

not ok 3 - Readme version numbers out of date. Latest is v3.11.0

Would you like me to change the version numbers in the README to v3.11.0?

@toote
Copy link
Contributor

toote commented Sep 22, 2022

@software-opal actually, I would suggest you update it to 3.11.1 as that will be the release version after this is merged :)

Copy link
Contributor

@toote toote left a comment

Choose a reason for hiding this comment

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

👏

@toote toote requested a review from pzeballos September 22, 2022 22:52
@pzeballos pzeballos merged commit f555794 into buildkite-plugins:master Sep 23, 2022
@software-opal software-opal deleted the issue-327/upload-logs-when-dependencies-fail-to-start branch September 23, 2022 02:35
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.

Container logs are not uploaded when dependencies fail to start

3 participants