From bc8bee39b45ad32d6b3416bb325b41c4d4c7eeb0 Mon Sep 17 00:00:00 2001 From: Aboobacker MK Date: Fri, 4 Apr 2025 20:38:55 +0530 Subject: [PATCH 1/7] Add pipeline_id to request --- internal/gitlab/http_client.go | 3 +++ proto/smarthttp.proto | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/internal/gitlab/http_client.go b/internal/gitlab/http_client.go index a574705861..b06275e5c9 100644 --- a/internal/gitlab/http_client.go +++ b/internal/gitlab/http_client.go @@ -122,11 +122,14 @@ type allowedRequest struct { Username string `json:"username,omitempty"` KeyID string `json:"key_id,omitempty"` UserID string `json:"user_id,omitempty"` + PipelineID string `json:"pipeline_id,omitempty"` PushOptions []string `json:"push_options,omitempty"` ClientContext []byte `json:"gitaly_client_context_bin,omitempty"` } func (a *allowedRequest) parseAndSetGLID(glID string) error { + // Add PipelineID from glID :thinking: + var value string switch { diff --git a/proto/smarthttp.proto b/proto/smarthttp.proto index c9f2b40ee0..d52efd0d36 100644 --- a/proto/smarthttp.proto +++ b/proto/smarthttp.proto @@ -111,6 +111,10 @@ message PostReceivePackRequest { string git_protocol = 6; // git_config_options are parameters to use with git -c (key=value pairs). repeated string git_config_options = 7; + + // gl_pipeline_id is the GitLab pipeline ID. This is used by Git {pre,post}-receive hooks. + // It should only be present in the first message of the stream. + string gl_pipeline_id = 8; } // PostReceivePackResponse is the response for the PostReceivePack rpc. It is a stream used to -- GitLab From 97605e653e4873137d51b601bea5ddb4e1a82f93 Mon Sep 17 00:00:00 2001 From: Aboobacker MK Date: Fri, 4 Apr 2025 20:51:40 +0530 Subject: [PATCH 2/7] Add param --- internal/gitlab/client.go | 3 +++ internal/gitlab/http_client.go | 2 ++ 2 files changed, 5 insertions(+) diff --git a/internal/gitlab/client.go b/internal/gitlab/client.go index 39ed93f073..4b7d6200b9 100644 --- a/internal/gitlab/client.go +++ b/internal/gitlab/client.go @@ -20,6 +20,9 @@ type AllowedParams struct { GLID string // GLProtocol is a protocol used for operation. GLProtocol string + + // GL_PipelineID + GL_PipelineID string // Changes is a set of changes to be applied. Changes string // PushOptions is a list of the specified push options. diff --git a/internal/gitlab/http_client.go b/internal/gitlab/http_client.go index b06275e5c9..1de2fe08a6 100644 --- a/internal/gitlab/http_client.go +++ b/internal/gitlab/http_client.go @@ -125,6 +125,7 @@ type allowedRequest struct { PipelineID string `json:"pipeline_id,omitempty"` PushOptions []string `json:"push_options,omitempty"` ClientContext []byte `json:"gitaly_client_context_bin,omitempty"` + GlPipelineId string `json:"pipeline_id,omitempty"` } func (a *allowedRequest) parseAndSetGLID(glID string) error { @@ -177,6 +178,7 @@ func (c *HTTPClient) Allowed(ctx context.Context, params AllowedParams) (bool, s Env: gitObjDirVars, PushOptions: params.PushOptions, ClientContext: params.ClientContext, + GlPipelineId: params.GL_PipelineID, } if err := req.parseAndSetGLID(params.GLID); err != nil { -- GitLab From efc25e14d04db79c886bd1526ef474ede2f7b732 Mon Sep 17 00:00:00 2001 From: Aboobacker MK Date: Fri, 4 Apr 2025 22:02:56 +0530 Subject: [PATCH 3/7] fix typo --- internal/gitaly/hook/prereceive.go | 1 + internal/gitlab/http_client.go | 6 ++---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/internal/gitaly/hook/prereceive.go b/internal/gitaly/hook/prereceive.go index bf638e7b78..315e9cfc28 100644 --- a/internal/gitaly/hook/prereceive.go +++ b/internal/gitaly/hook/prereceive.go @@ -138,6 +138,7 @@ func (m *GitLabHookManager) preReceiveHook(ctx context.Context, payload gitcmd.H Changes: string(changes), PushOptions: pushOptions, ClientContext: payload.GitalyClientContext, + GL_PipelineID: "1", } allowed, message, err := m.gitlabClient.Allowed(ctx, params) diff --git a/internal/gitlab/http_client.go b/internal/gitlab/http_client.go index 1de2fe08a6..74513bd53a 100644 --- a/internal/gitlab/http_client.go +++ b/internal/gitlab/http_client.go @@ -125,12 +125,9 @@ type allowedRequest struct { PipelineID string `json:"pipeline_id,omitempty"` PushOptions []string `json:"push_options,omitempty"` ClientContext []byte `json:"gitaly_client_context_bin,omitempty"` - GlPipelineId string `json:"pipeline_id,omitempty"` } func (a *allowedRequest) parseAndSetGLID(glID string) error { - // Add PipelineID from glID :thinking: - var value string switch { @@ -144,6 +141,7 @@ func (a *allowedRequest) parseAndSetGLID(glID string) error { a.UserID = strings.TrimPrefix(glID, "user-") value = a.UserID } + a.PipelineID = "1" // FIXME if !glIDRegex.MatchString(value) { return fmt.Errorf("gl_id=%q is invalid", glID) @@ -178,7 +176,7 @@ func (c *HTTPClient) Allowed(ctx context.Context, params AllowedParams) (bool, s Env: gitObjDirVars, PushOptions: params.PushOptions, ClientContext: params.ClientContext, - GlPipelineId: params.GL_PipelineID, + PipelineId: params.GL_PipelineID, } if err := req.parseAndSetGLID(params.GLID); err != nil { -- GitLab From 1063efcc8d05e2cfc9d81b9378867f49003cdd15 Mon Sep 17 00:00:00 2001 From: Aboobacker MK Date: Fri, 4 Apr 2025 22:36:38 +0530 Subject: [PATCH 4/7] typo --- internal/gitlab/http_client.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/internal/gitlab/http_client.go b/internal/gitlab/http_client.go index 74513bd53a..c73a21d659 100644 --- a/internal/gitlab/http_client.go +++ b/internal/gitlab/http_client.go @@ -141,8 +141,6 @@ func (a *allowedRequest) parseAndSetGLID(glID string) error { a.UserID = strings.TrimPrefix(glID, "user-") value = a.UserID } - a.PipelineID = "1" // FIXME - if !glIDRegex.MatchString(value) { return fmt.Errorf("gl_id=%q is invalid", glID) } @@ -176,7 +174,7 @@ func (c *HTTPClient) Allowed(ctx context.Context, params AllowedParams) (bool, s Env: gitObjDirVars, PushOptions: params.PushOptions, ClientContext: params.ClientContext, - PipelineId: params.GL_PipelineID, + PipelineID: params.GL_PipelineID, } if err := req.parseAndSetGLID(params.GLID); err != nil { -- GitLab From d1d5aaf8833ac65405afee7c55fd56748c0ee5eb Mon Sep 17 00:00:00 2001 From: Aboobacker MK Date: Sun, 6 Apr 2025 16:19:09 +0530 Subject: [PATCH 5/7] Update protoc version and add gl_pipeline_id field The changes update the protoc version and add a new field `gl_pipeline_id` to the PostReceivePackRequest message for tracking GitLab pipeline IDs. --- proto/go/gitalypb/smarthttp.pb.go | 89 ++++++++++++++++++------------- 1 file changed, 51 insertions(+), 38 deletions(-) diff --git a/proto/go/gitalypb/smarthttp.pb.go b/proto/go/gitalypb/smarthttp.pb.go index 1d403a229e..31a670c439 100644 --- a/proto/go/gitalypb/smarthttp.pb.go +++ b/proto/go/gitalypb/smarthttp.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.36.5 -// protoc v4.23.1 +// protoc v6.30.2 // source: smarthttp.proto package gitalypb @@ -267,8 +267,11 @@ type PostReceivePackRequest struct { GitProtocol string `protobuf:"bytes,6,opt,name=git_protocol,json=gitProtocol,proto3" json:"git_protocol,omitempty"` // git_config_options are parameters to use with git -c (key=value pairs). GitConfigOptions []string `protobuf:"bytes,7,rep,name=git_config_options,json=gitConfigOptions,proto3" json:"git_config_options,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + // gl_pipeline_id is the GitLab pipeline ID. This is used by Git {pre,post}-receive hooks. + // It should only be present in the first message of the stream. + GlPipelineId string `protobuf:"bytes,8,opt,name=gl_pipeline_id,json=glPipelineId,proto3" json:"gl_pipeline_id,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *PostReceivePackRequest) Reset() { @@ -350,6 +353,13 @@ func (x *PostReceivePackRequest) GetGitConfigOptions() []string { return nil } +func (x *PostReceivePackRequest) GetGlPipelineId() string { + if x != nil { + return x.GlPipelineId + } + return "" +} + // PostReceivePackResponse is the response for the PostReceivePack rpc. It is a stream used to // transfer the raw data from the stdout of git-receive-pack(1) from the server to the client. type PostReceivePackResponse struct { @@ -437,7 +447,7 @@ var file_smarthttp_proto_rawDesc = string([]byte{ 0x69, 0x6c, 0x65, 0x4e, 0x65, 0x67, 0x6f, 0x74, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x69, 0x73, 0x74, 0x69, 0x63, 0x73, 0x52, 0x1d, 0x70, 0x61, 0x63, 0x6b, 0x66, 0x69, 0x6c, 0x65, 0x4e, 0x65, 0x67, 0x6f, 0x74, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, - 0x74, 0x69, 0x73, 0x74, 0x69, 0x63, 0x73, 0x22, 0x92, 0x02, 0x0a, 0x16, 0x50, 0x6f, 0x73, 0x74, + 0x74, 0x69, 0x73, 0x74, 0x69, 0x63, 0x73, 0x22, 0xb8, 0x02, 0x0a, 0x16, 0x50, 0x6f, 0x73, 0x74, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x50, 0x61, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x38, 0x0a, 0x0a, 0x72, 0x65, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x6f, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, @@ -454,40 +464,43 @@ var file_smarthttp_proto_rawDesc = string([]byte{ 0x09, 0x52, 0x0b, 0x67, 0x69, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x6c, 0x12, 0x2c, 0x0a, 0x12, 0x67, 0x69, 0x74, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x09, 0x52, 0x10, 0x67, 0x69, 0x74, 0x43, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x2d, 0x0a, 0x17, - 0x50, 0x6f, 0x73, 0x74, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x50, 0x61, 0x63, 0x6b, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x32, 0xa0, 0x03, 0x0a, 0x10, - 0x53, 0x6d, 0x61, 0x72, 0x74, 0x48, 0x54, 0x54, 0x50, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x12, 0x51, 0x0a, 0x12, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x66, 0x73, 0x55, 0x70, 0x6c, 0x6f, - 0x61, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x12, 0x17, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, - 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x66, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x18, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x66, - 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x06, 0xfa, 0x97, 0x28, 0x02, 0x08, - 0x02, 0x30, 0x01, 0x12, 0x52, 0x0a, 0x13, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x66, 0x73, 0x52, - 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x50, 0x61, 0x63, 0x6b, 0x12, 0x17, 0x2e, 0x67, 0x69, 0x74, - 0x61, 0x6c, 0x79, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x66, 0x73, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x49, 0x6e, 0x66, - 0x6f, 0x52, 0x65, 0x66, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x06, 0xfa, - 0x97, 0x28, 0x02, 0x08, 0x02, 0x30, 0x01, 0x12, 0x84, 0x01, 0x0a, 0x1d, 0x50, 0x6f, 0x73, 0x74, - 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x57, 0x69, 0x74, 0x68, 0x53, 0x69, - 0x64, 0x65, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x2c, 0x2e, 0x67, 0x69, 0x74, 0x61, - 0x6c, 0x79, 0x2e, 0x50, 0x6f, 0x73, 0x74, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x50, 0x61, 0x63, - 0x6b, 0x57, 0x69, 0x74, 0x68, 0x53, 0x69, 0x64, 0x65, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2d, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, - 0x2e, 0x50, 0x6f, 0x73, 0x74, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x57, - 0x69, 0x74, 0x68, 0x53, 0x69, 0x64, 0x65, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x06, 0xfa, 0x97, 0x28, 0x02, 0x08, 0x02, 0x12, 0x5e, - 0x0a, 0x0f, 0x50, 0x6f, 0x73, 0x74, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x50, 0x61, 0x63, - 0x6b, 0x12, 0x1e, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x50, 0x6f, 0x73, 0x74, 0x52, - 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x50, 0x61, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x1f, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x50, 0x6f, 0x73, 0x74, 0x52, - 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x50, 0x61, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x06, 0xfa, 0x97, 0x28, 0x02, 0x08, 0x01, 0x28, 0x01, 0x30, 0x01, 0x42, 0x34, - 0x5a, 0x32, 0x67, 0x69, 0x74, 0x6c, 0x61, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x69, 0x74, - 0x6c, 0x61, 0x62, 0x2d, 0x6f, 0x72, 0x67, 0x2f, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2f, 0x76, - 0x31, 0x36, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x2f, 0x67, 0x69, 0x74, 0x61, - 0x6c, 0x79, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x24, 0x0a, 0x0e, + 0x67, 0x6c, 0x5f, 0x70, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x08, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x67, 0x6c, 0x50, 0x69, 0x70, 0x65, 0x6c, 0x69, 0x6e, 0x65, + 0x49, 0x64, 0x22, 0x2d, 0x0a, 0x17, 0x50, 0x6f, 0x73, 0x74, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, + 0x65, 0x50, 0x61, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, + 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, + 0x61, 0x32, 0xa0, 0x03, 0x0a, 0x10, 0x53, 0x6d, 0x61, 0x72, 0x74, 0x48, 0x54, 0x54, 0x50, 0x53, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x51, 0x0a, 0x12, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, + 0x66, 0x73, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x12, 0x17, 0x2e, 0x67, + 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x66, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x49, + 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x66, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x06, 0xfa, 0x97, 0x28, 0x02, 0x08, 0x02, 0x30, 0x01, 0x12, 0x52, 0x0a, 0x13, 0x49, 0x6e, 0x66, + 0x6f, 0x52, 0x65, 0x66, 0x73, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x50, 0x61, 0x63, 0x6b, + 0x12, 0x17, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, + 0x66, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x67, 0x69, 0x74, 0x61, + 0x6c, 0x79, 0x2e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x66, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x06, 0xfa, 0x97, 0x28, 0x02, 0x08, 0x02, 0x30, 0x01, 0x12, 0x84, 0x01, + 0x0a, 0x1d, 0x50, 0x6f, 0x73, 0x74, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x50, 0x61, 0x63, 0x6b, + 0x57, 0x69, 0x74, 0x68, 0x53, 0x69, 0x64, 0x65, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12, + 0x2c, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x50, 0x6f, 0x73, 0x74, 0x55, 0x70, 0x6c, + 0x6f, 0x61, 0x64, 0x50, 0x61, 0x63, 0x6b, 0x57, 0x69, 0x74, 0x68, 0x53, 0x69, 0x64, 0x65, 0x63, + 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2d, 0x2e, + 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x2e, 0x50, 0x6f, 0x73, 0x74, 0x55, 0x70, 0x6c, 0x6f, 0x61, + 0x64, 0x50, 0x61, 0x63, 0x6b, 0x57, 0x69, 0x74, 0x68, 0x53, 0x69, 0x64, 0x65, 0x63, 0x68, 0x61, + 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x06, 0xfa, 0x97, + 0x28, 0x02, 0x08, 0x02, 0x12, 0x5e, 0x0a, 0x0f, 0x50, 0x6f, 0x73, 0x74, 0x52, 0x65, 0x63, 0x65, + 0x69, 0x76, 0x65, 0x50, 0x61, 0x63, 0x6b, 0x12, 0x1e, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, + 0x2e, 0x50, 0x6f, 0x73, 0x74, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x50, 0x61, 0x63, 0x6b, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, + 0x2e, 0x50, 0x6f, 0x73, 0x74, 0x52, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x50, 0x61, 0x63, 0x6b, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x06, 0xfa, 0x97, 0x28, 0x02, 0x08, 0x01, + 0x28, 0x01, 0x30, 0x01, 0x42, 0x34, 0x5a, 0x32, 0x67, 0x69, 0x74, 0x6c, 0x61, 0x62, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x67, 0x69, 0x74, 0x6c, 0x61, 0x62, 0x2d, 0x6f, 0x72, 0x67, 0x2f, 0x67, 0x69, + 0x74, 0x61, 0x6c, 0x79, 0x2f, 0x76, 0x31, 0x36, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, + 0x6f, 0x2f, 0x67, 0x69, 0x74, 0x61, 0x6c, 0x79, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, }) var ( -- GitLab From ee4789558c2285bddb3202a0ce43b978142119f0 Mon Sep 17 00:00:00 2001 From: Aboobacker MK Date: Sun, 6 Apr 2025 16:23:49 +0530 Subject: [PATCH 6/7] Update protoc version in smarthttp protobuf spec --- proto/go/gitalypb/smarthttp.pb.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/go/gitalypb/smarthttp.pb.go b/proto/go/gitalypb/smarthttp.pb.go index 31a670c439..f3ca86809c 100644 --- a/proto/go/gitalypb/smarthttp.pb.go +++ b/proto/go/gitalypb/smarthttp.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.36.5 -// protoc v6.30.2 +// protoc v4.23.1 // source: smarthttp.proto package gitalypb -- GitLab From c8d63f968f3e6e002b1db794d967f0241e8d3116 Mon Sep 17 00:00:00 2001 From: Aboobacker MK Date: Sun, 6 Apr 2025 16:44:34 +0530 Subject: [PATCH 7/7] fix variable naming --- internal/gitaly/hook/prereceive.go | 2 +- internal/gitlab/client.go | 4 ++-- internal/gitlab/http_client.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/internal/gitaly/hook/prereceive.go b/internal/gitaly/hook/prereceive.go index 315e9cfc28..5d6583540b 100644 --- a/internal/gitaly/hook/prereceive.go +++ b/internal/gitaly/hook/prereceive.go @@ -138,7 +138,7 @@ func (m *GitLabHookManager) preReceiveHook(ctx context.Context, payload gitcmd.H Changes: string(changes), PushOptions: pushOptions, ClientContext: payload.GitalyClientContext, - GL_PipelineID: "1", + GLPipelineID: "1", } allowed, message, err := m.gitlabClient.Allowed(ctx, params) diff --git a/internal/gitlab/client.go b/internal/gitlab/client.go index 4b7d6200b9..92415a1a94 100644 --- a/internal/gitlab/client.go +++ b/internal/gitlab/client.go @@ -21,8 +21,8 @@ type AllowedParams struct { // GLProtocol is a protocol used for operation. GLProtocol string - // GL_PipelineID - GL_PipelineID string + // GLPipelineID + GLPipelineID string // Changes is a set of changes to be applied. Changes string // PushOptions is a list of the specified push options. diff --git a/internal/gitlab/http_client.go b/internal/gitlab/http_client.go index c73a21d659..19c9608672 100644 --- a/internal/gitlab/http_client.go +++ b/internal/gitlab/http_client.go @@ -174,7 +174,7 @@ func (c *HTTPClient) Allowed(ctx context.Context, params AllowedParams) (bool, s Env: gitObjDirVars, PushOptions: params.PushOptions, ClientContext: params.ClientContext, - PipelineID: params.GL_PipelineID, + PipelineID: params.GLPipelineID, } if err := req.parseAndSetGLID(params.GLID); err != nil { -- GitLab