Welcome to mirror list, hosted at ThFree Co, Russian Federation.

hook.proto « proto - gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 87325a465f521da336f633821b8a6ea9d6376b85 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
syntax = "proto3";

package gitaly;

import "lint.proto";
import "shared.proto";

option go_package = "gitlab.com/gitlab-org/gitaly/v16/proto/go/gitalypb";

// HookService is a service which provides the implementation of a subset of
// Git hooks. These are typically invoked via the `gitaly-hooks` binary to
// ensure that the actual hook logic is executed in the context of the server.
service HookService {

  // PreReceiveHook ...
  rpc PreReceiveHook(stream PreReceiveHookRequest) returns (stream PreReceiveHookResponse) {
    option (op_type) = {
      op: ACCESSOR
    };
  }

  // PostReceiveHook ...
  rpc PostReceiveHook(stream PostReceiveHookRequest) returns  (stream PostReceiveHookResponse) {
    option (op_type) = {
      op: ACCESSOR
    };
  }

  // UpdateHook ...
  rpc UpdateHook(UpdateHookRequest) returns (stream UpdateHookResponse) {
    option (op_type) = {
      op: ACCESSOR
    };
  }

  // ReferenceTransactionHook ...
  rpc ReferenceTransactionHook(stream ReferenceTransactionHookRequest) returns (stream ReferenceTransactionHookResponse) {
    option (op_type) = {
      op: ACCESSOR
    };
  }

  // PackObjectsHookWithSidechannel is an optimized version of PackObjectsHook that uses
  // a unix socket side channel.
  rpc PackObjectsHookWithSidechannel(PackObjectsHookWithSidechannelRequest) returns (PackObjectsHookWithSidechannelResponse) {
    option (op_type) = {
      op: ACCESSOR
    };
  }

  // ProcReceiveHook is a hook invoked by git-receive-pack(1) [1]. This hook is responsible
  // for updating the relevant references and reporting the results back to receive-pack.
  //
  // [1]: https://git-scm.com/docs/githooks#proc-receive
  rpc ProcReceiveHook(stream ProcReceiveHookRequest) returns (stream ProcReceiveHookResponse) {
    option (op_type) = {
      op: MUTATOR
    };
  };
}

// PreReceiveHookRequest ...
message PreReceiveHookRequest {
  // repository ...
  Repository repository = 1 [(target_repository)=true];
  // environment_variables ...
  repeated string environment_variables = 2;
  // stdin ...
  bytes stdin = 4;
  // git_push_options ...
  repeated string git_push_options = 5;
}

// PreReceiveHookResponse ...
message PreReceiveHookResponse{
  // stdout ...
  bytes stdout = 1;
  // stderr ...
  bytes stderr = 2;
  // exit_status ...
  ExitStatus exit_status = 3;
}

// PostReceiveHookRequest ...
message PostReceiveHookRequest {
  // repository ...
  Repository repository = 1 [(target_repository)=true];
  // environment_variables ...
  repeated string environment_variables = 2;
  // stdin ...
  bytes stdin = 3;
  // git_push_options ...
  repeated string git_push_options = 4;
}

// PostReceiveHookResponse ...
message PostReceiveHookResponse{
  // stdout ...
  bytes stdout = 1;
  // stderr ...
  bytes stderr = 2;
  // exit_status ...
  ExitStatus exit_status = 3;
}

// UpdateHookRequest ...
message UpdateHookRequest {
  // repository ...
  Repository repository = 1 [(target_repository)=true];
  // environment_variables ...
  repeated string environment_variables = 2;
  // ref ...
  bytes ref = 3;
  // old_value ...
  string old_value = 4;
  // new_value ...
  string new_value = 5;
}

// UpdateHookResponse ...
message UpdateHookResponse{
  // stdout ...
  bytes stdout = 1;
  // stderr ...
  bytes stderr = 2;
  // exit_status ...
  ExitStatus exit_status = 3;
}

// ReferenceTransactionHookRequest ...
message ReferenceTransactionHookRequest {
  // State ...
  enum State {
    // PREPARED ...
    PREPARED = 0; // protolint:disable:this ENUM_FIELD_NAMES_PREFIX ENUM_FIELD_NAMES_ZERO_VALUE_END_WITH
    // COMMITTED ...
    COMMITTED = 1; // protolint:disable:this ENUM_FIELD_NAMES_PREFIX
    // ABORTED ...
    ABORTED = 2; // protolint:disable:this ENUM_FIELD_NAMES_PREFIX
  }

  // repository ...
  Repository repository = 1 [(target_repository)=true];
  // environment_variables ...
  repeated string environment_variables = 2;
  // stdin ...
  bytes stdin = 3;
  // state ...
  State state = 4;
}

// ReferenceTransactionHookResponse ...
message ReferenceTransactionHookResponse {
  // stdout ...
  bytes stdout = 1;
  // stderr ...
  bytes stderr = 2;
  // exit_status ...
  ExitStatus exit_status = 3;
}

// PackObjectsHookWithSidechannelRequest ...
message PackObjectsHookWithSidechannelRequest {
  // repository ...
  Repository repository = 1 [(target_repository)=true];
  // args contains the arguments passed to the pack-objects hook, without the leading "git"
  repeated string args = 2;
  // gl_id is the user id of the initator of the fetch
  string gl_id = 3;
  // gl_username is the username of the initator of the fetch
  string gl_username = 5;
  // git_protocol is the protocol used for the fetch
  string git_protocol = 6;
  // remote_ip is the original IP of the initator of the fetch. This field is used as the key for
  // concurrency limiting before we trigger git-pack-objects command
  string remote_ip = 7;
}

// PackObjectsHookWithSidechannelResponse ...
message PackObjectsHookWithSidechannelResponse {
}

// ProcReceiveHookRequest is the request for the ProcReceiveHook RPC.
message ProcReceiveHookRequest {
  // repository is the repository the hook operates on. This field is unused
  // currently since we gather all information from stdin.
  Repository repository = 1 [(target_repository)=true];
  // environment_variables is the set of env variables to be passed to the RPC.
  repeated string environment_variables = 2;
  // stdin is a chunk of raw data which the hook receives.
  bytes stdin = 3;
}

// ProcReceiveHookResponse is the response for the ProcReceiveHook RPC.
message ProcReceiveHookResponse {
  // stdout is a chunk of raw data to be output to stdout of the hook.
  bytes stdout = 1;
  // stderr is a chunk of raw data to be output to stderr of the hook.
  bytes stderr = 2;
  // exit_status is the exit status that the hooks outputs, this dictates the
  // success/failure of git-receive-pack(1).
  ExitStatus exit_status = 3;
}