Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Vosmaer <jacob@gitlab.com>2019-08-13 13:50:55 +0300
committerJacob Vosmaer <jacob@gitlab.com>2019-08-13 13:50:55 +0300
commit8cc7033e971a0fe001603f695dc02feae7ac34ec (patch)
tree571ba0b53ee9cefd2b831ec9f462a8b0f78f2180
parent5c87e18a7141fabf0ff9022a78becb4f75e9bc84 (diff)
parent27167864d378a9244b573eb96adf326bba5b1e21 (diff)
Merge branch 'jc-restore-old-hook-env-var' into 'master'
Add back old env vars for backwards compatibility Closes #1771 See merge request gitlab-org/gitaly!1367
-rw-r--r--changelogs/unreleased/jc-restore-old-hook-env-var.yml5
-rw-r--r--internal/gitlabshell/env.go1
-rw-r--r--ruby/gitlab-shell/lib/gitlab_init.rb3
-rw-r--r--ruby/lib/gitlab/config.rb2
-rw-r--r--ruby/lib/gitlab/git/hook.rb1
-rw-r--r--ruby/spec/lib/gitlab/config_spec.rb18
6 files changed, 25 insertions, 5 deletions
diff --git a/changelogs/unreleased/jc-restore-old-hook-env-var.yml b/changelogs/unreleased/jc-restore-old-hook-env-var.yml
new file mode 100644
index 000000000..5648f6f6d
--- /dev/null
+++ b/changelogs/unreleased/jc-restore-old-hook-env-var.yml
@@ -0,0 +1,5 @@
+---
+title: Add back old env vars for backwards compatibility
+merge_request: 1367
+author:
+type: other
diff --git a/internal/gitlabshell/env.go b/internal/gitlabshell/env.go
index a0b8873ed..f3ff7bf73 100644
--- a/internal/gitlabshell/env.go
+++ b/internal/gitlabshell/env.go
@@ -11,5 +11,6 @@ func Env() []string {
"GITALY_LOG_DIR=" + cfg.Logging.Dir,
"GITALY_LOG_FORMAT=" + cfg.Logging.Format,
"GITALY_LOG_LEVEL=" + cfg.Logging.Level,
+ "GITLAB_SHELL_DIR=" + cfg.GitlabShell.Dir, //GITLAB_SHELL_DIR has been deprecated
}
}
diff --git a/ruby/gitlab-shell/lib/gitlab_init.rb b/ruby/gitlab-shell/lib/gitlab_init.rb
index 8dc50567a..ce54e2d45 100644
--- a/ruby/gitlab-shell/lib/gitlab_init.rb
+++ b/ruby/gitlab-shell/lib/gitlab_init.rb
@@ -1,4 +1,5 @@
-ROOT_PATH = ENV.fetch('GITALY_GITLAB_SHELL_DIR', File.expand_path('..', __dir__))
+# GITLAB_SHELL_DIR has been deprecated
+ROOT_PATH = ENV['GITALY_GITLAB_SHELL_DIR'] || ENV['GITLAB_SHELL_DIR'] || File.expand_path('..', __dir__)
LOG_PATH = ENV.fetch('GITALY_LOG_DIR', "")
LOG_LEVEL = ENV.fetch('GITALY_LOG_LEVEL', "")
LOG_FORMAT = ENV.fetch('GITALY_LOG_FORMAT', "")
diff --git a/ruby/lib/gitlab/config.rb b/ruby/lib/gitlab/config.rb
index 8d32924af..91ab1d741 100644
--- a/ruby/lib/gitlab/config.rb
+++ b/ruby/lib/gitlab/config.rb
@@ -41,7 +41,7 @@ module Gitlab
include TestSetup
def path
- @path ||= ENV['GITALY_GITLAB_SHELL_DIR']
+ @path ||= ENV['GITLAB_SHELL_DIR'] || ENV['GITALY_GITLAB_SHELL_DIR']
end
def git_timeout
diff --git a/ruby/lib/gitlab/git/hook.rb b/ruby/lib/gitlab/git/hook.rb
index a60f30001..3691f8639 100644
--- a/ruby/lib/gitlab/git/hook.rb
+++ b/ruby/lib/gitlab/git/hook.rb
@@ -103,6 +103,7 @@ module Gitlab
def env_base_vars(gl_id, gl_username)
{
'GITALY_GITLAB_SHELL_DIR' => Gitlab.config.gitlab_shell.path,
+ 'GITLAB_SHELL_DIR' => Gitlab.config.gitlab_shell.path,
'GITALY_LOG_DIR' => Gitlab.config.logging.dir,
'GITALY_LOG_LEVEL' => Gitlab.config.logging.level,
'GITALY_LOG_FORMAT' => Gitlab.config.logging.format,
diff --git a/ruby/spec/lib/gitlab/config_spec.rb b/ruby/spec/lib/gitlab/config_spec.rb
index c7de3caa1..7652ba278 100644
--- a/ruby/spec/lib/gitlab/config_spec.rb
+++ b/ruby/spec/lib/gitlab/config_spec.rb
@@ -6,10 +6,22 @@ describe Gitlab::Config do
let(:gitlab_shell_path) { '/foo/bar/gitlab-shell' }
- before do
- allow(ENV).to receive(:[]).with('GITALY_GITLAB_SHELL_DIR').and_return(gitlab_shell_path)
+ context 'when GITALY_GITLAB_SHELL_DIR is set' do
+ before do
+ allow(ENV).to receive(:[]).with('GITALY_GITLAB_SHELL_DIR').and_return(gitlab_shell_path)
+ allow(ENV).to receive(:[]).with('GITLAB_SHELL_DIR').and_return(nil)
+ end
+
+ it { expect(subject.path).to eq(gitlab_shell_path) }
end
- it { expect(subject.path).to eq(gitlab_shell_path) }
+ context 'when GITLAB_SHELL_DIR is set' do
+ before do
+ allow(ENV).to receive(:[]).with('GITALY_GITLAB_SHELL_DIR').and_return(nil)
+ allow(ENV).to receive(:[]).with('GITLAB_SHELL_DIR').and_return(gitlab_shell_path)
+ end
+
+ it { expect(subject.path).to eq(gitlab_shell_path) }
+ end
end
end