-
Notifications
You must be signed in to change notification settings - Fork 132
Description
The regexp to get the latest migration version (lib/health_check/utils.rb, line 120) is not precise enough.
We deploy our staging instances into paths named after the branch and name the branches with a ticket number prefix.
Now I had a branch 9876_forbid... and full migration names like
/var/www/rails/9876_forbid_whatever/releases/20250616051503/db/migrate/20250512111821_add_table.rb
The regexp /0*([0-9]+)_[_.a-zA-Z0-9]*.rb/ is expected to read the migration number 20250512111821 but reads 9876 as orb in forbid matches .rb (the . is not excaped, and the .rb does not have to be at the end of string).
As a result the instance is considered not healthy...
As a fix one might
- escape the .
/0*([0-9]+)_[_.a-zA-Z0-9]*\.rb/ - add a $ for end of string after the .rb
- change it further into
/0*([0-9]+)_[^\/]\.rb$/(anything except / allowed in migration filename)
I can provide a PR if there is a chance for a new version.
OTOH maybe this only showed up, because the fallback from rails methods was used, which is already reported and fixed in #147