Valkey version needs to be properly detected on reconfigure
Summary
We've introduced Valkey support in Beta.
During reconfigure, Omnibus prints a warning if either Redis or Sentinel detects different versions between the locally installed version, and the version that our CLI connects to:
- https://gitlab.com/gitlab-org/omnibus-gitlab/-/blob/67b58e367ab23ad4bdf1472e08adda4dd12cc9cc/files/gitlab-cookbooks/redis/resources/service.rb#L88-100
- https://gitlab.com/gitlab-org/omnibus-gitlab/-/blob/67b58e367ab23ad4bdf1472e08adda4dd12cc9cc/files/gitlab-cookbooks/gitlab-ee/resources/sentinel_service.rb#L82
The installed version is taken from "/opt/gitlab/embedded/bin/#{server_binary} --version".
The running_version is taken from:
commands = ["/opt/gitlab/embedded/bin/#{cli_binary}"]
commands << redis_cli_connect_options
commands << "INFO"
command = commands.join(" ")
command_output = VersionHelper.version(command)
version_match = command_output.match(/redis_version:(?<redis_version>\d*\.\d*\.\d*)/)
In simpler words, the running_version takes redis_version: from the output of calling the INFO command in Redis.
Although, when Valkey is enabled, this is what we get:
root@gitlab-3k-test-redis-1:/var/log/gitlab/redis# gitlab-redis-cli INFO server
# Server
redis_version:7.2.4
server_name:valkey
valkey_version:7.2.11
...
So for Valkey, the correct is to take the version from valkey_version, not redis_version.
Proposal
The regex logic to take the version needs to consider whether valkey_enabled?:
if valkey_enabled?
version_match = command_output.match(/valkey_version:(?<valkey_version>\d*\.\d*\.\d*)/)
else
version_match = command_output.match(/redis_version:(?<redis_version>\d*\.\d*\.\d*)/)
end
Steps to reproduce
Install Omnibus and enable Valkey using a package where Valkey has a different version than Omnibus.
Check the reconfigure logs for the warnings.
What is the current bug behavior?
If our Valkey version is different than the Redis one, we're printing warnings during reconfigure that are misleading whenever Valkey is enabled for either sentinel or just redis.
This is happening because we're comparing valkey server version with redis_version taken from the INFO command.
What is the expected correct behavior?
We should compare valkey to valkey, and redis to redis, depending on what is enabled.