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:
authorJohn Cai <jcai@gitlab.com>2020-03-24 19:05:13 +0300
committerJohn Cai <jcai@gitlab.com>2020-03-26 18:33:46 +0300
commit9931dd84c298abe66ecf2cf68eff67c0b2427537 (patch)
treef0f7b601ebc1cb0d5ccd0875bcb0534d98225416
parent05cccf82fa5dd2faf7b31daafc5447507bbb865a (diff)
Add EnvironmentVariables field in hook rpcs
EnvironmentVariables can be used to pass environment variables in, which includes GL_ID, GL_PROTOCOL, and GL_USERNAME so we can pass these values into the ruby hooks. GL_REPOSITORY will be passed through the repository struct.
-rw-r--r--changelogs/unreleased/jc-add-gl-values.yml5
-rw-r--r--internal/service/hooks/post_receive.go7
-rw-r--r--internal/service/hooks/post_receive_test.go80
-rw-r--r--internal/service/hooks/pre_receive.go16
-rw-r--r--internal/service/hooks/pre_receive_test.go88
-rwxr-xr-xinternal/service/hooks/testdata/gitlab-shell/hooks/post-receive4
-rwxr-xr-xinternal/service/hooks/testdata/gitlab-shell/hooks/pre-receive2
-rwxr-xr-xinternal/service/hooks/testdata/gitlab-shell/hooks/update2
-rw-r--r--internal/service/hooks/update.go7
-rw-r--r--internal/service/hooks/update_test.go97
-rw-r--r--proto/go/gitalypb/hook.pb.go94
-rw-r--r--proto/hook.proto7
-rw-r--r--ruby/proto/gitaly/hook_pb.rb7
13 files changed, 276 insertions, 140 deletions
diff --git a/changelogs/unreleased/jc-add-gl-values.yml b/changelogs/unreleased/jc-add-gl-values.yml
new file mode 100644
index 000000000..d0301e992
--- /dev/null
+++ b/changelogs/unreleased/jc-add-gl-values.yml
@@ -0,0 +1,5 @@
+---
+title: Add EnvironmentVariables field in hook rpcs
+merge_request: 1969
+author:
+type: changed
diff --git a/internal/service/hooks/post_receive.go b/internal/service/hooks/post_receive.go
index 55ec0323f..f4e312d08 100644
--- a/internal/service/hooks/post_receive.go
+++ b/internal/service/hooks/post_receive.go
@@ -20,12 +20,7 @@ func (s *server) PostReceiveHook(stream gitalypb.HookService_PostReceiveHookServ
return helper.ErrInvalidArgument(err)
}
- hookEnv, err := hookRequestEnv(firstRequest)
- if err != nil {
- return helper.ErrInternal(err)
- }
-
- hookEnv = append(hookEnv, hooks.GitPushOptions(firstRequest.GetGitPushOptions())...)
+ hookEnv := append(hookRequestEnv(firstRequest), hooks.GitPushOptions(firstRequest.GetGitPushOptions())...)
stdin := streamio.NewReader(func() ([]byte, error) {
req, err := stream.Recv()
diff --git a/internal/service/hooks/post_receive_test.go b/internal/service/hooks/post_receive_test.go
index a85128967..fe7b4145d 100644
--- a/internal/service/hooks/post_receive_test.go
+++ b/internal/service/hooks/post_receive_test.go
@@ -63,33 +63,87 @@ func TestPostReceive(t *testing.T) {
stderr string
}{
{
- desc: "valid stdin",
- stdin: bytes.NewBufferString("a\nb\nc\nd\ne\nf\ng"),
- req: gitalypb.PostReceiveHookRequest{Repository: testRepo, KeyId: "key_id", GitPushOptions: []string{"option0", "option1"}},
+ desc: "everything OK",
+ stdin: bytes.NewBufferString("a\nb\nc\nd\ne\nf\ng"),
+ req: gitalypb.PostReceiveHookRequest{
+ Repository: testRepo,
+ EnvironmentVariables: []string{"GL_ID=key_id", "GL_USERNAME=username", "GL_PROTOCOL=protocol"},
+ GitPushOptions: []string{"option0", "option1"}},
status: 0,
stdout: "OK",
stderr: "",
},
{
- desc: "missing stdin",
- stdin: bytes.NewBuffer(nil),
- req: gitalypb.PostReceiveHookRequest{Repository: testRepo, KeyId: "key_id", GitPushOptions: []string{"option0"}},
+ desc: "missing stdin",
+ stdin: bytes.NewBuffer(nil),
+ req: gitalypb.PostReceiveHookRequest{
+ Repository: testRepo,
+ EnvironmentVariables: []string{"GL_ID=key_id", "GL_USERNAME=username", "GL_PROTOCOL=protocol"},
+ GitPushOptions: []string{"option0"},
+ },
status: 1,
stdout: "",
stderr: "FAIL",
},
{
- desc: "missing key_id",
- stdin: bytes.NewBuffer(nil),
- req: gitalypb.PostReceiveHookRequest{Repository: testRepo, GitPushOptions: []string{"option0"}},
+ desc: "missing gl_id",
+ stdin: bytes.NewBufferString("a\nb\nc\nd\ne\nf\ng"),
+ req: gitalypb.PostReceiveHookRequest{
+ Repository: testRepo,
+ EnvironmentVariables: []string{"GL_ID=", "GL_USERNAME=username", "GL_PROTOCOL=protocol"},
+ GitPushOptions: []string{"option0"},
+ },
status: 1,
stdout: "",
stderr: "FAIL",
},
{
- desc: "missing git push option",
- stdin: bytes.NewBuffer(nil),
- req: gitalypb.PostReceiveHookRequest{Repository: testRepo, KeyId: "key_id"},
+ desc: "missing gl_username",
+ stdin: bytes.NewBufferString("a\nb\nc\nd\ne\nf\ng"),
+ req: gitalypb.PostReceiveHookRequest{
+ Repository: testRepo,
+ EnvironmentVariables: []string{"GL_ID=key-123", "GL_USERNAME=", "GL_PROTOCOL=protocol"},
+ GitPushOptions: []string{"option0"},
+ },
+ status: 1,
+ stdout: "",
+ stderr: "FAIL",
+ },
+ {
+ desc: "missing gl_protocol",
+ stdin: bytes.NewBufferString("a\nb\nc\nd\ne\nf\ng"),
+ req: gitalypb.PostReceiveHookRequest{
+ Repository: testRepo,
+ EnvironmentVariables: []string{"GL_ID=key-123", "GL_USERNAME=username", "GL_PROTOCOL="},
+ GitPushOptions: []string{"option0"},
+ },
+ status: 1,
+ stdout: "",
+ stderr: "FAIL",
+ },
+ {
+ desc: "missing gl_repository value",
+ stdin: bytes.NewBufferString("a\nb\nc\nd\ne\nf\ng"),
+ req: gitalypb.PostReceiveHookRequest{
+ Repository: &gitalypb.Repository{
+ StorageName: testRepo.GetStorageName(),
+ RelativePath: testRepo.GetRelativePath(),
+ GlRepository: "",
+ },
+ EnvironmentVariables: []string{"GL_ID=key-123", "GL_USERNAME=username", "GL_PROTOCOL=protocol"},
+ GitPushOptions: []string{"option0"},
+ },
+ status: 1,
+ stdout: "",
+ stderr: "FAIL",
+ },
+ {
+ desc: "missing git push option",
+ stdin: bytes.NewBufferString("a\nb\nc\nd\ne\nf\ng"),
+ req: gitalypb.PostReceiveHookRequest{
+ Repository: testRepo,
+ EnvironmentVariables: []string{"GL_ID=key-123", "GL_USERNAME=username", "GL_PROTOCOL=protocol"},
+ },
status: 1,
stdout: "",
stderr: "FAIL",
@@ -128,7 +182,7 @@ func TestPostReceive(t *testing.T) {
status = resp.GetExitStatus().GetValue()
}
- require.Equal(t, tc.status, status)
+ assert.Equal(t, tc.status, status)
assert.Equal(t, tc.stderr, text.ChompBytes(stderr.Bytes()), "hook stderr")
assert.Equal(t, tc.stdout, text.ChompBytes(stdout.Bytes()), "hook stdout")
})
diff --git a/internal/service/hooks/pre_receive.go b/internal/service/hooks/pre_receive.go
index e855d2584..6458c68b5 100644
--- a/internal/service/hooks/pre_receive.go
+++ b/internal/service/hooks/pre_receive.go
@@ -14,14 +14,13 @@ import (
)
type hookRequest interface {
- GetKeyId() string
+ GetEnvironmentVariables() []string
GetRepository() *gitalypb.Repository
}
-func hookRequestEnv(req hookRequest) ([]string, error) {
+func hookRequestEnv(req hookRequest) []string {
return append(gitlabshell.Env(),
- fmt.Sprintf("GL_ID=%s", req.GetKeyId()),
- fmt.Sprintf("GL_REPOSITORY=%s", req.GetRepository().GetGlRepository())), nil
+ append(req.GetEnvironmentVariables(), fmt.Sprintf("GL_REPOSITORY=%s", req.GetRepository().GetGlRepository()))...)
}
func gitlabShellHook(hookName string) string {
@@ -38,13 +37,6 @@ func (s *server) PreReceiveHook(stream gitalypb.HookService_PreReceiveHookServer
return helper.ErrInvalidArgument(err)
}
- hookEnv, err := hookRequestEnv(firstRequest)
- if err != nil {
- return helper.ErrInternal(err)
- }
-
- hookEnv = append(hookEnv, fmt.Sprintf("GL_PROTOCOL=%s", firstRequest.GetProtocol()))
-
stdin := streamio.NewReader(func() ([]byte, error) {
req, err := stream.Recv()
return req.GetStdin(), err
@@ -65,7 +57,7 @@ func (s *server) PreReceiveHook(stream gitalypb.HookService_PreReceiveHookServer
stdin,
stdout, stderr,
c,
- hookEnv,
+ hookRequestEnv(firstRequest),
)
if err != nil {
diff --git a/internal/service/hooks/pre_receive_test.go b/internal/service/hooks/pre_receive_test.go
index 8b2d5c943..2a2d40a57 100644
--- a/internal/service/hooks/pre_receive_test.go
+++ b/internal/service/hooks/pre_receive_test.go
@@ -65,33 +65,95 @@ func TestPreReceive(t *testing.T) {
stdout, stderr string
}{
{
- desc: "valid stdin",
- stdin: bytes.NewBufferString("a\nb\nc\nd\ne\nf\ng"),
- req: gitalypb.PreReceiveHookRequest{Repository: testRepo, KeyId: "key_id", Protocol: "protocol"},
+ desc: "everything OK",
+ stdin: bytes.NewBufferString("a\nb\nc\nd\ne\nf\ng"),
+ req: gitalypb.PreReceiveHookRequest{
+ Repository: testRepo,
+ EnvironmentVariables: []string{
+ "GL_ID=key-123",
+ "GL_PROTOCOL=protocol",
+ "GL_USERNAME=username",
+ },
+ },
status: 0,
stdout: "OK",
stderr: "",
},
{
- desc: "missing stdin",
- stdin: bytes.NewBuffer(nil),
- req: gitalypb.PreReceiveHookRequest{Repository: testRepo, KeyId: "key_id", Protocol: "protocol"},
+ desc: "missing stdin",
+ stdin: bytes.NewBuffer(nil),
+ req: gitalypb.PreReceiveHookRequest{
+ Repository: testRepo,
+ EnvironmentVariables: []string{
+ "GL_ID=key-123",
+ "GL_PROTOCOL=protocol",
+ "GL_USERNAME=username",
+ },
+ },
status: 1,
stdout: "",
stderr: "FAIL",
},
{
- desc: "missing protocol",
- stdin: bytes.NewBufferString("a\nb\nc\nd\ne\nf\ng"),
- req: gitalypb.PreReceiveHookRequest{Repository: testRepo, KeyId: "key_id"},
+ desc: "missing gl_protocol",
+ stdin: bytes.NewBufferString("a\nb\nc\nd\ne\nf\ng"),
+ req: gitalypb.PreReceiveHookRequest{
+ Repository: testRepo,
+ EnvironmentVariables: []string{
+ "GL_ID=key-123",
+ "GL_USERNAME=username",
+ "GL_PROTOCOL=",
+ },
+ },
status: 1,
stdout: "",
stderr: "FAIL",
},
{
- desc: "missing key_id",
- stdin: bytes.NewBufferString("a\nb\nc\nd\ne\nf\ng"),
- req: gitalypb.PreReceiveHookRequest{Repository: testRepo, Protocol: "protocol"},
+ desc: "missing gl_id",
+ stdin: bytes.NewBufferString("a\nb\nc\nd\ne\nf\ng"),
+ req: gitalypb.PreReceiveHookRequest{
+ Repository: testRepo,
+ EnvironmentVariables: []string{
+ "GL_ID=",
+ "GL_PROTOCOL=protocol",
+ "GL_USERNAME=username",
+ },
+ },
+ status: 1,
+ stdout: "",
+ stderr: "FAIL",
+ },
+ {
+ desc: "missing gl_username",
+ stdin: bytes.NewBufferString("a\nb\nc\nd\ne\nf\ng"),
+ req: gitalypb.PreReceiveHookRequest{
+ Repository: testRepo,
+ EnvironmentVariables: []string{
+ "GL_ID=key-123",
+ "GL_PROTOCOL=protocol",
+ "GL_USERNAME=",
+ },
+ },
+ status: 1,
+ stdout: "",
+ stderr: "FAIL",
+ },
+ {
+ desc: "missing gl_repository",
+ stdin: bytes.NewBufferString("a\nb\nc\nd\ne\nf\ng"),
+ req: gitalypb.PreReceiveHookRequest{
+ Repository: &gitalypb.Repository{
+ StorageName: testRepo.GetStorageName(),
+ RelativePath: testRepo.GetRelativePath(),
+ GlRepository: "",
+ },
+ EnvironmentVariables: []string{
+ "GL_ID=key-123",
+ "GL_PROTOCOL=",
+ "GL_USERNAME=username",
+ },
+ },
status: 1,
stdout: "",
stderr: "FAIL",
@@ -133,7 +195,7 @@ func TestPreReceive(t *testing.T) {
require.NoError(t, err)
}
- require.Equal(t, tc.status, status)
+ assert.Equal(t, tc.status, status)
assert.Equal(t, tc.stderr, text.ChompBytes(stderr.Bytes()), "hook stderr")
assert.Equal(t, tc.stdout, text.ChompBytes(stdout.Bytes()), "hook stdout")
})
diff --git a/internal/service/hooks/testdata/gitlab-shell/hooks/post-receive b/internal/service/hooks/testdata/gitlab-shell/hooks/post-receive
index aa0b008de..09af4c677 100755
--- a/internal/service/hooks/testdata/gitlab-shell/hooks/post-receive
+++ b/internal/service/hooks/testdata/gitlab-shell/hooks/post-receive
@@ -3,8 +3,8 @@
# Tests inputs to post-receive
abort("FAIL") if $stdin.read.empty?
-abort("FAIL") if %w[GL_ID GL_REPOSITORY].any? { |k| ENV[k].empty? }
+abort("FAIL") if %w[GL_ID GL_REPOSITORY GL_PROTOCOL GL_USERNAME].any? { |k| ENV[k].nil? || ENV[k].empty? }
# git push options are not required. This is only for the sake of testing the values get through
-abort("FAIL") if %w[GIT_PUSH_OPTION_COUNT GIT_PUSH_OPTION_0].any? { |k| ENV[k].empty? }
+abort("FAIL") if %w[GIT_PUSH_OPTION_COUNT GIT_PUSH_OPTION_0].any? { |k| ENV[k].nil? || ENV[k].empty? }
puts "OK"
diff --git a/internal/service/hooks/testdata/gitlab-shell/hooks/pre-receive b/internal/service/hooks/testdata/gitlab-shell/hooks/pre-receive
index fc967a761..12574b7b7 100755
--- a/internal/service/hooks/testdata/gitlab-shell/hooks/pre-receive
+++ b/internal/service/hooks/testdata/gitlab-shell/hooks/pre-receive
@@ -3,7 +3,7 @@
# Tests inputs to pre-receive
abort("FAIL") if $stdin.read.empty?
-abort("FAIL") if %w[GL_ID GL_REPOSITORY GL_PROTOCOL].any? { |k| ENV[k].empty? }
+abort("FAIL") if %w[GL_ID GL_REPOSITORY GL_PROTOCOL GL_USERNAME].any? { |k| ENV[k].nil? || ENV[k].empty? }
puts "OK"
diff --git a/internal/service/hooks/testdata/gitlab-shell/hooks/update b/internal/service/hooks/testdata/gitlab-shell/hooks/update
index f7a121069..b9f19fd2f 100755
--- a/internal/service/hooks/testdata/gitlab-shell/hooks/update
+++ b/internal/service/hooks/testdata/gitlab-shell/hooks/update
@@ -4,6 +4,6 @@
abort("FAIL") unless ARGV.size == 3
abort("FAIL") if ARGV.any? { |arg| arg.empty? }
-abort("FAIL") if ENV['GL_ID'].empty?
+abort("FAIL") if %w[GL_ID GL_REPOSITORY GL_PROTOCOL GL_USERNAME].any? { |k| ENV[k].nil? || ENV[k].empty? }
puts "OK"
diff --git a/internal/service/hooks/update.go b/internal/service/hooks/update.go
index e1ee167d4..c980dd92f 100644
--- a/internal/service/hooks/update.go
+++ b/internal/service/hooks/update.go
@@ -14,11 +14,6 @@ func (s *server) UpdateHook(in *gitalypb.UpdateHookRequest, stream gitalypb.Hook
return helper.ErrInvalidArgument(err)
}
- hookEnv, err := hookRequestEnv(in)
- if err != nil {
- return helper.ErrInternal(err)
- }
-
stdout := streamio.NewWriter(func(p []byte) error { return stream.Send(&gitalypb.UpdateHookResponse{Stdout: p}) })
stderr := streamio.NewWriter(func(p []byte) error { return stream.Send(&gitalypb.UpdateHookResponse{Stderr: p}) })
@@ -35,7 +30,7 @@ func (s *server) UpdateHook(in *gitalypb.UpdateHookRequest, stream gitalypb.Hook
nil,
stdout, stderr,
c,
- hookEnv,
+ hookRequestEnv(in),
)
if err != nil {
diff --git a/internal/service/hooks/update_test.go b/internal/service/hooks/update_test.go
index 0a581f4fe..81e0f0639 100644
--- a/internal/service/hooks/update_test.go
+++ b/internal/service/hooks/update_test.go
@@ -64,11 +64,11 @@ func TestUpdate(t *testing.T) {
{
desc: "valid inputs",
req: gitalypb.UpdateHookRequest{
- Repository: testRepo,
- Ref: []byte("master"),
- OldValue: "a",
- NewValue: "b",
- KeyId: "key",
+ Repository: testRepo,
+ Ref: []byte("master"),
+ OldValue: "a",
+ NewValue: "b",
+ EnvironmentVariables: []string{"GL_ID=key-123", "GL_USERNAME=username", "GL_PROTOCOL=protocol"},
},
status: 0,
stdout: "OK",
@@ -77,11 +77,11 @@ func TestUpdate(t *testing.T) {
{
desc: "missing ref",
req: gitalypb.UpdateHookRequest{
- Repository: testRepo,
- Ref: nil,
- OldValue: "a",
- NewValue: "b",
- KeyId: "key",
+ Repository: testRepo,
+ Ref: nil,
+ OldValue: "a",
+ NewValue: "b",
+ EnvironmentVariables: []string{"GL_ID=key-123", "GL_USERNAME=username", "GL_PROTOCOL=protocol"},
},
status: 1,
stdout: "",
@@ -90,11 +90,11 @@ func TestUpdate(t *testing.T) {
{
desc: "missing old value",
req: gitalypb.UpdateHookRequest{
- Repository: testRepo,
- Ref: []byte("master"),
- OldValue: "",
- NewValue: "b",
- KeyId: "key",
+ Repository: testRepo,
+ Ref: []byte("master"),
+ OldValue: "",
+ NewValue: "b",
+ EnvironmentVariables: []string{"GL_ID=key-123", "GL_USERNAME=username", "GL_PROTOCOL=protocol"},
},
status: 1,
stdout: "",
@@ -103,24 +103,67 @@ func TestUpdate(t *testing.T) {
{
desc: "missing new value",
req: gitalypb.UpdateHookRequest{
- Repository: testRepo,
- Ref: []byte("master"),
- OldValue: "a",
- NewValue: "",
- KeyId: "key",
+ Repository: testRepo,
+ Ref: []byte("master"),
+ OldValue: "a",
+ NewValue: "",
+ EnvironmentVariables: []string{"GL_ID=key-123", "GL_USERNAME=username", "GL_PROTOCOL=protocol"},
},
status: 1,
stdout: "",
stderr: "FAIL",
},
{
- desc: "missing key_id value",
+ desc: "missing gl_id value",
req: gitalypb.UpdateHookRequest{
- Repository: testRepo,
- Ref: []byte("master"),
- OldValue: "a",
- NewValue: "b",
- KeyId: "",
+ Repository: testRepo,
+ Ref: []byte("master"),
+ OldValue: "a",
+ NewValue: "b",
+ EnvironmentVariables: []string{"GL_ID=", "GL_USERNAME=username", "GL_PROTOCOL=protocol"},
+ },
+ status: 1,
+ stdout: "",
+ stderr: "FAIL",
+ },
+ {
+ desc: "missing gl_username value",
+ req: gitalypb.UpdateHookRequest{
+ Repository: testRepo,
+ Ref: []byte("master"),
+ OldValue: "a",
+ NewValue: "b",
+ EnvironmentVariables: []string{"GL_ID=key-123", "GL_USERNAME=", "GL_PROTOCOL=protocol"},
+ },
+ status: 1,
+ stdout: "",
+ stderr: "FAIL",
+ },
+ {
+ desc: "missing gl_protocol value",
+ req: gitalypb.UpdateHookRequest{
+ Repository: testRepo,
+ Ref: []byte("master"),
+ OldValue: "a",
+ NewValue: "b",
+ EnvironmentVariables: []string{"GL_ID=key-123", "GL_USERNAME=username", "GL_PROTOCOL="},
+ },
+ status: 1,
+ stdout: "",
+ stderr: "FAIL",
+ },
+ {
+ desc: "missing gl_repository value",
+ req: gitalypb.UpdateHookRequest{
+ Repository: &gitalypb.Repository{
+ StorageName: testRepo.GetStorageName(),
+ RelativePath: testRepo.GetRelativePath(),
+ GlRepository: "",
+ },
+ Ref: []byte("master"),
+ OldValue: "a",
+ NewValue: "b",
+ EnvironmentVariables: []string{"GL_ID=key-123", "GL_USERNAME=username", "GL_PROTOCOL=protocol"},
},
status: 1,
stdout: "",
@@ -152,7 +195,7 @@ func TestUpdate(t *testing.T) {
require.NoError(t, err)
}
- require.Equal(t, tc.status, status)
+ assert.Equal(t, tc.status, status)
assert.Equal(t, tc.stderr, text.ChompBytes(stderr.Bytes()), "hook stderr")
assert.Equal(t, tc.stdout, text.ChompBytes(stdout.Bytes()), "hook stdout")
})
diff --git a/proto/go/gitalypb/hook.pb.go b/proto/go/gitalypb/hook.pb.go
index 75df02b07..1c5ae1b00 100644
--- a/proto/go/gitalypb/hook.pb.go
+++ b/proto/go/gitalypb/hook.pb.go
@@ -26,8 +26,7 @@ const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
type PreReceiveHookRequest struct {
Repository *Repository `protobuf:"bytes,1,opt,name=repository,proto3" json:"repository,omitempty"`
- KeyId string `protobuf:"bytes,2,opt,name=key_id,json=keyId,proto3" json:"key_id,omitempty"`
- Protocol string `protobuf:"bytes,3,opt,name=protocol,proto3" json:"protocol,omitempty"`
+ EnvironmentVariables []string `protobuf:"bytes,2,rep,name=environment_variables,json=environmentVariables,proto3" json:"environment_variables,omitempty"`
Stdin []byte `protobuf:"bytes,4,opt,name=stdin,proto3" json:"stdin,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
@@ -66,18 +65,11 @@ func (m *PreReceiveHookRequest) GetRepository() *Repository {
return nil
}
-func (m *PreReceiveHookRequest) GetKeyId() string {
+func (m *PreReceiveHookRequest) GetEnvironmentVariables() []string {
if m != nil {
- return m.KeyId
+ return m.EnvironmentVariables
}
- return ""
-}
-
-func (m *PreReceiveHookRequest) GetProtocol() string {
- if m != nil {
- return m.Protocol
- }
- return ""
+ return nil
}
func (m *PreReceiveHookRequest) GetStdin() []byte {
@@ -144,7 +136,7 @@ func (m *PreReceiveHookResponse) GetExitStatus() *ExitStatus {
type PostReceiveHookRequest struct {
Repository *Repository `protobuf:"bytes,1,opt,name=repository,proto3" json:"repository,omitempty"`
- KeyId string `protobuf:"bytes,2,opt,name=key_id,json=keyId,proto3" json:"key_id,omitempty"`
+ EnvironmentVariables []string `protobuf:"bytes,2,rep,name=environment_variables,json=environmentVariables,proto3" json:"environment_variables,omitempty"`
Stdin []byte `protobuf:"bytes,3,opt,name=stdin,proto3" json:"stdin,omitempty"`
GitPushOptions []string `protobuf:"bytes,4,rep,name=git_push_options,json=gitPushOptions,proto3" json:"git_push_options,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
@@ -184,11 +176,11 @@ func (m *PostReceiveHookRequest) GetRepository() *Repository {
return nil
}
-func (m *PostReceiveHookRequest) GetKeyId() string {
+func (m *PostReceiveHookRequest) GetEnvironmentVariables() []string {
if m != nil {
- return m.KeyId
+ return m.EnvironmentVariables
}
- return ""
+ return nil
}
func (m *PostReceiveHookRequest) GetStdin() []byte {
@@ -262,7 +254,7 @@ func (m *PostReceiveHookResponse) GetExitStatus() *ExitStatus {
type UpdateHookRequest struct {
Repository *Repository `protobuf:"bytes,1,opt,name=repository,proto3" json:"repository,omitempty"`
- KeyId string `protobuf:"bytes,2,opt,name=key_id,json=keyId,proto3" json:"key_id,omitempty"`
+ EnvironmentVariables []string `protobuf:"bytes,2,rep,name=environment_variables,json=environmentVariables,proto3" json:"environment_variables,omitempty"`
Ref []byte `protobuf:"bytes,3,opt,name=ref,proto3" json:"ref,omitempty"`
OldValue string `protobuf:"bytes,4,opt,name=old_value,json=oldValue,proto3" json:"old_value,omitempty"`
NewValue string `protobuf:"bytes,5,opt,name=new_value,json=newValue,proto3" json:"new_value,omitempty"`
@@ -303,11 +295,11 @@ func (m *UpdateHookRequest) GetRepository() *Repository {
return nil
}
-func (m *UpdateHookRequest) GetKeyId() string {
+func (m *UpdateHookRequest) GetEnvironmentVariables() []string {
if m != nil {
- return m.KeyId
+ return m.EnvironmentVariables
}
- return ""
+ return nil
}
func (m *UpdateHookRequest) GetRef() []byte {
@@ -398,37 +390,37 @@ func init() {
func init() { proto.RegisterFile("hook.proto", fileDescriptor_3eef30da1c11ee1b) }
var fileDescriptor_3eef30da1c11ee1b = []byte{
- // 480 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x94, 0xcb, 0x6e, 0xd3, 0x40,
- 0x14, 0x86, 0x35, 0xb9, 0x58, 0xc9, 0x49, 0x54, 0xca, 0x88, 0x06, 0x63, 0x04, 0x44, 0x5e, 0x79,
- 0x01, 0x49, 0xd4, 0x6e, 0x58, 0x57, 0x42, 0x82, 0x05, 0x22, 0x9a, 0x0a, 0x16, 0x20, 0x61, 0x39,
- 0xf1, 0xc1, 0x19, 0xc5, 0x78, 0xcc, 0xcc, 0x38, 0xad, 0x17, 0xf0, 0x1a, 0x5c, 0xde, 0x80, 0x1d,
- 0x4f, 0xc1, 0x43, 0xb1, 0x42, 0x9e, 0x71, 0xd3, 0xb4, 0x4d, 0x97, 0xcd, 0x6e, 0xfe, 0xf3, 0xcd,
- 0xb9, 0xcc, 0xaf, 0x63, 0x03, 0x2c, 0x84, 0x58, 0x8e, 0x72, 0x29, 0xb4, 0xa0, 0x4e, 0xc2, 0x75,
- 0x94, 0x96, 0x1e, 0xa4, 0x3c, 0xd3, 0x36, 0xe6, 0xf5, 0xd5, 0x22, 0x92, 0x18, 0x5b, 0xe5, 0xff,
- 0x22, 0x70, 0x30, 0x95, 0xc8, 0x70, 0x8e, 0x7c, 0x85, 0x2f, 0x85, 0x58,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 0x0b, 0x3a, 0xe5, 0x57, 0x4f, 0x50, 0x16, 0x62, 0x86, 0xfc,
+ 0x3d, 0xec, 0x6d, 0x2e, 0x09, 0x7f, 0xbc, 0x54, 0xd8, 0xba, 0xda, 0xce, 0x93, 0xdb, 0xb0, 0xe9,
+ 0xc2, 0x6d, 0xfd, 0xf9, 0xea, 0x59, 0xbb, 0x96, 0xc7, 0x46, 0x8c, 0x7f, 0x80, 0x7b, 0xd7, 0x06,
+ 0x87, 0x5f, 0x95, 0x6f, 0x5d, 0x0d, 0xe7, 0xe9, 0xad, 0x7c, 0x8b, 0xfe, 0x6b, 0x80, 0x2b, 0x1f,
+ 0xf9, 0xc3, 0x65, 0xe9, 0x8d, 0x59, 0x71, 0x9c, 0x6d, 0x68, 0x53, 0x70, 0xc4, 0x8e, 0x47, 0xef,
+ 0xca, 0x6b, 0x49, 0x38, 0x1d, 0xcc, 0xe8, 0x7c, 0x68, 0x8e, 0xcf, 0x49, 0xc6, 0x43, 0x53, 0x3c,
+ 0xac, 0xfe, 0x7a, 0xc3, 0x98, 0xea, 0x38, 0x9b, 0x4e, 0x5b, 0x55, 0x6a, 0xfc, 0x37, 0x00, 0x00,
+ 0xff, 0xff, 0xba, 0x91, 0xf9, 0x6c, 0x38, 0x05, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.
diff --git a/proto/hook.proto b/proto/hook.proto
index 7199a59fd..b29c3dc81 100644
--- a/proto/hook.proto
+++ b/proto/hook.proto
@@ -27,8 +27,7 @@ service HookService {
message PreReceiveHookRequest {
Repository repository = 1 [(target_repository)=true];
- string key_id = 2;
- string protocol = 3;
+ repeated string environment_variables = 2;
bytes stdin = 4;
}
@@ -40,7 +39,7 @@ message PreReceiveHookResponse{
message PostReceiveHookRequest {
Repository repository = 1 [(target_repository)=true];
- string key_id = 2;
+ repeated string environment_variables = 2;
bytes stdin = 3;
repeated string git_push_options = 4;
}
@@ -53,7 +52,7 @@ message PostReceiveHookResponse{
message UpdateHookRequest {
Repository repository = 1 [(target_repository)=true];
- string key_id = 2;
+ repeated string environment_variables = 2;
bytes ref = 3;
string old_value = 4;
string new_value = 5;
diff --git a/ruby/proto/gitaly/hook_pb.rb b/ruby/proto/gitaly/hook_pb.rb
index f356b7abb..26a13e941 100644
--- a/ruby/proto/gitaly/hook_pb.rb
+++ b/ruby/proto/gitaly/hook_pb.rb
@@ -8,8 +8,7 @@ require 'shared_pb'
Google::Protobuf::DescriptorPool.generated_pool.build do
add_message "gitaly.PreReceiveHookRequest" do
optional :repository, :message, 1, "gitaly.Repository"
- optional :key_id, :string, 2
- optional :protocol, :string, 3
+ repeated :environment_variables, :string, 2
optional :stdin, :bytes, 4
end
add_message "gitaly.PreReceiveHookResponse" do
@@ -19,7 +18,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
end
add_message "gitaly.PostReceiveHookRequest" do
optional :repository, :message, 1, "gitaly.Repository"
- optional :key_id, :string, 2
+ repeated :environment_variables, :string, 2
optional :stdin, :bytes, 3
repeated :git_push_options, :string, 4
end
@@ -30,7 +29,7 @@ Google::Protobuf::DescriptorPool.generated_pool.build do
end
add_message "gitaly.UpdateHookRequest" do
optional :repository, :message, 1, "gitaly.Repository"
- optional :key_id, :string, 2
+ repeated :environment_variables, :string, 2
optional :ref, :bytes, 3
optional :old_value, :string, 4
optional :new_value, :string, 5