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

mysql-backup-s3: set '-o pipefail' to catch errors when database not found #86

Open
byrnedo opened this issue Oct 11, 2017 · 7 comments

Comments

@byrnedo
Copy link

byrnedo commented Oct 11, 2017

Hi,

You have 'set -e' at the top of the backup.sh script.

Right now, the mysqldump ...|gzip... command wont fail if mysqldump returns an error.

If you add

set -eo pipefail

It'll catch that. You could also add `set -euo pipefail' to catch unset variables too.

I assume this affects other images you have too.

@OlivierCuyp
Copy link
Collaborator

@byrnedo That's a good idea. Could you please make a PR ?

@byrnedo
Copy link
Author

byrnedo commented Jul 27, 2018

@OlivierCuyp done. Sh doesn't support -u and either way it would have probably broken certain scripts, so I just changed it to -eo pipefail. Are there any tests one can run to confirm?

@OlivierCuyp
Copy link
Collaborator

@byrnedo sorry for the late answer. There no real tests. From what I read I guess you tested it on your side. If you confirm so I would merge the PR.

@byrnedo
Copy link
Author

byrnedo commented Aug 20, 2018

No, haven't tested it

@OlivierCuyp
Copy link
Collaborator

Ok, I'll dedicate some time to test it then ;)

@byrnedo
Copy link
Author

byrnedo commented Aug 21, 2018

I can help out too, not sure how one would test this though, so many different images.
Any opinion on what tools to use to test this? Bats or Goss?

@OlivierCuyp
Copy link
Collaborator

Hi @byrnedo, thanks for your proposal. I have no experience with both of these test frameworks.
I would say choose the one you feel more confortable with.

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

No branches or pull requests

2 participants