You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Maintenance role exits 0 after a failed migration outside development #5709
Also from reviewing serverpod/serverpod_docs#833, which now documents this as expected behaviour ("check the logs for failures"). I don't think it is.
dart bin/main.dart --role maintenance --apply-migrations is the documented way to apply migrations from CI, and the whole point is the exit code. Today a failed migration only fails the process in development:
run mode
log
exit code
development
ERROR: Failed to apply database migrations.
1
test / staging / production
ERROR: Failed to apply database migrations.
0
This looks like a regression rather than a design choice. Before #3740 the catch in Serverpod._applyMigrations set _exitCode = 1, so maintenance failed in every mode. #3740 swapped that for an unconditional throw ExitException(1), then #3852 made the throw development-only so a running server wouldn't shut down on an integrity failure. That fix was about the monolith role, but it also took the exit code away from the maintenance role, and the maintenance role has nothing else to report. It also contradicts the Cloud docs, which say a failed migration fails the deploy.
Related: #3959 wants the maintenance role to stop calling exit altogether, so whatever we do here should fit with that.
Activity