diff options
author | Stan Hu <stanhu@gmail.com> | 2020-03-26 20:49:25 -0700 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2020-03-26 20:49:25 -0700 |
commit | f1ec61c73087f08d76bc3f117dc169a30e5a13f6 (patch) | |
tree | 82eee9043cf34dad94a92c1e5494ab7ac9d4c79e | |
parent | 6e4495c01509b20144b3b33d92a06f0a7a93e60a (diff) | |
download | gitlab-shell-f1ec61c73087f08d76bc3f117dc169a30e5a13f6.tar.gz |
Log git-{upload-pack,receive-pack} requests
This restores the previous Ruby gitlab-shell behavior.
-rw-r--r-- | internal/command/receivepack/gitalycall.go | 12 | ||||
-rw-r--r-- | internal/command/uploadpack/gitalycall.go | 12 |
2 files changed, 24 insertions, 0 deletions
diff --git a/internal/command/receivepack/gitalycall.go b/internal/command/receivepack/gitalycall.go index 529b296..de41b25 100644 --- a/internal/command/receivepack/gitalycall.go +++ b/internal/command/receivepack/gitalycall.go @@ -6,6 +6,7 @@ import ( "google.golang.org/grpc" + log "github.com/sirupsen/logrus" "gitlab.com/gitlab-org/gitaly/client" pb "gitlab.com/gitlab-org/gitaly/proto/go/gitalypb" "gitlab.com/gitlab-org/gitlab-shell/internal/command/commandargs" @@ -31,6 +32,17 @@ func (c *Command) performGitalyCall(response *accessverifier.Response) error { GitConfigOptions: response.GitConfigOptions, } + fields := log.Fields{ + "command": "git-receive-pack", + "gl_project_path": request.Repository.GlProjectPath, + "gl_repository": request.Repository.GlRepository, + "user_id": response.UserId, + "username": response.Username, + "git_protocol": request.GitProtocol, + } + + log.WithFields(fields).Info("executing git command") + return gc.RunGitalyCommand(func(ctx context.Context, conn *grpc.ClientConn) (int32, error) { ctx, cancel := context.WithCancel(ctx) defer cancel() diff --git a/internal/command/uploadpack/gitalycall.go b/internal/command/uploadpack/gitalycall.go index 26f87f8..c55ce55 100644 --- a/internal/command/uploadpack/gitalycall.go +++ b/internal/command/uploadpack/gitalycall.go @@ -6,6 +6,7 @@ import ( "google.golang.org/grpc" + log "github.com/sirupsen/logrus" "gitlab.com/gitlab-org/gitaly/client" pb "gitlab.com/gitlab-org/gitaly/proto/go/gitalypb" "gitlab.com/gitlab-org/gitlab-shell/internal/command/commandargs" @@ -28,6 +29,17 @@ func (c *Command) performGitalyCall(response *accessverifier.Response) error { GitConfigOptions: response.GitConfigOptions, } + fields := log.Fields{ + "command": "git-upload-pack", + "gl_project_path": request.Repository.GlProjectPath, + "gl_repository": request.Repository.GlRepository, + "user_id": response.UserId, + "username": response.Username, + "git_protocol": request.GitProtocol, + } + + log.WithFields(fields).Info("executing git command") + return gc.RunGitalyCommand(func(ctx context.Context, conn *grpc.ClientConn) (int32, error) { ctx, cancel := context.WithCancel(ctx) defer cancel() |