diff options
author | Ash McKenzie <amckenzie@gitlab.com> | 2020-09-21 04:47:01 +0000 |
---|---|---|
committer | Ash McKenzie <amckenzie@gitlab.com> | 2020-09-21 04:47:01 +0000 |
commit | 1a2bfecd2f0ebb8e31f9833e0522c4643797041b (patch) | |
tree | d17cf7bff45492a587027851bb6e0bcb493cff58 /internal/command/uploadpack/uploadpack.go | |
parent | f100e7e83943b3bb5db232f5bf79a616fdba88f1 (diff) | |
parent | a487572a904cc149840488eefdfe121173d8bcb5 (diff) | |
download | gitlab-shell-1a2bfecd2f0ebb8e31f9833e0522c4643797041b.tar.gz |
Merge branch 'sh-extract-context-from-env' into 'master'
Make it possible to propagate correlation ID across processes
Closes #474
See merge request gitlab-org/gitlab-shell!413
Diffstat (limited to 'internal/command/uploadpack/uploadpack.go')
-rw-r--r-- | internal/command/uploadpack/uploadpack.go | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/internal/command/uploadpack/uploadpack.go b/internal/command/uploadpack/uploadpack.go index 56814d7..fca3823 100644 --- a/internal/command/uploadpack/uploadpack.go +++ b/internal/command/uploadpack/uploadpack.go @@ -1,6 +1,8 @@ package uploadpack import ( + "context" + "gitlab.com/gitlab-org/gitlab-shell/internal/command/commandargs" "gitlab.com/gitlab-org/gitlab-shell/internal/command/readwriter" "gitlab.com/gitlab-org/gitlab-shell/internal/command/shared/accessverifier" @@ -15,14 +17,14 @@ type Command struct { ReadWriter *readwriter.ReadWriter } -func (c *Command) Execute() error { +func (c *Command) Execute(ctx context.Context) error { args := c.Args.SshArgs if len(args) != 2 { return disallowedcommand.Error } repo := args[1] - response, err := c.verifyAccess(repo) + response, err := c.verifyAccess(ctx, repo) if err != nil { return err } @@ -33,14 +35,14 @@ func (c *Command) Execute() error { ReadWriter: c.ReadWriter, EOFSent: false, } - return customAction.Execute(response) + return customAction.Execute(ctx, response) } return c.performGitalyCall(response) } -func (c *Command) verifyAccess(repo string) (*accessverifier.Response, error) { +func (c *Command) verifyAccess(ctx context.Context, repo string) (*accessverifier.Response, error) { cmd := accessverifier.Command{c.Config, c.Args, c.ReadWriter} - return cmd.Verify(c.Args.CommandType, repo) + return cmd.Verify(ctx, c.Args.CommandType, repo) } |