diff options
author | James Fargher <proglottis@gmail.com> | 2022-02-22 03:12:17 +0300 |
---|---|---|
committer | James Fargher <proglottis@gmail.com> | 2022-02-22 03:12:17 +0300 |
commit | c1cabced28d02d667a37122860adde10068d28e2 (patch) | |
tree | ca1f204777b5d532c335e7d92139106e27b7f1c6 | |
parent | ad76c4bd99833148140d5c08b7258363e5163b9c (diff) | |
parent | 4d2b09ee71645d2c7554ad617305bca1aaef1bd9 (diff) |
Merge branch 'pks-git-remove-ruby-hooks' into 'master'
git: Remove support for the Ruby hooks directory
Closes #4006
See merge request gitlab-org/gitaly!4356
-rwxr-xr-x | _support/test-boot | 7 | ||||
-rw-r--r-- | cmd/gitaly-hooks/hooks.go | 22 | ||||
-rw-r--r-- | cmd/gitaly-hooks/hooks_test.go | 48 | ||||
-rw-r--r-- | doc/hooks.md | 5 | ||||
-rw-r--r-- | internal/git/command_factory.go | 29 | ||||
-rw-r--r-- | internal/git/command_factory_test.go | 140 | ||||
-rw-r--r-- | internal/git/hooks_options.go | 1 | ||||
-rw-r--r-- | internal/git/hooks_options_test.go | 1 | ||||
-rw-r--r-- | internal/metadata/featureflag/ff_hooks_in_tempdir.go | 5 | ||||
-rw-r--r-- | internal/testhelper/testhelper.go | 3 | ||||
-rwxr-xr-x | ruby/git-hooks/gitlab-shell-hook | 5 | ||||
l--------- | ruby/git-hooks/post-receive | 1 | ||||
l--------- | ruby/git-hooks/pre-receive | 1 | ||||
l--------- | ruby/git-hooks/reference-transaction | 1 | ||||
l--------- | ruby/git-hooks/update | 1 | ||||
-rw-r--r-- | ruby/lib/gitlab/git/hook.rb | 1 |
16 files changed, 51 insertions, 220 deletions
diff --git a/_support/test-boot b/_support/test-boot index cf9b40ed5..4a9be6709 100755 --- a/_support/test-boot +++ b/_support/test-boot @@ -21,7 +21,10 @@ def main(gitaly_dir) Dir.mktmpdir do |dir| Dir.chdir(dir) - File.write(File.join("#{gitaly_dir}/ruby/git-hooks", '.gitlab_shell_secret'), 'test_gitlab_shell_token') + + gitlab_shell_dir = File.join(dir, 'gitlab-shell') + Dir.mkdir(gitlab_shell_dir) + File.write(File.join(gitlab_shell_dir, '.gitlab_shell_secret'), 'test_gitlab_shell_token') File.write('config.toml', <<~CONFIG socket_path = "#{ADDR}" @@ -38,7 +41,7 @@ def main(gitaly_dir) dir = "#{gitaly_dir}/ruby" [gitlab-shell] - dir = "#{gitaly_dir}/ruby/git-hooks" + dir = "#{gitlab_shell_dir}" [gitlab] url = 'http://gitlab_url' diff --git a/cmd/gitaly-hooks/hooks.go b/cmd/gitaly-hooks/hooks.go index 8f4c102bd..16021c4e5 100644 --- a/cmd/gitaly-hooks/hooks.go +++ b/cmd/gitaly-hooks/hooks.go @@ -58,10 +58,6 @@ var hooksBySubcommand = map[string]hookCommand{ exec: referenceTransactionHook, hookType: git.ReferenceTransactionHook, }, - "git": { - exec: packObjectsHook, - hookType: git.PackObjectsHook, - }, } func main() { @@ -90,7 +86,8 @@ func run(args []string) error { subCmd := args[1] - if subCmd == "check" { + switch subCmd { + case "check": logrus.SetLevel(logrus.ErrorLevel) if len(args) != 3 { fmt.Fprint(os.Stderr, "no configuration file path provided invoke with: gitaly-hooks check <config_path>") @@ -115,17 +112,14 @@ func run(args []string) error { fmt.Println("OK") return nil + case "git": + return executeHook(hookCommand{ + exec: packObjectsHook, + hookType: git.PackObjectsHook, + }, args[2:]) } - // This exists for backwards-compatibility reasons only and should be removed in - // v14.9 such that we always use the zeroth argument to derive the hook that we - // shall execute. - hookCommand, ok := hooksBySubcommand[subCmd] - if !ok { - return fmt.Errorf("subcommand name invalid: %q", subCmd) - } - - return executeHook(hookCommand, args[2:]) + return fmt.Errorf("subcommand name invalid: %q", subCmd) default: hookName := filepath.Base(args[0]) hookCommand, ok := hooksBySubcommand[hookName] diff --git a/cmd/gitaly-hooks/hooks_test.go b/cmd/gitaly-hooks/hooks_test.go index 5f9c660b0..2a529366c 100644 --- a/cmd/gitaly-hooks/hooks_test.go +++ b/cmd/gitaly-hooks/hooks_test.go @@ -67,7 +67,6 @@ func envForHooks(t testing.TB, ctx context.Context, cfg config.Cfg, repo *gitaly env := append(command.AllowedEnvironment(os.Environ()), []string{ payload, - "GITALY_BIN_DIR=" + cfg.BinDir, fmt.Sprintf("%s=%s", gitalylog.GitalyLogDirEnvKey, cfg.Logging.Dir), }...) env = append(env, gitPushOptions...) @@ -162,6 +161,8 @@ func testHooksPrePostReceive(t *testing.T, cfg config.Cfg, repo *gitalypb.Reposi cfg.Gitlab.HTTPSettings.User = gitlabUser cfg.Gitlab.HTTPSettings.Password = gitlabPassword + gitalyHooksPath := filepath.Join(cfg.BinDir, "gitaly-hooks") + gitlabClient, err := gitlab.NewHTTPClient(logger, cfg.Gitlab, cfg.TLS, prometheus.Config{}) require.NoError(t, err) @@ -178,9 +179,9 @@ func testHooksPrePostReceive(t *testing.T, cfg config.Cfg, repo *gitalypb.Reposi var stderr, stdout bytes.Buffer stdin := bytes.NewBuffer([]byte(changes)) - hookPath, err := filepath.Abs(fmt.Sprintf("../../ruby/git-hooks/%s", hookName)) require.NoError(t, err) - cmd := exec.Command(hookPath) + cmd := exec.Command(gitalyHooksPath) + cmd.Args = []string{hookName} cmd.Stderr = &stderr cmd.Stdout = &stdout cmd.Stdin = stdin @@ -276,9 +277,9 @@ func testHooksUpdate(t *testing.T, ctx context.Context, cfg config.Cfg, glValues repo, repoPath := gittest.CloneRepo(t, cfg, cfg.Storages[0]) refval, oldval, newval := "refval", strings.Repeat("a", 40), strings.Repeat("b", 40) - updateHookPath, err := filepath.Abs("../../ruby/git-hooks/update") - require.NoError(t, err) - cmd := exec.Command(updateHookPath, refval, oldval, newval) + + cmd := exec.Command(filepath.Join(cfg.BinDir, "gitaly-hooks")) + cmd.Args = []string{"update", refval, oldval, newval} cmd.Env = envForHooks(t, ctx, cfg, repo, glValues, proxyValues{}) cmd.Dir = repoPath @@ -330,7 +331,7 @@ func TestHooksPostReceiveFailed(t *testing.T) { logger, _ := test.NewNullLogger() cfg, repo, repoPath := testcfg.BuildWithRepo(t, testcfg.WithBase(config.Cfg{Auth: auth.Config{Token: "abc123"}})) - testcfg.BuildGitalyHooks(t, cfg) + gitalyHooksPath := testcfg.BuildGitalyHooks(t, cfg) testcfg.BuildGitalySSH(t, cfg) // By setting the last parameter to false, the post-receive API call will @@ -361,9 +362,6 @@ func TestHooksPostReceiveFailed(t *testing.T) { var stdout, stderr bytes.Buffer - postReceiveHookPath, err := filepath.Abs("../../ruby/git-hooks/post-receive") - require.NoError(t, err) - testcases := []struct { desc string primary bool @@ -422,7 +420,8 @@ func TestHooksPostReceiveFailed(t *testing.T) { env := envForHooks(t, ctx, cfg, repo, glHookValues{}, proxyValues{}) env = append(env, hooksPayload) - cmd := exec.Command(postReceiveHookPath) + cmd := exec.Command(gitalyHooksPath) + cmd.Args = []string{"post-receive"} cmd.Env = env cmd.Stdout = &stdout cmd.Stderr = &stderr @@ -444,7 +443,7 @@ func TestHooksNotAllowed(t *testing.T) { logger, _ := test.NewNullLogger() cfg, repo, repoPath := testcfg.BuildWithRepo(t, testcfg.WithBase(config.Cfg{Auth: auth.Config{Token: "abc123"}})) - testcfg.BuildGitalyHooks(t, cfg) + gitalyHooksPath := testcfg.BuildGitalyHooks(t, cfg) testcfg.BuildGitalySSH(t, cfg) c := gitlab.TestServerOptions{ @@ -473,9 +472,8 @@ func TestHooksNotAllowed(t *testing.T) { var stderr, stdout bytes.Buffer ctx := testhelper.Context(t) - preReceiveHookPath, err := filepath.Abs("../../ruby/git-hooks/pre-receive") - require.NoError(t, err) - cmd := exec.Command(preReceiveHookPath) + cmd := exec.Command(gitalyHooksPath) + cmd.Args = []string{"pre-receive"} cmd.Stderr = &stderr cmd.Stdout = &stdout cmd.Stdin = strings.NewReader(changes) @@ -688,14 +686,14 @@ func TestGitalyHooksPackObjects(t *testing.T) { } func TestRequestedHooks(t *testing.T) { - for hook, hookName := range map[git.Hook]string{ - git.ReferenceTransactionHook: "reference-transaction", - git.UpdateHook: "update", - git.PreReceiveHook: "pre-receive", - git.PostReceiveHook: "post-receive", - git.PackObjectsHook: "git", + for hook, hookArgs := range map[git.Hook][]string{ + git.ReferenceTransactionHook: {"reference-transaction"}, + git.UpdateHook: {"update"}, + git.PreReceiveHook: {"pre-receive"}, + git.PostReceiveHook: {"post-receive"}, + git.PackObjectsHook: {"gitaly-hooks", "git"}, } { - t.Run(hookName, func(t *testing.T) { + t.Run(hookArgs[0], func(t *testing.T) { t.Run("unrequested hook is ignored", func(t *testing.T) { cfg := testcfg.Build(t) testcfg.BuildGitalyHooks(t, cfg) @@ -704,7 +702,8 @@ func TestRequestedHooks(t *testing.T) { payload, err := git.NewHooksPayload(cfg, &gitalypb.Repository{}, nil, nil, git.AllHooks&^hook, nil).Env() require.NoError(t, err) - cmd := exec.Command(filepath.Join(cfg.BinDir, "gitaly-hooks"), hookName) + cmd := exec.Command(filepath.Join(cfg.BinDir, "gitaly-hooks")) + cmd.Args = hookArgs cmd.Env = []string{payload} require.NoError(t, cmd.Run()) }) @@ -717,7 +716,8 @@ func TestRequestedHooks(t *testing.T) { payload, err := git.NewHooksPayload(cfg, &gitalypb.Repository{}, nil, nil, hook, nil).Env() require.NoError(t, err) - cmd := exec.Command(filepath.Join(cfg.BinDir, "gitaly-hooks"), hookName) + cmd := exec.Command(filepath.Join(cfg.BinDir, "gitaly-hooks")) + cmd.Args = hookArgs cmd.Env = []string{payload} // We simply check that there is an error here as an indicator that diff --git a/doc/hooks.md b/doc/hooks.md index 9dc8701f7..e1afd7bdf 100644 --- a/doc/hooks.md +++ b/doc/hooks.md @@ -16,8 +16,6 @@ We inject some information into Git commands to set up the hook execution environment for both Git and ourselves so that the `gitaly-hooks` executable is able to derive required information: -- We inject `GITALY_BIN_DIR`, which points to Gitaly's binary directory. This is - used to locate the `gitaly-hooks` binary. - We inject the `core.hooksPath` config entry, which points to the directory containing our global hooks. Global hooks are set up as a temporary directory containing symlinks to a wrapper script which is able to locato the @@ -39,8 +37,7 @@ information to connect to Gitaly and execute the respective RPC call. The execution path is: 1. Git locates the hook using `core.hooksPath`. If found, this is a symlink - pointing to the wrapper script which is able to locate `gitaly-hooks`. -1. The wrapper script executes `gitaly-hooks`. + which points to the `gitaly-hooks` executable. 1. `gitaly-hooks` connects to Gitaly and executes the corresponding RPC call in Gitaly, passing along any hook-specific information to the RPC. 1. Gitaly performs the hook-specific logic in the RPC handler. diff --git a/internal/git/command_factory.go b/internal/git/command_factory.go index 2ffe61596..197f7b859 100644 --- a/internal/git/command_factory.go +++ b/internal/git/command_factory.go @@ -7,7 +7,6 @@ import ( "os" "os/exec" "path/filepath" - "strings" "sync" "github.com/prometheus/client_golang/prometheus" @@ -20,7 +19,6 @@ import ( "gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/storage" "gitlab.com/gitlab-org/gitaly/v14/internal/log" "gitlab.com/gitlab-org/gitaly/v14/internal/metadata/featureflag" - "golang.org/x/sys/unix" ) var globalOptions = []GlobalOption{ @@ -105,7 +103,6 @@ func WithGitBinaryPath(path string) ExecCommandFactoryOption { } type hookDirectories struct { - rubyHooksPath string tempHooksPath string } @@ -357,39 +354,16 @@ func (cf *ExecCommandFactory) GetExecutionEnvironment(ctx context.Context) Execu // HooksPath returns the path where Gitaly's Git hooks reside. func (cf *ExecCommandFactory) HooksPath(ctx context.Context) string { - if featureflag.HooksInTempdir.IsEnabled(ctx) { - return cf.hookDirs.tempHooksPath - } - return cf.hookDirs.rubyHooksPath + return cf.hookDirs.tempHooksPath } func setupHookDirectories(cfg config.Cfg, factoryCfg execCommandFactoryConfig) (hookDirectories, func(), error) { if factoryCfg.hooksPath != "" { return hookDirectories{ - rubyHooksPath: factoryCfg.hooksPath, tempHooksPath: factoryCfg.hooksPath, }, func() {}, nil } - // The old and now-deprecated location of Gitaly's hooks is in the Ruby directory. - rubyHooksPath := filepath.Join(cfg.Ruby.Dir, "git-hooks") - - var errs []string - for _, hookName := range []string{"pre-receive", "post-receive", "update"} { - hookPath := filepath.Join(rubyHooksPath, hookName) - if err := unix.Access(hookPath, unix.X_OK); err != nil { - if errors.Is(err, os.ErrPermission) { - errs = append(errs, fmt.Sprintf("not executable: %v", hookPath)) - } else { - errs = append(errs, err.Error()) - } - } - } - - if len(errs) > 0 { - return hookDirectories{}, nil, fmt.Errorf(strings.Join(errs, ", ")) - } - if cfg.BinDir == "" { return hookDirectories{}, nil, errors.New("binary directory required to set up hooks") } @@ -411,7 +385,6 @@ func setupHookDirectories(cfg config.Cfg, factoryCfg execCommandFactoryConfig) ( } return hookDirectories{ - rubyHooksPath: rubyHooksPath, tempHooksPath: tempHooksPath, }, func() { if err := os.RemoveAll(tempHooksPath); err != nil { diff --git a/internal/git/command_factory_test.go b/internal/git/command_factory_test.go index 0ee033562..385d21459 100644 --- a/internal/git/command_factory_test.go +++ b/internal/git/command_factory_test.go @@ -2,7 +2,6 @@ package git_test import ( "bytes" - "context" "errors" "fmt" "io" @@ -18,7 +17,6 @@ import ( "gitlab.com/gitlab-org/gitaly/v14/internal/git/gittest" "gitlab.com/gitlab-org/gitaly/v14/internal/gitaly/config" "gitlab.com/gitlab-org/gitaly/v14/internal/helper/text" - "gitlab.com/gitlab-org/gitaly/v14/internal/metadata/featureflag" "gitlab.com/gitlab-org/gitaly/v14/internal/testhelper" "gitlab.com/gitlab-org/gitaly/v14/internal/testhelper/testcfg" ) @@ -263,44 +261,26 @@ func TestCommandFactory_ExecutionEnvironment(t *testing.T) { }) } -func TestExecCommandFatcory_HooksPath(t *testing.T) { - testhelper.NewFeatureSets(featureflag.HooksInTempdir).Run(t, func(t *testing.T, ctx context.Context) { - testExecCommandFactoryHooksPath(t, ctx) - }) -} - -func testExecCommandFactoryHooksPath(t *testing.T, ctx context.Context) { - hookDir := setupTempHookDirs(t, map[string]hookFileMode{ - "ruby/git-hooks/update": hookFileExists | hookFileExecutable, - "ruby/git-hooks/pre-receive": hookFileExists | hookFileExecutable, - "ruby/git-hooks/post-receive": hookFileExists | hookFileExecutable, - }) - rubyDir := filepath.Join(hookDir, "ruby") +func TestExecCommandFactoryHooksPath(t *testing.T) { + ctx := testhelper.Context(t) - t.Run("Ruby directory", func(t *testing.T) { + t.Run("temporary hooks", func(t *testing.T) { cfg := config.Cfg{ - Ruby: config.Ruby{ - Dir: rubyDir, - }, BinDir: testhelper.TempDir(t), } t.Run("no overrides", func(t *testing.T) { gitCmdFactory := gittest.NewCommandFactory(t, cfg) - if featureflag.HooksInTempdir.IsEnabled(ctx) { - hooksPath := gitCmdFactory.HooksPath(ctx) - - // We cannot assert that the hooks path is equal to any specific - // string, but instead we can assert that it exists and contains the - // symlinks we expect. - for _, hook := range []string{"update", "pre-receive", "post-receive", "reference-transaction"} { - target, err := os.Readlink(filepath.Join(hooksPath, hook)) - require.NoError(t, err) - require.Equal(t, filepath.Join(cfg.BinDir, "gitaly-hooks"), target) - } - } else { - require.Equal(t, filepath.Join(rubyDir, "git-hooks"), gitCmdFactory.HooksPath(ctx)) + hooksPath := gitCmdFactory.HooksPath(ctx) + + // We cannot assert that the hooks path is equal to any specific + // string, but instead we can assert that it exists and contains the + // symlinks we expect. + for _, hook := range []string{"update", "pre-receive", "post-receive", "reference-transaction"} { + target, err := os.Readlink(filepath.Join(hooksPath, hook)) + require.NoError(t, err) + require.Equal(t, filepath.Join(cfg.BinDir, "gitaly-hooks"), target) } }) @@ -313,9 +293,6 @@ func testExecCommandFactoryHooksPath(t *testing.T, ctx context.Context) { t.Run("hooks path", func(t *testing.T) { gitCmdFactory := gittest.NewCommandFactory(t, config.Cfg{ BinDir: testhelper.TempDir(t), - Ruby: config.Ruby{ - Dir: rubyDir, - }, }, git.WithHooksPath("/hooks/path")) // The environment variable shouldn't override an explicitly set hooks path. @@ -323,99 +300,6 @@ func testExecCommandFactoryHooksPath(t *testing.T, ctx context.Context) { }) } -type hookFileMode int - -const ( - hookFileExists hookFileMode = 1 << (4 - 1 - iota) - hookFileExecutable -) - -func setupTempHookDirs(t *testing.T, m map[string]hookFileMode) string { - tempDir := testhelper.TempDir(t) - - for hookName, mode := range m { - if mode&hookFileExists > 0 { - path := filepath.Join(tempDir, hookName) - require.NoError(t, os.MkdirAll(filepath.Dir(path), 0o755)) - - require.NoError(t, os.WriteFile(filepath.Join(tempDir, hookName), nil, 0o644)) - - if mode&hookFileExecutable > 0 { - require.NoError(t, os.Chmod(filepath.Join(tempDir, hookName), 0o755)) - } - } - } - - return tempDir -} - -var ( - fileNotExistsErrRegexSnippit = "no such file or directory" - fileNotExecutableRegexSnippit = "not executable: .*" -) - -func TestExecCommandFactory_ValidateHooks(t *testing.T) { - testCases := []struct { - desc string - expectedErrRegex string - hookFiles map[string]hookFileMode - }{ - { - desc: "everything is ✅", - hookFiles: map[string]hookFileMode{ - "ruby/git-hooks/update": hookFileExists | hookFileExecutable, - "ruby/git-hooks/pre-receive": hookFileExists | hookFileExecutable, - "ruby/git-hooks/post-receive": hookFileExists | hookFileExecutable, - }, - expectedErrRegex: "", - }, - { - desc: "missing git-hooks", - hookFiles: map[string]hookFileMode{ - "ruby/git-hooks/update": 0, - "ruby/git-hooks/pre-receive": 0, - "ruby/git-hooks/post-receive": 0, - }, - expectedErrRegex: fmt.Sprintf("%s, %s, %s", fileNotExistsErrRegexSnippit, fileNotExistsErrRegexSnippit, fileNotExistsErrRegexSnippit), - }, - { - desc: "git-hooks are not executable", - hookFiles: map[string]hookFileMode{ - "ruby/git-hooks/update": hookFileExists, - "ruby/git-hooks/pre-receive": hookFileExists, - "ruby/git-hooks/post-receive": hookFileExists, - }, - expectedErrRegex: fmt.Sprintf("%s, %s, %s", fileNotExecutableRegexSnippit, fileNotExecutableRegexSnippit, fileNotExecutableRegexSnippit), - }, - } - - for _, tc := range testCases { - t.Run(tc.desc, func(t *testing.T) { - tempHookDir := setupTempHookDirs(t, tc.hookFiles) - - _, cleanup, err := git.NewExecCommandFactory(config.Cfg{ - Ruby: config.Ruby{ - Dir: filepath.Join(tempHookDir, "ruby"), - }, - GitlabShell: config.GitlabShell{ - Dir: filepath.Join(tempHookDir, "/gitlab-shell"), - }, - BinDir: testhelper.TempDir(t), - }) - if err == nil { - defer cleanup() - } - - if tc.expectedErrRegex != "" { - require.Error(t, err) - require.Regexp(t, tc.expectedErrRegex, err.Error(), "error should match regexp") - } else { - require.NoError(t, err) - } - }) - } -} - func TestExecCommandFactory_GitVersion(t *testing.T) { ctx := testhelper.Context(t) diff --git a/internal/git/hooks_options.go b/internal/git/hooks_options.go index 8d57f9777..85feeb1a9 100644 --- a/internal/git/hooks_options.go +++ b/internal/git/hooks_options.go @@ -103,7 +103,6 @@ func (cc *cmdCfg) configureHooks( cc.env = append( cc.env, payload, - "GITALY_BIN_DIR="+cfg.BinDir, fmt.Sprintf("%s=%s", log.GitalyLogDirEnvKey, cfg.Logging.Dir), ) diff --git a/internal/git/hooks_options_test.go b/internal/git/hooks_options_test.go index 880f3dc68..17e7b02f1 100644 --- a/internal/git/hooks_options_test.go +++ b/internal/git/hooks_options_test.go @@ -50,7 +50,6 @@ func TestWithRefHook(t *testing.T) { require.EqualValues(t, []string{ "GITALY_HOOKS_PAYLOAD", - "GITALY_BIN_DIR", "GITALY_LOG_DIR", }, actualEnvVars) }) diff --git a/internal/metadata/featureflag/ff_hooks_in_tempdir.go b/internal/metadata/featureflag/ff_hooks_in_tempdir.go deleted file mode 100644 index b40dab2ca..000000000 --- a/internal/metadata/featureflag/ff_hooks_in_tempdir.go +++ /dev/null @@ -1,5 +0,0 @@ -package featureflag - -// HooksInTempdir switches away from Ruby hooks to hooks stored in a temporary directory. Every -// hook is simply a symlink to the gitaly-hooks binary. -var HooksInTempdir = NewFeatureFlag("hooks_in_tempdir", true) diff --git a/internal/testhelper/testhelper.go b/internal/testhelper/testhelper.go index d42e1e6a9..d279b1b4e 100644 --- a/internal/testhelper/testhelper.go +++ b/internal/testhelper/testhelper.go @@ -202,9 +202,6 @@ func ContextWithoutCancel(opts ...ContextOpt) context.Context { // ConcurrencyQueueMaxWait is in the codepath of every RPC call since it's in the limithandler // middleware. ctx = featureflag.ContextWithFeatureFlag(ctx, featureflag.ConcurrencyQueueMaxWait, true) - // We use hook directories everywhere, so it's infeasible to test this on a global - // scale. Instead, we use it randomly. - ctx = featureflag.ContextWithFeatureFlag(ctx, featureflag.HooksInTempdir, mrand.Int()%2 == 0) // We support using both bundled and non-bundled Git, which can be toggled via a feature // flag if both are configured. Naturally, this kicks in whenever we spawn a Git command, // and thus it's not feasible to inject the feature flag everywhere. Instead, we just use diff --git a/ruby/git-hooks/gitlab-shell-hook b/ruby/git-hooks/gitlab-shell-hook deleted file mode 100755 index ae98a1b12..000000000 --- a/ruby/git-hooks/gitlab-shell-hook +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -# This is the single source of truth for where Gitaly's embedded Git hooks are. -exec "$GITALY_BIN_DIR/gitaly-hooks" "$(basename $0)" "$@" - diff --git a/ruby/git-hooks/post-receive b/ruby/git-hooks/post-receive deleted file mode 120000 index 3c6ac8d8c..000000000 --- a/ruby/git-hooks/post-receive +++ /dev/null @@ -1 +0,0 @@ -gitlab-shell-hook
\ No newline at end of file diff --git a/ruby/git-hooks/pre-receive b/ruby/git-hooks/pre-receive deleted file mode 120000 index 3c6ac8d8c..000000000 --- a/ruby/git-hooks/pre-receive +++ /dev/null @@ -1 +0,0 @@ -gitlab-shell-hook
\ No newline at end of file diff --git a/ruby/git-hooks/reference-transaction b/ruby/git-hooks/reference-transaction deleted file mode 120000 index 3c6ac8d8c..000000000 --- a/ruby/git-hooks/reference-transaction +++ /dev/null @@ -1 +0,0 @@ -gitlab-shell-hook
\ No newline at end of file diff --git a/ruby/git-hooks/update b/ruby/git-hooks/update deleted file mode 120000 index 3c6ac8d8c..000000000 --- a/ruby/git-hooks/update +++ /dev/null @@ -1 +0,0 @@ -gitlab-shell-hook
\ No newline at end of file diff --git a/ruby/lib/gitlab/git/hook.rb b/ruby/lib/gitlab/git/hook.rb index a41df57d3..58c99503c 100644 --- a/ruby/lib/gitlab/git/hook.rb +++ b/ruby/lib/gitlab/git/hook.rb @@ -132,7 +132,6 @@ module Gitlab { 'GITALY_HOOKS_PAYLOAD' => hooks_payload(gl_id, gl_username, transaction), 'GITALY_LOG_DIR' => Gitlab.config.logging.dir, - 'GITALY_BIN_DIR' => Gitlab.config.gitaly.bin_dir, 'PWD' => repo_path, 'GIT_DIR' => repo_path } |