-
-
Notifications
You must be signed in to change notification settings - Fork 16
/
yolopb.proto
404 lines (330 loc) · 12.4 KB
/
yolopb.proto
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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
// notes: https://hackmd.io/@moul/BkWL_pmS8
syntax = "proto3";
package yolo;
import "google/api/annotations.proto";
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
import "google/protobuf/timestamp.proto";
option go_package = "berty.tech/yolo/go/pkg/yolopb";
option (gogoproto.sizer_all) = true;
option (gogoproto.marshaler_all) = true;
option (gogoproto.unmarshaler_all) = true;
service YoloService {
rpc Ping(Ping.Request) returns (Ping.Response) { option (google.api.http) = {get: "/ping"}; };
rpc Status(Status.Request) returns (Status.Response) { option (google.api.http) = {get: "/status"}; };
rpc BuildList(BuildList.Request) returns (BuildList.Response) { option (google.api.http) = {get: "/build-list"}; }
rpc BuildListFilters(BuildListFilters.Request) returns (BuildListFilters.Response) { option (google.api.http) = {get: "/build-list-filters"}; }
rpc DevDumpObjects(DevDumpObjects.Request) returns (DevDumpObjects.Response) { option (google.api.http) = {get: "/dev-dump-objects"}; }
}
//
// RPC Requests & Responses
//
message Ping {
message Request {}
message Response {}
}
message DevDumpObjects {
message Request {
bool with_preloading = 1;
}
message Response {
Batch batch = 1;
repeated Download downloads = 2;
}
}
message Status {
message Request {}
message Response {
int32 uptime = 1;
string db_err = 2;
/// stats
int32 nb_entities = 10;
int32 nb_projects = 11;
int32 nb_commits = 12;
int32 nb_releases = 13;
int32 nb_builds = 14;
int32 nb_merge_requests = 15;
}
}
message BuildList {
message Request {
// max amount of builds
int32 limit = 1;
// filter on artifact kinds
repeated Artifact.Kind artifact_kinds = 2;
// filter builds without any artifacts
bool with_artifacts = 3;
// only a specific build by its ID or yolo_id
repeated string build_id = 4 [(gogoproto.customname) = "BuildID"];
// builds of a specific project by its ID or yolo_id
repeated string project_id = 5 [(gogoproto.customname) = "ProjectID"];
// filter on builds that contain at least on of these artifacts
repeated string artifact_id = 6 [(gogoproto.customname) = "ArtifactID"];
// filter by build driver (GitHub, CircleCI, ...)
repeated Driver build_driver = 7;
// filter by state of build (passed, running, failed, etc)
repeated Build.State build_state = 8;
// filter on builds for a specific merge request
repeated string mergerequest_id = 9 [(gogoproto.customname) = "MergeRequestID"];
// filter on builds linked to the merge requests opened by a specific author
repeated string mergerequest_author_id = 10 [(gogoproto.customname) = "MergeRequestAuthorID"];
// filter on builds with a linked merge request
bool with_mergerequest = 11;
// filter on builds with a linked merge request of a specific state
repeated MergeRequest.State mergerequest_state = 12;
// filter on branch
repeated string branch = 13;
// filter builds with merge requests
bool with_no_mergerequest = 14;
// sort by commit date
bool sort_by_commit_date = 15;
}
message Response {
repeated Build builds = 1;
}
}
message BuildListFilters {
message Request {}
message Response {
repeated Entity entities = 1;
repeated Project projects = 2;
// FIXME: authors
// FIXME: branchs?
}
}
//
// DB Schemas
//
message MetadataOverride {
string branch = 11;
string has_commit_id = 103 [(gogoproto.customname) = "HasCommitID"];
string has_project_id = 105 [(gogoproto.customname) = "HasProjectID"];
string has_mergerequest_id = 107 [(gogoproto.customname) = "HasMergeRequestID"];
}
message Build {
/// fields
string id = 1 [(gogoproto.moretags) = "gorm:\"primary_key\"", (gogoproto.customname) = "ID"];
string yolo_id = 2 [(gogoproto.customname) = "YoloID"]; // hash
google.protobuf.Timestamp created_at = 3 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true];
google.protobuf.Timestamp updated_at = 4 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true];
State state = 5;
google.protobuf.Timestamp completed_at = 6 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true];
string message = 7;
google.protobuf.Timestamp started_at = 8 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true];
google.protobuf.Timestamp finished_at = 9 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true];
string commit_url = 10 [(gogoproto.customname) = "CommitURL"];
string branch = 11;
Driver driver = 12;
string short_id = 13 [(gogoproto.customname) = "ShortID"];
string vcs_tag = 14 [(gogoproto.customname) = "VCSTag"];
string vcs_tag_url = 15 [(gogoproto.customname) = "VCSTagURL"];
/// relationships
string raw_branch = 21;
Commit has_raw_commit = 22;
Project has_raw_project = 23;
MergeRequest has_raw_mergerequest = 24;
string has_raw_commit_id = 25 [(gogoproto.customname) = "HasRawCommitID"];
string has_raw_project_id = 26 [(gogoproto.customname) = "HasRawProjectID"];
string has_raw_mergerequest_id = 27 [(gogoproto.customname) = "HasRawMergerequestID"];
repeated Artifact has_artifacts = 101 [(gogoproto.moretags) = "gorm:\"foreignkey:HasBuildID\""];
Commit has_commit = 102;
string has_commit_id = 103 [(gogoproto.customname) = "HasCommitID"];
Project has_project = 104;
string has_project_id = 105 [(gogoproto.customname) = "HasProjectID"];
MergeRequest has_mergerequest = 106;
string has_mergerequest_id = 107 [(gogoproto.customname) = "HasMergerequestID"];
/// enums
enum State {
UnknownState = 0;
Running = 1;
Failed = 2;
Passed = 3;
Canceled = 4;
Scheduled = 5;
Skipped = 6;
NotRun = 7;
Timedout = 8;
}
}
message Release {
/// fields
string id = 1 [(gogoproto.moretags) = "gorm:\"primary_key\"", (gogoproto.customname) = "ID"];
string yolo_id = 2 [(gogoproto.customname) = "YoloID"]; // hash
google.protobuf.Timestamp created_at = 3 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true];
google.protobuf.Timestamp updated_at = 4 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true];
string message = 5;
Driver driver = 6;
string commit_url = 7 [(gogoproto.customname) = "CommitURL"];
string short_id = 8 [(gogoproto.customname) = "ShortID"];
/// relationships
repeated Artifact has_artifacts = 101;
Commit has_commit = 102;
Project has_project = 103;
MergeRequest has_mergerequest = 104;
}
message Commit {
/// fields
string id = 1 [(gogoproto.moretags) = "gorm:\"primary_key\"", (gogoproto.customname) = "ID"];
string yolo_id = 2 [(gogoproto.customname) = "YoloID"]; // hash
google.protobuf.Timestamp created_at = 3 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true];
google.protobuf.Timestamp updated_at = 4 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true];
string message = 5;
Driver driver = 6;
string branch = 7;
/// relationships
repeated Release has_releases = 101;
repeated Build has_builds = 102;
Project has_project = 103;
Entity has_author = 104;
MergeRequest has_mergerequest = 105;
}
message MergeRequest {
/// fields
string id = 1 [(gogoproto.moretags) = "gorm:\"primary_key\"", (gogoproto.customname) = "ID"];
string yolo_id = 2 [(gogoproto.customname) = "YoloID"]; // hash
google.protobuf.Timestamp created_at = 3 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true];
google.protobuf.Timestamp updated_at = 4 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true];
google.protobuf.Timestamp merged_at = 5 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true];
string title = 6;
string message = 7;
Driver driver = 8;
string branch = 9;
State state = 10;
string commit_url = 11 [(gogoproto.customname) = "CommitURL"];
string branch_url = 12 [(gogoproto.customname) = "BranchURL"];
string short_id = 13 [(gogoproto.customname) = "ShortID"];
// is WIP or Draft
bool is_wip = 14 [(gogoproto.customname) = "IsWIP"];
// labels
/// relationships
repeated Release has_releases = 101;
repeated Build has_builds = 102;
repeated Entity has_assignees = 103 [(gogoproto.moretags) = "gorm:\"many2many:mr_assignees\""];
repeated Entity has_reviewers = 104 [(gogoproto.moretags) = "gorm:\"many2many:mr_reviewers\""];
Project has_project = 105;
string has_project_id = 106 [(gogoproto.customname) = "HasProjectID"];
Entity has_author = 107;
string has_author_id = 108 [(gogoproto.customname) = "HasAuthorID"];
Commit has_commit = 109;
string has_commit_id = 110 [(gogoproto.customname) = "HasCommitID"];
/// enums
enum State {
UnknownState = 0;
Opened = 1;
Closed = 2;
Merged = 3;
}
}
message Project {
/// fields
string id = 1 [(gogoproto.moretags) = "gorm:\"primary_key\"", (gogoproto.customname) = "ID"];
string yolo_id = 2 [(gogoproto.customname) = "YoloID"]; // hash
google.protobuf.Timestamp created_at = 3 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true];
google.protobuf.Timestamp updated_at = 4 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true];
Driver driver = 5;
string name = 6;
string description = 7;
/// relationships
repeated Artifact has_artifacts = 101;
repeated Build has_builds = 102;
repeated Commit has_commits = 103;
repeated Release has_releases = 104;
repeated MergeRequest has_mergerequests = 105;
Entity has_owner = 106;
string has_owner_id = 107 [(gogoproto.customname) = "HasOwnerID"];
}
message Entity {
/// fields
string id = 1 [(gogoproto.moretags) = "gorm:\"primary_key\"", (gogoproto.customname) = "ID"];
string yolo_id = 2 [(gogoproto.customname) = "YoloID"]; // hash
google.protobuf.Timestamp created_at = 3 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true];
google.protobuf.Timestamp updated_at = 4 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true];
string name = 5;
Driver driver = 6;
string avatar_url = 7 [(gogoproto.customname) = "AvatarURL"];
Kind kind = 8;
string description = 9;
/// relationships
repeated Project has_projects = 101;
repeated Commit has_commits = 102;
repeated MergeRequest has_mergerequests = 103;
/// enums
enum Kind {
UnknownKind = 0;
User = 1;
Organization = 2;
Bot = 3;
}
}
message Artifact {
/// fields
string id = 1 [(gogoproto.moretags) = "gorm:\"primary_key\"", (gogoproto.customname) = "ID"];
string yolo_id = 2 [(gogoproto.customname) = "YoloID"]; // hash
google.protobuf.Timestamp created_at = 3 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true];
google.protobuf.Timestamp updated_at = 4 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true];
int64 file_size = 5;
string local_path = 6;
string download_url = 7 [(gogoproto.customname) = "DownloadURL"];
string mime_type = 8;
string sha1_sum = 9;
string sha256_sum = 10;
State state = 11;
Kind kind = 12;
Driver driver = 13;
string bundle_name = 14;
string bundle_version = 15;
string bundle_id = 16 [(gogoproto.customname) = "BundleID"];
string bundle_icon = 17;
/// relationships
Build has_build = 101;
string has_build_id = 102 [(gogoproto.customname) = "HasBuildID"];
Release has_release = 103;
string has_release_id = 104 [(gogoproto.customname) = "HasReleaseID"];
repeated Download downloads = 105;
int64 downloads_count = 106 [(gogoproto.moretags) = "sql:\"-\""];
/// non-stored fields
string dl_artifact_signed_url = 201 [(gogoproto.customname) = "DLArtifactSignedURL"];
string plist_signed_url = 202 [(gogoproto.customname) = "PListSignedURL"];
/// enums
enum State {
UnknownState = 0;
Finished = 1;
New = 2;
Error = 3;
Deleted = 4;
}
enum Kind {
UnknownKind = 0;
IPA = 1;
APK = 2;
DMG = 3;
}
}
//
// Internal objects
//
message Download {
int64 id = 1 [(gogoproto.moretags) = "gorm:\"PRIMARY_KEY;AUTO_INCREMENT\"", (gogoproto.customname) = "ID"];
google.protobuf.Timestamp created_at = 2 [(gogoproto.stdtime) = true, (gogoproto.nullable) = true];
Artifact has_artifact = 101;
string has_artifact_id = 102 [(gogoproto.customname) = "HasArtifactID"];
}
//
// Constants & Internal
//
enum Driver {
UnknownDriver = 0;
Buildkite = 1;
CircleCI = 2;
Bintray = 3;
GitHub = 4;
// ...
}
message Batch {
repeated Build builds = 1;
repeated Artifact artifacts = 2;
repeated Project projects = 3;
repeated Entity entities = 4;
repeated Release releases = 5;
repeated Commit commits = 6;
repeated MergeRequest merge_requests = 7;
}