Default registry database port to postgresql['port'] (18.11 backport)
What does this MR do and why?
Backport of !9493 (merged) to 18-11-stable for the 18.11 patch release.
The container registry database only derived its host from the embedded PostgreSQL settings, leaving the port pinned to the hardcoded default of 5432. When postgresql['port'] was changed (e.g. to 5433), the registry still connected on 5432, breaking installs at the registry database migration step now that the registry database is preferred by default.
This makes the registry database port fall back to postgresql['port'] (then the node default) unless the user explicitly set registry['database']['port'], mirroring how gitlab_rails['db_port'] behaves.
- Original MR: !9493 (merged)
- Related issue: #9918 (closed)
The production change (files/gitlab-cookbooks/gitlab/libraries/registry.rb) cherry-picked cleanly. The accompanying RSpec was adapted to this branch's existing stubbing style for parse_database_configuration; bundle exec rspec spec/chef/cookbooks/gitlab/libraries/registry_spec.rb passes (14 examples, 0 failures).
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
- This MR is backporting a bug fix, documentation update, or spec fix, previously merged in the default branch.
- The original MR has been deployed to GitLab.com (not applicable for documentation or spec changes).
- This MR has a severity label assigned (if applicable).
Note to the merge request author and maintainer
If you have questions about the patch release process, please:
- Refer to the patch release runbook for engineers and maintainers for guidance.
- Ask questions on the
#releasesSlack channel (internal only).