diff options
author | Zeger-Jan van de Weg <git@zjvandeweg.nl> | 2018-03-14 10:33:41 +0100 |
---|---|---|
committer | Zeger-Jan van de Weg <git@zjvandeweg.nl> | 2018-03-14 10:59:40 +0100 |
commit | 7d02292a447b815074b0844e8a69593e5f859fc2 (patch) | |
tree | 47c75049a0559de88be2b1da1e63820a020d99bc | |
parent | 77f0906e4cc406ea04de60c92377487b5a04e501 (diff) | |
download | gitlab-ce-7d02292a447b815074b0844e8a69593e5f859fc2.tar.gz |
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.
-rw-r--r-- | lib/gitlab/shell.rb | 9 |
1 files 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... |