summaryrefslogtreecommitdiff
path: root/lib/gitaly
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-12-02 12:06:45 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-02 12:06:45 +0000
commitbffcdf9bca11a4d43cc40e3f382f03088d36f7c6 (patch)
treec773436393b7a59b5f6b14388b9fa6402a9bd198 /lib/gitaly
parent259c0cc0c4f8a49001b33d1bee577f4422e16d62 (diff)
downloadgitlab-ce-bffcdf9bca11a4d43cc40e3f382f03088d36f7c6.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitaly')
-rw-r--r--lib/gitaly/server.rb14
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/gitaly/server.rb b/lib/gitaly/server.rb
index 907c6e1b605..64ab5db4fcd 100644
--- a/lib/gitaly/server.rb
+++ b/lib/gitaly/server.rb
@@ -2,6 +2,8 @@
module Gitaly
class Server
+ SHA_VERSION_REGEX = /\A\d+\.\d+\.\d+-\d+-g([a-f0-9]{8})\z/.freeze
+
class << self
def all
Gitlab.config.repositories.storages.keys.map { |s| Gitaly::Server.new(s) }
@@ -30,9 +32,10 @@ module Gitaly
info.git_version
end
- def up_to_date?
- server_version == Gitlab::GitalyClient.expected_server_version
+ def expected_version?
+ server_version == Gitlab::GitalyClient.expected_server_version || matches_sha?
end
+ alias_method :up_to_date?, :expected_version?
def read_writeable?
readable? && writeable?
@@ -62,6 +65,13 @@ module Gitaly
@storage_status ||= info.storage_statuses.find { |s| s.storage_name == storage }
end
+ def matches_sha?
+ match = server_version.match(SHA_VERSION_REGEX)
+ return false unless match
+
+ Gitlab::GitalyClient.expected_server_version.start_with?(match[1])
+ end
+
def info
@info ||=
begin