Do not fail 19.x upgrade on stale Mattermost cached config when Mattermost was never enabled

Summary

This merge request fixes a false-positive upgrade blocker in Omnibus GitLab 19.x.

When upgrading from 18.11.x to 19.1.2, the pre-install deprecation check can fail with a Mattermost removal error even when Mattermost was never enabled and all mattermost[...] settings in gitlab.rb are commented out or absent.

The failure happens because the upgrade path inspects cached internal state and stale Mattermost data in those caches is treated as active removed configuration.

What changed

This MR makes two changes:

  • In files/gitlab-cookbooks/package/libraries/deprecations.rb, it replaces the broad top-level Mattermost removal behavior with a narrower check that only emits the 19.0 Mattermost removal warning when Mattermost appears to have been actively enabled.

  • In spec/chef/cookbooks/package/libraries/deprecations_spec.rb, it updates the Mattermost coverage so that active Mattermost config still raises the 19.0 removal warning, while stale secrets-only cached Mattermost state does not.

Why

The linked work item shows that earlier 18.x Omnibus installs can carry Mattermost data in both /etc/gitlab/gitlab-secrets.json and /opt/gitlab/embedded/nodes/<hostname>.json, and the pre-install check currently treats that stale cached structure as a hard removal hit.

That creates a false-positive upgrade failure for instances that never actually used bundled Mattermost.

Result

With this change:

  • real Mattermost usage in cached config still produces the 19.0 removal warning

  • stale cached Mattermost residue no longer blocks the upgrade by itself

  • the regression is covered with a focused spec

Linked issue

Closes #10001

Test plan

  • Run the updated deprecations spec and confirm:

    • active Mattermost config still raises the 19.0 removal warning

    • secrets-only stale Mattermost cached state does not raise the removal warning

  • Verify mattermost_external_url deprecation behavior remains unchanged for the 19.0 to 20.0 path

Context

The linked issue documents the current failure mode, including the exact removal message and the workaround of deleting the Mattermost block from gitlab-secrets.json and clearing the embedded node cache before retrying the upgrade.


Sources

Merge request reports

Loading