diff options
author | Paul Okstad <pokstad@gitlab.com> | 2020-11-05 20:21:25 +0300 |
---|---|---|
committer | Paul Okstad <pokstad@gitlab.com> | 2020-11-10 10:46:54 +0300 |
commit | 979310dc58d6bfeb93a7ec40b6ab2e9bcd17efcd (patch) | |
tree | 0a330c16a1dccb360483b5da7a3b5efa66f57ef4 | |
parent | 97119621a83292e10060785c43bd00ceffdef53b (diff) |
Add ref hooks to SSH receive-pack
3 files changed, 16 insertions, 4 deletions
diff --git a/internal/gitaly/service/repository/testdata/gitlab-shell/.gitlab_shell_secret b/internal/gitaly/service/repository/testdata/gitlab-shell/.gitlab_shell_secret new file mode 100644 index 000000000..4ba7b338f --- /dev/null +++ b/internal/gitaly/service/repository/testdata/gitlab-shell/.gitlab_shell_secret @@ -0,0 +1 @@ +topsecret
\ No newline at end of file diff --git a/internal/gitaly/service/repository/testdata/gitlab-shell/config.yml b/internal/gitaly/service/repository/testdata/gitlab-shell/config.yml new file mode 100644 index 000000000..2f6376588 --- /dev/null +++ b/internal/gitaly/service/repository/testdata/gitlab-shell/config.yml @@ -0,0 +1,5 @@ +gitlab_url: http://127.0.0.1:51256 +http_settings: + user: "" + password: "" +custom_hooks_dir: "" diff --git a/internal/gitaly/service/ssh/receive_pack.go b/internal/gitaly/service/ssh/receive_pack.go index 4d62adaf0..d949eeb87 100644 --- a/internal/gitaly/service/ssh/receive_pack.go +++ b/internal/gitaly/service/ssh/receive_pack.go @@ -9,6 +9,7 @@ import ( log "github.com/sirupsen/logrus" "gitlab.com/gitlab-org/gitaly/internal/command" "gitlab.com/gitlab-org/gitaly/internal/git" + "gitlab.com/gitlab-org/gitaly/internal/gitaly/config" "gitlab.com/gitlab-org/gitaly/internal/helper" "gitlab.com/gitlab-org/gitaly/proto/go/gitalypb" "gitlab.com/gitlab-org/gitaly/streamio" @@ -65,10 +66,15 @@ func (s *server) sshReceivePack(stream gitalypb.SSHService_SSHReceivePackServer, globalOpts = append(globalOpts, git.ValueFlag{"-c", o}) } - cmd, err := git.SafeBareCmd(ctx, git.CmdStream{In: stdin, Out: stdout, Err: stderr}, nil, globalOpts, git.SubCmd{ - Name: "receive-pack", - Args: []string{repoPath}, - }, git.WithReceivePackHooks(ctx, req, "ssh"), git.WithGitProtocol(ctx, req)) + cmd, err := git.SafeBareCmd(ctx, git.CmdStream{In: stdin, Out: stdout, Err: stderr}, nil, globalOpts, + git.SubCmd{ + Name: "receive-pack", + Args: []string{repoPath}, + }, + git.WithReceivePackHooks(ctx, req, "ssh"), + git.WithGitProtocol(ctx, req), + git.WithRefTxHook(ctx, req.Repository, config.Config), + ) if err != nil { return fmt.Errorf("start cmd: %v", err) |