diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2018-06-06 15:12:58 +0300 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2018-06-06 15:12:58 +0300 |
commit | 38f95d6c81265521869edd6c46e1c7209ff27b5b (patch) | |
tree | 58ffb29b47bd06ae63a7f9fc1cdf96ffd77d8c89 | |
parent | ddabde5446a68d4717ed8d42431a480c7a68a8a9 (diff) | |
parent | 536d180f80839ad8350e26e435a181e3cbf2253b (diff) |
Merge branch 'gitaly-find-commit-go-git' into 'master'
Add feature flag for using go-git in Gitaly
See merge request gitlab-org/gitlab-ce!19305
-rw-r--r-- | GITALY_SERVER_VERSION | 2 | ||||
-rw-r--r-- | lib/gitlab/git/commit.rb | 3 | ||||
-rw-r--r-- | lib/gitlab/gitaly_client.rb | 14 |
3 files changed, 18 insertions, 1 deletions
diff --git a/GITALY_SERVER_VERSION b/GITALY_SERVER_VERSION index e49057b3302..f1b9cc4cd95 100644 --- a/GITALY_SERVER_VERSION +++ b/GITALY_SERVER_VERSION @@ -1 +1 @@ -0.104.0 +0.105.0 diff --git a/lib/gitlab/git/commit.rb b/lib/gitlab/git/commit.rb index 89f761dd515..c9806cdb85f 100644 --- a/lib/gitlab/git/commit.rb +++ b/lib/gitlab/git/commit.rb @@ -60,6 +60,9 @@ module Gitlab # Some weird thing? return nil unless commit_id.is_a?(String) + # This saves us an RPC round trip. + return nil if commit_id.include?(':') + commit = repo.gitaly_migrate(:find_commit) do |is_enabled| if is_enabled repo.gitaly_commit_client.find_commit(commit_id) diff --git a/lib/gitlab/gitaly_client.rb b/lib/gitlab/gitaly_client.rb index 550294916a4..36e9adf27da 100644 --- a/lib/gitlab/gitaly_client.rb +++ b/lib/gitlab/gitaly_client.rb @@ -191,6 +191,8 @@ module Gitlab metadata['call_site'] = feature.to_s if feature metadata['gitaly-servers'] = address_metadata(remote_storage) if remote_storage + metadata.merge!(server_feature_flags) + result = { metadata: metadata } # nil timeout indicates that we should use the default @@ -209,6 +211,14 @@ module Gitlab result end + SERVER_FEATURE_FLAGS = %w[gogit_findcommit].freeze + + def self.server_feature_flags + SERVER_FEATURE_FLAGS.map do |f| + ["gitaly-feature-#{f.tr('_', '-')}", feature_enabled?(f).to_s] + end.to_h + end + def self.token(storage) params = Gitlab.config.repositories.storages[storage] raise "storage not found: #{storage.inspect}" if params.nil? @@ -243,6 +253,10 @@ module Gitlab else false end + rescue => ex + # During application startup feature lookups in SQL can fail + Rails.logger.warn "exception while checking Gitaly feature status for #{feature_name}: #{ex}" + false end # opt_into_all_features? returns true when the current environment |