1syntax = "proto3";
2
3package gitaly;
4
5option go_package = "gitlab.com/gitlab-org/gitaly/v14/proto/go/gitalypb";
6
7import "lint.proto";
8import "shared.proto";
9
10service RemoteService {
11    rpc AddRemote(AddRemoteRequest) returns (AddRemoteResponse) {
12      option (op_type) = {
13        op: MUTATOR
14      };
15    }
16    rpc FetchInternalRemote(FetchInternalRemoteRequest) returns (FetchInternalRemoteResponse) {
17      option (op_type) = {
18        op: MUTATOR
19      };
20    }
21    rpc RemoveRemote(RemoveRemoteRequest) returns (RemoveRemoteResponse) {
22      option (op_type) = {
23        op: MUTATOR
24      };
25    }
26
27    // UpdateRemoteMirror compares the references in the target repository and its remote mirror
28    // repository. Any differences in the references are then addressed by pushing the differing
29    // references to the mirror. Created and modified references are updated, removed references are
30    // deleted from the mirror. UpdateRemoteMirror updates all tags. Branches are updated if they match
31    // the patterns specified in the requests.
32    rpc UpdateRemoteMirror(stream UpdateRemoteMirrorRequest) returns (UpdateRemoteMirrorResponse) {
33      option (op_type) = {
34        op: ACCESSOR
35      };
36    }
37    rpc FindRemoteRepository(FindRemoteRepositoryRequest) returns (FindRemoteRepositoryResponse) {
38      option (op_type) = {
39        op: ACCESSOR
40        scope_level: STORAGE
41      };
42    }
43
44    // FindRemoteRootRef tries to find the root reference of a remote
45    // repository. The root reference is the default branch as pointed to by
46    // the remotes HEAD reference. Returns an InvalidArgument error if the
47    // specified remote does not exist and a NotFound error in case no HEAD
48    // branch was found.
49    rpc FindRemoteRootRef(FindRemoteRootRefRequest) returns (FindRemoteRootRefResponse) {
50      option (op_type) = {
51        op: ACCESSOR
52      };
53    }
54}
55
56message AddRemoteRequest {
57  Repository repository = 1 [(target_repository)=true];
58  string name = 2;
59  string url = 3;
60  // DEPRECATED: https://gitlab.com/gitlab-org/gitaly/proto/merge_requests/137
61  reserved 4;
62  reserved "mirror_refmap";
63  // If any, the remote is configured as a mirror with those mappings
64  repeated string mirror_refmaps = 5;
65}
66
67message AddRemoteResponse {}
68
69message RemoveRemoteRequest {
70  Repository repository = 1 [(target_repository)=true];
71  string name = 2;
72}
73
74message RemoveRemoteResponse {
75  bool result = 1;
76}
77
78message FetchInternalRemoteRequest {
79  Repository repository = 1 [(target_repository)=true];
80  Repository remote_repository = 2;
81}
82
83message FetchInternalRemoteResponse {
84  bool result = 1;
85}
86
87message UpdateRemoteMirrorRequest {
88  // repository is the repository whose mirror repository to update.
89  Repository repository = 1 [(target_repository)=true];
90  // ref_name is actually the remote to update.
91  string ref_name = 2;
92  // only_branches_matching contains patterns to match branches against. Only
93  // the matched brances are updated in the remote mirror. If no patterns are
94  // specified, all branches are updated. The patterns should only contain the
95  // branch name without the 'refs/heads/' prefix. "*" can be used as a wildcard
96  // to match anything. only_branches_matching can be streamed to the server over multiple
97  // messages. Optional.
98  repeated bytes only_branches_matching = 3;
99  // ssh_key is the SSH key to use for accessing to the mirror repository. Optional.
100  string ssh_key = 4;
101  // known_hosts specifies the identities used for strict host key checking. Optional.
102  string known_hosts = 5;
103  // keep_divergent_refs specifies whether or not to update diverged references in the
104  // mirror repository.
105  bool keep_divergent_refs = 6;
106}
107
108message UpdateRemoteMirrorResponse {
109  // divergent_refs contains a list of references that had diverged in the mirror from the
110  // source repository.
111  repeated bytes divergent_refs = 1;
112}
113
114message FindRemoteRepositoryRequest {
115  string remote = 1;
116  // This field is used to redirect request to proper storage where it can be handled.
117  // As of now it doesn't matter what storage will be used, but it still must be a valid.
118  // For more details: https://gitlab.com/gitlab-org/gitaly/-/issues/2442
119  string storage_name = 2 [(storage)=true];
120}
121
122// This migth throw a GRPC Unavailable code, to signal the request failure
123// is transient.
124message FindRemoteRepositoryResponse {
125  bool exists = 1;
126}
127
128// FindRemoteRootRefRequest represents a request for the FindRemoteRootRef RPC.
129message FindRemoteRootRefRequest {
130  // Repository is the repository in which the request shall be executed in. If
131  // a remote name is given, then this is the repository in which the remote
132  // will be looked up.
133  Repository repository = 1 [(target_repository)=true];
134  // Remote is the name of the remote of which the root reference shall be
135  // looked up. The remote must have been created before this call. This
136  // parameter is deprecated in favor of `RemoteUrl`, see
137  // https://gitlab.com/gitlab-org/gitaly/-/issues/1773.
138  string remote = 2 [deprecated=true];
139  // RemoteUrl specifies the remote repository URL which should be fetched from.
140  string remote_url = 3;
141  // HttpAuthorizationHeader is the HTTP header which should be added to the
142  // request in order to authenticate against the repository.
143  string http_authorization_header = 4;
144}
145
146// FindRemoteRootRefResponse represents the response for the FindRemoteRootRef
147// request.
148message FindRemoteRootRefResponse {
149  // Ref is the name of the remote root reference.
150  string ref = 1;
151}
152
153message ListRemotesRequest {
154   Repository repository = 1 [(target_repository)=true];
155}
156
157message ListRemotesResponse {
158  message Remote {
159    string name = 1;
160    string fetch_url = 2;
161    string push_url = 3;
162  }
163
164  repeated Remote remotes = 1;
165}
166