From 7d02292a447b815074b0844e8a69593e5f859fc2 Mon Sep 17 00:00:00 2001 From: Zeger-Jan van de Weg Date: Wed, 14 Mar 2018 10:33:41 +0100 Subject: [PATCH] Set Gitlab::Shell#create_repository as OPT_OUT On .com repositories are created through Gitaly for a while now. For customers this is not the case unless these have chosen to do so through feature flags. By moving this to opt out, everyone will be using this. This move is part of the migration issue https://gitlab.com/gitlab-org/gitaly/issues/593 The bigger impact this commit will have is that tests that use a repository through `FactoryBot.create(:project, :repository)` will now use Gitaly to do so. As tests run on the same disk, or at least machine, this will most probably slow them down. --- lib/gitlab/shell.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/gitlab/shell.rb b/lib/gitlab/shell.rb index 7cc4efd3436..3a8f5826818 100644 --- a/lib/gitlab/shell.rb +++ b/lib/gitlab/shell.rb @@ -75,7 +75,8 @@ module Gitlab relative_path = name.dup relative_path << '.git' unless relative_path.end_with?('.git') - gitaly_migrate(:create_repository) do |is_enabled| + gitaly_migrate(:create_repository, + status: Gitlab::GitalyClient::MigrationStatus::OPT_OUT) do |is_enabled| if is_enabled repository = Gitlab::Git::Repository.new(storage, relative_path, '') repository.gitaly_repository_client.create_repository @@ -85,7 +86,7 @@ module Gitlab Gitlab::Git::Repository.create(repo_path, bare: true, symlink_hooks_to: gitlab_shell_hooks_path) end end - rescue => err + rescue => err # Once the Rugged codes gets removes this can be improved Rails.logger.error("Failed to add repository #{storage}/#{name}: #{err}") false end @@ -487,8 +488,8 @@ module Gitlab Gitlab.config.gitlab_shell.git_timeout end - def gitaly_migrate(method, &block) - Gitlab::GitalyClient.migrate(method, &block) + def gitaly_migrate(method, status: Gitlab::GitalyClient::MigrationStatus::OPT_IN, &block) + Gitlab::GitalyClient.migrate(method, status: status, &block) rescue GRPC::NotFound, GRPC::BadStatus => e # Old Popen code returns [Error, output] to the caller, so we # need to do the same here...