forked from chef/automate
-
Notifications
You must be signed in to change notification settings - Fork 1
/
buf.yaml
445 lines (443 loc) · 20.2 KB
/
buf.yaml
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
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
################################################################################
# Protocol Buffers Linter Configuration
################################################################################
#
# This file configures the `buf` tool, you run buf's linter as `buf check lint`, or
# use `lint_all_protobuf_components` in the habitat studio.
#
# ## References:
#
# - Style Guide: https://buf.build/docs/style-guide/
# - Docs for individual checkers: https://buf.build/docs/lint-checkers
# - Config docs: https://buf.build/docs/lint-configuration
#
# ## Rationale For Exceptions
#
# We've adopted linting for protobufs for the same reason we have it for other
# kinds of code: avoid dangerous legal constructions, encourage consistent
# style, etc.
#
# This linter was adopted only after Automate was a mature product with
# compatibility constraints. Automate uses protocol buffers to generate the
# external REST API along with gRPC client and server code, the configuration
# data structures exposed to end users, &etc. Thus, some portions of the
# protocol buffer codebase are constrained to remain compatible:
# - At the protobuf message level
# - At the JSON representation level
# - At the JSON generation/consumption level (e.g., golang struct tags)
# - At the generated code level
# To maintain compatibility at all of these layers, we must keep some of the
# protobuf code as-is, in violation of the style guide. This applies broadly to
# all of the pre-existing code in api/external, some API code in
# components/automate-gateway, the configuration protobufs, and a handful of
# special cases. Unless noted otherwise, the style guide exceptions configured
# here are intended only to cover older code. Follow the style guide whenever
# you can do so without breaking things.
build:
roots:
- api
- components
- lib
- protovendor/github.com/googleapis/googleapis
- protovendor/github.com/grpc-ecosystem/grpc-gateway
- protovendor/github.com/envoyproxy/protoc-gen-validate
excludes:
- components/notifications-service/
- components/automate-grpc/protoc-gen-policy/testdata
- protovendor/github.com/googleapis/googleapis/google/api/expr
- protovendor/github.com/googleapis/googleapis/google/api/servicecontrol
- protovendor/github.com/googleapis/googleapis/google/api/servicemanagement
- protovendor/github.com/envoyproxy/protoc-gen-validate/license
- protovendor/github.com/envoyproxy/protoc-gen-validate/java/
- protovendor/github.com/grpc-ecosystem/grpc-gateway/third_party
- protovendor/github.com/grpc-ecosystem/grpc-gateway/runtime/internal/examplepb
lint:
allow_comment_ignores: true
use:
- DEFAULT
except:
# This linter requires your proto package names to end with .v1 or similar.
# Adopting this for existing code would break anyone using our protos
- PACKAGE_VERSION_SUFFIX
# buf wants you to use a file hierarchy that matches your proto package
# names, but this is difficult and probably breaking to adopt now
- PACKAGE_SAME_DIRECTORY
- PACKAGE_DIRECTORY_MATCH
ignore_only:
SERVICE_SUFFIX:
# TODO: [notifications rewrite] - this violation can be addressed once
# the golang rewrite of notifications is completed
- interservice/notifications/service/server.proto
# The automate-cli accesses the `Deployment` service directly; making
# changes to it makes the CLI unable to install older versions of
# Automate, which is breaking.
- interservice/deployment/automate_deployment.proto
# The automate-cli diagnostics accesses the `Purge` service directly; making
# changes to it makes upgrade tests fail. This is less breaking, but hard
# to change.
- interservice/data_lifecycle/purge.proto
# /api/
- external/cds/cds.proto
- external/cfgmgmt/cfgmgmt.proto
- external/data_lifecycle/data_lifecycle.proto
- external/iam/v2/introspect.proto
- external/iam/v2/policy.proto
- external/iam/v2/rules.proto
- external/iam/v2/teams.proto
- external/iam/v2/tokens.proto
- external/iam/v2/users.proto
- external/infra_proxy/infra_proxy.proto
- external/ingest/chef.proto
- external/ingest/job_scheduler.proto
# /components/
- automate-gateway/api/deployment/deployment.proto
- automate-gateway/api/event_feed/event_feed.proto
- automate-gateway/api/gateway/gateway.proto
- automate-gateway/api/legacy/legacy.proto
- automate-gateway/api/license/license.proto
- automate-gateway/api/notifications/notifications.proto
- automate-gateway/api/telemetry/telemetry.proto
# /lib/
- grpc/debug/debug_api/debug.proto
RPC_REQUEST_STANDARD_NAME:
# TODO: [notifications rewrite] - this violation can be addressed once
# the golang rewrite of notifications is completed
- interservice/notifications/service/server.proto
# /api/
- external/applications/applications.proto
- external/cds/cds.proto
- external/cfgmgmt/cfgmgmt.proto
- external/compliance/profiles/profiles.proto
- external/compliance/reporting/reporting.proto
- external/compliance/reporting/stats/stats.proto
- external/compliance/scanner/jobs/jobs.proto
- external/data_feed/data_feed.proto
- external/iam/v2/introspect.proto
- external/iam/v2/policy.proto
- external/iam/v2/rules.proto
- external/iam/v2/teams.proto
- external/iam/v2/tokens.proto
- external/iam/v2/users.proto
- external/infra_proxy/infra_proxy.proto
- external/ingest/chef.proto
- external/ingest/job_scheduler.proto
- external/nodes/manager/manager.proto
- external/nodes/nodes.proto
- external/secrets/secrets.proto
- external/user_settings/user_settings.proto
# deployment interservice is exposed to automate-cli, we treat it like an external API
- interservice/deployment/automate_deployment.proto
# These interservice protos could be changed but the churn is very large:
- interservice/authn/tokens.proto
- interservice/authz/authz.proto
- interservice/authz/policy.proto
- interservice/authz/project.proto
- interservice/cds/service/cds.proto
- interservice/cfgmgmt/service/cfgmgmt.proto
- interservice/compliance/ingest/ingest/compliance.proto
- interservice/compliance/jobs/jobs.proto
- interservice/compliance/profiles/profiles.proto
- interservice/compliance/reporting/reporting.proto
- interservice/compliance/stats/stats.proto
- interservice/compliance/status/status.proto
- interservice/compliance/version/version.proto
- interservice/deployment/certificate_authority.proto
- interservice/es_sidecar/service.proto
- interservice/event_feed/event_feed.proto
- interservice/id_token/id_token.proto
- interservice/infra_proxy/service/infra_proxy.proto
- interservice/ingest/automate_event.proto
- interservice/ingest/chef.proto
- interservice/ingest/job_scheduler.proto
- interservice/ingest/status.proto
- interservice/local_user/users.proto
- interservice/nodemanager/manager/manager.proto
- interservice/nodemanager/nodes/nodes.proto
- interservice/pg_sidecar/service.proto
- interservice/teams/teams.proto
- interservice/user_settings/user_settings.proto
# /components/
- automate-gateway/api/deployment/deployment.proto
- automate-gateway/api/event_feed/event_feed.proto
- automate-gateway/api/gateway/gateway.proto
- automate-gateway/api/legacy/legacy.proto
- automate-gateway/api/license/license.proto
- automate-gateway/api/notifications/notifications.proto
- automate-gateway/api/telemetry/telemetry.proto
# /lib/
- grpc/debug/debug_api/debug.proto
RPC_RESPONSE_STANDARD_NAME:
# TODO: [notifications rewrite] - this violation can be addressed once
# the golang rewrite of notifications is completed
- interservice/notifications/service/server.proto
# /api/
- external/applications/applications.proto
- external/cds/cds.proto
- external/cfgmgmt/cfgmgmt.proto
- external/compliance/profiles/profiles.proto
- external/compliance/reporting/reporting.proto
- external/compliance/reporting/stats/stats.proto
- external/compliance/scanner/jobs/jobs.proto
- external/data_feed/data_feed.proto
- external/iam/v2/introspect.proto
- external/iam/v2/policy.proto
- external/iam/v2/rules.proto
- external/iam/v2/teams.proto
- external/iam/v2/tokens.proto
- external/iam/v2/users.proto
- external/infra_proxy/infra_proxy.proto
- external/ingest/chef.proto
- external/ingest/job_scheduler.proto
- external/nodes/manager/manager.proto
- external/nodes/nodes.proto
- external/secrets/secrets.proto
- external/user_settings/user_settings.proto
# deployment interservice is exposed to automate-cli, we treat it like an external API
- interservice/deployment/automate_deployment.proto
# These interservice protos could be changed but the churn is very large:
- interservice/authn/tokens.proto
- interservice/authz/authz.proto
- interservice/authz/policy.proto
- interservice/authz/project.proto
- interservice/cds/service/cds.proto
- interservice/cfgmgmt/service/cfgmgmt.proto
- interservice/compliance/ingest/ingest/compliance.proto
- interservice/compliance/jobs/jobs.proto
- interservice/compliance/profiles/profiles.proto
- interservice/compliance/reporting/reporting.proto
- interservice/compliance/stats/stats.proto
- interservice/compliance/status/status.proto
- interservice/compliance/version/version.proto
- interservice/deployment/certificate_authority.proto
- interservice/es_sidecar/service.proto
- interservice/event_feed/event_feed.proto
- interservice/infra_proxy/service/infra_proxy.proto
- interservice/ingest/automate_event.proto
- interservice/ingest/chef.proto
- interservice/ingest/job_scheduler.proto
- interservice/ingest/status.proto
- interservice/local_user/users.proto
- interservice/nodemanager/manager/manager.proto
- interservice/nodemanager/nodes/nodes.proto
- interservice/pg_sidecar/service.proto
- interservice/teams/teams.proto
- interservice/user_settings/user_settings.proto
# /components/
- automate-gateway/api/deployment/deployment.proto
- automate-gateway/api/event_feed/event_feed.proto
- automate-gateway/api/gateway/gateway.proto
- automate-gateway/api/legacy/legacy.proto
- automate-gateway/api/license/license.proto
- automate-gateway/api/notifications/notifications.proto
- automate-gateway/api/telemetry/telemetry.proto
# /lib/
- grpc/debug/debug_api/debug.proto
RPC_REQUEST_RESPONSE_UNIQUE:
# TODO: [notifications rewrite] - this violation can be addressed once
# the golang rewrite of notifications is completed
- interservice/notifications/service/server.proto
# /api/
- external/applications/applications.proto
- external/cds/cds.proto
- external/cfgmgmt/cfgmgmt.proto
- external/compliance/profiles/profiles.proto
- external/compliance/reporting/reporting.proto
- external/compliance/reporting/stats/stats.proto
- external/compliance/scanner/jobs/jobs.proto
- external/data_feed/data_feed.proto
- external/iam/v2/introspect.proto
- external/iam/v2/policy.proto
- external/iam/v2/rules.proto
- external/iam/v2/teams.proto
- external/iam/v2/tokens.proto
- external/iam/v2/users.proto
- external/infra_proxy/infra_proxy.proto
- external/ingest/chef.proto
- external/ingest/job_scheduler.proto
- external/nodes/manager/manager.proto
- external/nodes/nodes.proto
- external/secrets/secrets.proto
- external/user_settings/user_settings.proto
# deployment interservice is exposed to automate-cli, we treat it like an external API
- interservice/deployment/automate_deployment.proto
# These interservice protos could be changed but the churn is very large:
- interservice/authn/tokens.proto
- interservice/authz/authz.proto
- interservice/authz/policy.proto
- interservice/authz/project.proto
- interservice/cds/service/cds.proto
- interservice/cfgmgmt/service/cfgmgmt.proto
- interservice/compliance/ingest/ingest/compliance.proto
- interservice/compliance/jobs/jobs.proto
- interservice/compliance/profiles/profiles.proto
- interservice/compliance/reporting/reporting.proto
- interservice/compliance/stats/stats.proto
- interservice/compliance/status/status.proto
- interservice/compliance/version/version.proto
- interservice/deployment/certificate_authority.proto
- interservice/es_sidecar/service.proto
- interservice/event_feed/event_feed.proto
- interservice/infra_proxy/service/infra_proxy.proto
- interservice/ingest/automate_event.proto
- interservice/ingest/chef.proto
- interservice/ingest/job_scheduler.proto
- interservice/ingest/status.proto
- interservice/local_user/users.proto
- interservice/nodemanager/manager/manager.proto
- interservice/nodemanager/nodes/nodes.proto
- interservice/pg_sidecar/service.proto
- interservice/teams/teams.proto
- interservice/user_settings/user_settings.proto
# /components/
- automate-gateway/api/deployment/deployment.proto
- automate-gateway/api/event_feed/event_feed.proto
- automate-gateway/api/gateway/gateway.proto
- automate-gateway/api/legacy/legacy.proto
- automate-gateway/api/license/license.proto
- automate-gateway/api/notifications/notifications.proto
- automate-gateway/api/telemetry/telemetry.proto
# /lib/
- grpc/debug/debug_api/debug.proto
PACKAGE_SAME_GO_PACKAGE:
# /api/
- external/iam/v2
- config
- interservice/authz
- interservice/authn
- interservice/cereal
- interservice/deployment
- interservice/es_sidecar
- interservice/ingest
- interservice/license_control
- interservice/local_user
- interservice/pg_sidecar
- interservice/teams
# /components/
- automate-gateway/api/gateway
- automate-grpc/protoc-gen-a2-config/api/a2conf
FIELD_LOWER_SNAKE_CASE:
# TODO: [notifications rewrite] - this violation can be addressed once
# the golang rewrite of notifications is completed
- interservice/notifications/service/events.proto
- interservice/notifications/service/rules.proto
- external/infra_proxy/response/policyfiles.proto
# /component/
- automate-gateway/api/notifications/notifications.proto
- automate-deployment/pkg/persistence/boltdb/internal/v1/schema/v1.proto
ENUM_VALUE_UPPER_SNAKE_CASE:
# TODO: [notifications rewrite] - this violation can be addressed once
# the golang rewrite of notifications is completed
- interservice/notifications/service/rules.proto
- automate-gateway/api/notifications/notifications.proto
ENUM_VALUE_PREFIX:
# TODO: [notifications rewrite] - this violation can be addressed once
# the golang rewrite of notifications is completed
- interservice/notifications/service/rules.proto
# /api/
- external/applications/applications.proto
- external/common/query/parameters.proto
- external/compliance/profiles/profiles.proto
- external/compliance/reporting/reporting.proto
- external/compliance/reporting/stats/stats.proto
- external/compliance/scanner/jobs/jobs.proto
- external/iam/v2/common/policy.proto
- external/iam/v2/common/rules.proto
- external/nodes/manager/manager.proto
- external/nodes/nodes.proto
- external/secrets/secrets.proto
- external/user_settings/user_settings.proto
# deployment interservice is exposed to automate-cli, we treat it like an external API
- interservice/deployment/automate_deployment.proto
# Used to parse external JSON:
- interservice/compliance/profiles/profiles.proto
- interservice/compliance/jobs/jobs.proto
- interservice/compliance/reporting/reporting.proto
# The following interservice proto APIs could (should?) be updated to
# follow the style guide, but the churn impact is large.
- interservice/authz/policy.proto
- interservice/authz/project.proto
- interservice/authz/type.proto
- interservice/cfgmgmt/request/parameters.proto
- interservice/compliance/stats/stats.proto
- interservice/compliance/status/status.proto
- interservice/es_sidecar/service.proto
- interservice/nodemanager/manager/manager.proto
- interservice/nodemanager/nodes/nodes.proto
- interservice/pg_sidecar/service.proto
- interservice/user_settings/user_settings.proto
# /components/
- automate-deployment/pkg/persistence/boltdb/internal/v1/schema/v1.proto
- automate-gateway/api/notifications/notifications.proto
# /lib/
- grpc/debug/debug_api/debug.proto
ENUM_ZERO_VALUE_SUFFIX:
# TODO: [notifications rewrite] - this violation can be addressed once
# the golang rewrite of notifications is completed
- interservice/notifications/service/events.proto
- interservice/notifications/service/rules.proto
# /api/
- external/applications/applications.proto
- external/common/query/parameters.proto
- external/compliance/profiles/profiles.proto
- external/compliance/reporting/reporting.proto
- external/compliance/reporting/stats/stats.proto
- external/compliance/scanner/jobs/jobs.proto
- external/iam/v2/common/policy.proto
- external/iam/v2/common/rules.proto
- external/nodes/manager/manager.proto
- external/nodes/nodes.proto
- external/secrets/secrets.proto
- external/user_settings/user_settings.proto
# deployment protos are used by the CLI and can't be changed
- interservice/authz/policy.proto
# compliance protos used to parse external JSON:
- interservice/compliance/jobs/jobs.proto
- interservice/compliance/profiles/profiles.proto
- interservice/compliance/reporting/reporting.proto
# These could be changed
- interservice/authz/project.proto
- interservice/authz/type.proto
- interservice/cfgmgmt/request/parameters.proto
- interservice/compliance/stats/stats.proto
- interservice/compliance/status/status.proto
- interservice/deployment/automate_deployment.proto
- interservice/es_sidecar/service.proto
- interservice/nodemanager/manager/manager.proto
- interservice/nodemanager/nodes/nodes.proto
- interservice/pg_sidecar/service.proto
- interservice/user_settings/user_settings.proto
# /components/
- automate-deployment/pkg/persistence/boltdb/internal/v1/schema/v1.proto
- automate-gateway/api/notifications/notifications.proto
# /lib/
- grpc/debug/debug_api/debug.proto
MESSAGE_PASCAL_CASE:
- config/dex/config_request.proto
PACKAGE_DEFINED:
- automate-deployment/pkg/persistence/boltdb/internal/v1/schema/v1.proto
ignore:
- protoc-gen-swagger # grpc gateway
- internal # grpc gateway
- grafeas # googleapis
- google # googleapis
- validate # envoyproxy/protoc-gen-validate
- gogoproto # envoyproxy/protoc-gen-validate
- external/habitat/event.proto # this file is owned by habitat and copied here
breaking:
use:
- PACKAGE
ignore:
# Changes to interservice APIs are okay until (if ever) we support clusters
# of interconnected internal services that would not upgrade in unison
- interservice
# If you NEED to make just one change to something else and have consensus
# it's the best/least bad option, you can add it here and remove it in a
# later PR:
# - external/oops/oops.proto
- external/infra_proxy/request/nodes.proto
- external/infra_proxy/response/nodes.proto
- external/infra_proxy/infra_proxy.proto
- external/infra_proxy/request/roles.proto
- external/infra_proxy/response/roles.proto
- external/compliance/reporting/reporting.proto
- config/ui/config_request.proto