service/start: check check-migrations failure more robustly #888
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, if check-migrations fails with non-1 exit code, the server will continue to start.
The existing check-migrations call and test for exit code 1 was originally introduced as a fix for #461. The change in this PR should be more robust than the existing approach, but
set -e
andset -o pipefail
might provide even more safety in handling failures in this script. These latter options would also allow for complete removal ofmake check-migrations
from production.There may also be other critical scripts in this repo which would benefit from similar changes.
What has been done to verify that this works as intended?
Run tests, shellcheck.
Why is this the best possible solution? Were any other approaches considered?
As above, there are more complicated solutions which can improve and simplify this script. However, they are also more invasive. This change seems to be simple and an incremental improvement, so can be included more quickly than more complicated solutions which might follow.
How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?
This should not affect end users, but sysadmins deploying odk-central should find this change decreases the chances of the application starting after failed database migrations.
Does this change require updates to documentation? If so, please file an issue here and include the link below.
I don't think so.
Before submitting this PR, please make sure you have:
next
branch OR only changed documentation/infrastructure (master
is stable and used in production)