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

service/start: check check-migrations failure more robustly #888

Merged
merged 2 commits into from
Feb 12, 2025

Conversation

alxndrsn
Copy link
Contributor

@alxndrsn alxndrsn commented Feb 10, 2025

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 and set -o pipefail might provide even more safety in handling failures in this script. These latter options would also allow for complete removal of make 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:

  • branched off and targeted the next branch OR only changed documentation/infrastructure (master is stable and used in production)
  • verified that any code or assets from external sources are properly credited in comments or that everything is internally sourced

alxndrsn added 2 commits February 10, 2025 18:13
If check-migrations fails with non-1 exit code, the server will continue
to start.

This check was originally introduced as a fix for getodk#461.  This change should
be more robust than the existing approach, but `set -e` and `set -o pipefail`
might provide even more safety in handling failures in this script.

There may also be other critical scripts in this repo which would benefit
from similar changes.
@alxndrsn alxndrsn requested a review from ktuite February 11, 2025 09:38
@alxndrsn alxndrsn marked this pull request as ready for review February 11, 2025 09:38
@alxndrsn alxndrsn merged commit 1c7b303 into getodk:next Feb 12, 2025
2 checks passed
@alxndrsn alxndrsn deleted the fail-test-migrations branch February 12, 2025 05:26
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.

2 participants