Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add initial Plugin specification #132

Merged
merged 51 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from 50 commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
e2a11ff
wip
mfridman Sep 25, 2024
aa08ddf
wip; pass format lint
mfridman Sep 25, 2024
2577109
disable push
mfridman Sep 25, 2024
2a1a374
Enable push
emcfarlane Sep 25, 2024
861779d
first pass at tidying up registry config
mfridman Sep 25, 2024
badc37d
wip
mfridman Sep 25, 2024
fa7e531
wip
mfridman Sep 25, 2024
c5e3a78
wip
mfridman Sep 25, 2024
0eac937
wip
mfridman Sep 25, 2024
a82217d
wip
mfridman Sep 25, 2024
dff06aa
wip
mfridman Sep 25, 2024
adb18e6
wip
emcfarlane Sep 26, 2024
69b571b
switch to commits and labels
emcfarlane Sep 26, 2024
0208156
wip
mfridman Sep 27, 2024
a3472e1
wip
mfridman Sep 27, 2024
af0c906
wip
mfridman Sep 27, 2024
df121ef
Update commit service and Digest P1
emcfarlane Oct 1, 2024
6887aab
add collection entity instead of enum
mfridman Oct 2, 2024
c0a6fdc
wip
mfridman Oct 2, 2024
7741a6b
fix lint
mfridman Oct 2, 2024
365a2e4
commit
mfridman Oct 2, 2024
b34ff09
commit
mfridman Oct 2, 2024
681ee14
fix collection id
emcfarlane Oct 3, 2024
bab5cf2
add plugin image uploads
emcfarlane Oct 8, 2024
a7468f6
update plugin create request
mfridman Oct 9, 2024
0badaec
update upload_service.proto
mfridman Oct 9, 2024
b1f3222
s/module/plugin and comments
mfridman Oct 9, 2024
3e44a69
update comment
mfridman Oct 16, 2024
fd48e8f
remove todo: digest
mfridman Oct 16, 2024
428ed38
remove todo: compression
mfridman Oct 16, 2024
04cb0ab
remove todo: source_url
mfridman Oct 16, 2024
69c0d42
cleanup field numbers
mfridman Oct 16, 2024
ab84720
Merge branch 'main' into mf/plugins
bufdev Oct 16, 2024
38293c9
remove legacy docker-based plugin definitions; misc cleanup
mfridman Oct 16, 2024
b687e13
remove compression type
mfridman Oct 16, 2024
9af8a88
copy plugin info and update comments
mfridman Oct 17, 2024
d9ba013
flatten and remove nested filter message
mfridman Oct 17, 2024
a801d90
update comment
mfridman Oct 17, 2024
6813f20
add scoped label refs to upload
mfridman Oct 18, 2024
4282fe1
updates following review
mfridman Oct 24, 2024
398d8e0
restore protovalidate for now
mfridman Oct 24, 2024
304e859
add partial collection_service.proto
mfridman Oct 24, 2024
c47e631
add source_control_url to upload
mfridman Oct 24, 2024
2e7c067
add collection service definitions; misc cleanup
mfridman Oct 24, 2024
624adc0
fix comment
mfridman Oct 24, 2024
b3ac2f4
use The for consistency
mfridman Oct 24, 2024
f6f7205
Add a limit to upload
mfridman Oct 24, 2024
3dee9d4
add GetPluginCollectionAssociations
mfridman Oct 24, 2024
1782bc5
rename from v1beta1 to v1
mfridman Oct 24, 2024
45eb887
add compression.proto and use in both upload and download
mfridman Oct 24, 2024
dea5e2a
rename from v1 to v1beta1
mfridman Oct 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions buf.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Generated by buf. DO NOT EDIT.
version: v2
deps:
- name: buf.build/bufbuild/bufplugin
commit: 42bdb4b676254830a221d52d10bf17be
digest: b5:c9fb96550e52b1b899f667d2371d2aee37b4b5b0d8e21d83dd620207d466f3a95b96fc072fe9a49785da293f1fe379f0b4ac8ce054b6a1cedcafba8f2145d086
- name: buf.build/bufbuild/protovalidate
commit: b983156c5e994cc9892e0ce3e64e17e0
digest: b5:a02a4a5a0a9306cf1391d17e8811bbd6a0dbd0e0e29ddfc34b9d103311164974472d43627c3d63e6a8abaffd6c7a301c4f7965bbab2dc56f7f7812429a84b812
1 change: 1 addition & 0 deletions buf.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
version: v2
name: buf.build/bufbuild/registry
deps:
- buf.build/bufbuild/bufplugin
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extreme nit: I would sort these alphabetically, to match the lock file

- buf.build/bufbuild/protovalidate
lint:
use:
Expand Down
65 changes: 65 additions & 0 deletions buf/registry/plugin/v1/collection.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// Copyright 2023-2024 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package buf.registry.plugin.v1;

import "buf/registry/priv/extension/v1beta1/extension.proto";
import "buf/validate/validate.proto";
import "google/protobuf/timestamp.proto";

option go_package = "buf.build/gen/go/bufbuild/registry/protocolbuffers/go/buf/registry/plugin/v1";

// A collection for a Plugin.
//
// These collections help organize plugins based on their functionality or ecosystem.
message Collection {
option (buf.registry.priv.extension.v1beta1.message).response_only = true;

// The id of the Collection.
string id = 1 [
(buf.validate.field).required = true,
(buf.validate.field).string.tuuid = true
];
// The time the Collection was created on the BSR.
google.protobuf.Timestamp create_time = 2 [(buf.validate.field).required = true];
// The last time the Collection was updated on the BSR.
google.protobuf.Timestamp update_time = 3 [(buf.validate.field).required = true];
// The name of the Collection.
//
// Unique within a BSR instance.
string name = 4 [
(buf.validate.field).required = true,
(buf.validate.field).string.max_len = 250
];
// The configurable description of the Collection.
string description = 5 [(buf.validate.field).string.max_len = 350];
}

// CollectionRef is a reference to a Collection, either an id or a name.
message CollectionRef {
option (buf.registry.priv.extension.v1beta1.message).request_only = true;

oneof value {
option (buf.validate.oneof).required = true;
// The id of the Collection.
string id = 1 [(buf.validate.field).string.tuuid = true];
// The name of the Collection.
string name = 2 [(buf.validate.field).string = {
min_len: 2
max_len: 100
}];
}
}
104 changes: 104 additions & 0 deletions buf/registry/plugin/v1/collection_service.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
// Copyright 2023-2024 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package buf.registry.plugin.v1;

import "buf/registry/plugin/v1/collection.proto";
import "buf/registry/plugin/v1/plugin.proto";
import "buf/validate/validate.proto";

option go_package = "buf.build/gen/go/bufbuild/registry/protocolbuffers/go/buf/registry/plugin/v1";

// Operate on Collections.
service CollectionService {
// Get Collections.
rpc GetCollections(GetCollectionsRequest) returns (GetCollectionsResponse) {
option idempotency_level = NO_SIDE_EFFECTS;
}
// List Collections for a given Plugin.
rpc ListCollections(ListCollectionsRequest) returns (ListCollectionsResponse) {
option idempotency_level = NO_SIDE_EFFECTS;
}
// Get the Collections for the given Plugins.
rpc GetPluginCollectionAssociations(GetPluginCollectionAssociationsRequest) returns (GetPluginCollectionAssociationsResponse) {
option idempotency_level = NO_SIDE_EFFECTS;
}
}

message GetCollectionsRequest {
// The Collections to request.
repeated CollectionRef collection_refs = 1 [
(buf.validate.field).repeated.min_items = 1,
(buf.validate.field).repeated.max_items = 250
];
}

message GetCollectionsResponse {
// The retrieved Collections in the same order as requested.
repeated Collection collections = 1 [(buf.validate.field).repeated.min_items = 1];
}

message ListCollectionsRequest {
// The list order.
enum Order {
ORDER_UNSPECIFIED = 0;
// Order by create_time newest to oldest.
ORDER_CREATE_TIME_DESC = 1;
// Order by create_time oldest to newest.
ORDER_CREATE_TIME_ASC = 2;
}
// The maximum number of items to return.
//
// The default value is 10.
uint32 page_size = 1 [(buf.validate.field).uint32.lte = 250];
// The page to start from.
//
// If empty, the first page is returned.
string page_token = 2 [(buf.validate.field).string.max_len = 4096];
// The order to return the Plugins.
//
// If not specified, defaults to ORDER_CREATE_TIME_DESC.
Order order = 3 [(buf.validate.field).enum.defined_only = true];
}

message ListCollectionsResponse {
// The next page token.
//
// If empty, there are no more pages.
string next_page_token = 1 [(buf.validate.field).string.max_len = 4096];
// The listed Collections.
repeated Collection collections = 2;
}

message GetPluginCollectionAssociationsRequest {
// The Plugins to request Collections for.
repeated PluginRef plugin_refs = 1 [
(buf.validate.field).repeated.min_items = 1,
(buf.validate.field).repeated.max_items = 250
];
}

message GetPluginCollectionAssociationsResponse {
// The Associations for the requested Plugins.
message Association {
// The id of the Plugin.
string plugin_id = 1;
// The collection ids associated with the Plugin.
repeated string collection_ids = 2;
}
// The Associations for the requested Plugins in the same order as requested.
repeated Association associations = 1;
}
78 changes: 78 additions & 0 deletions buf/registry/plugin/v1/commit.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
// Copyright 2023-2024 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package buf.registry.plugin.v1;

import "buf/plugin/info/v1/plugin_info.proto";
import "buf/registry/plugin/v1/digest.proto";
import "buf/registry/priv/extension/v1beta1/extension.proto";
import "buf/validate/validate.proto";
import "google/protobuf/timestamp.proto";

option go_package = "buf.build/gen/go/bufbuild/registry/protocolbuffers/go/buf/registry/plugin/v1";

// A commit on a specific Plugin.
//
// Commits are immutable.
//
// Many Commits may be associated with one Digest.
//
// Not that the Digest returned on a Commit depends on the requested DigestType in the RPC that
// returned the Commit.
message Commit {
option (buf.registry.priv.extension.v1beta1.message).response_only = true;

// The id of the Commit.
string id = 1 [
(buf.validate.field).required = true,
(buf.validate.field).string.tuuid = true
];
// The time the Commit was pushed to the BSR.
//
// Commits are immutable, so there is no corresponding update_time.
google.protobuf.Timestamp create_time = 2 [(buf.validate.field).required = true];
// The id of the Organization that owns the Plugin that the Commit is associated with.
string owner_id = 3 [
(buf.validate.field).required = true,
(buf.validate.field).string.tuuid = true
];
// The id of the Plugin that the Commit is associated with.
string plugin_id = 4 [
(buf.validate.field).required = true,
(buf.validate.field).string.tuuid = true
];
// The Digest of the Commit's contents.
Digest digest = 5 [(buf.validate.field).required = true];
// The id of the User that created this Commit on the BSR.
//
// May be empty if the User is no longer available.
string created_by_user_id = 6 [
(buf.validate.field).string.tuuid = true,
(buf.validate.field).ignore = IGNORE_IF_UNPOPULATED
];
// The URL of the source control commit that is associated with the Commit.
//
// BSR users can navigate to this link to find source control information that is relevant to this Commit
// (e.g. commit description, PR discussion, authors, approvers, etc.).
string source_control_url = 7 [
(buf.validate.field).string.uri = true,
(buf.validate.field).string.max_len = 255,
(buf.validate.field).ignore = IGNORE_IF_UNPOPULATED
];
// The plugin information as stored directly within the plugin. This is part of the Bufplugin API,
// and can be returned from a plugin's GetPluginInfo implementation.
buf.plugin.info.v1.PluginInfo plugin_info = 8;
}
114 changes: 114 additions & 0 deletions buf/registry/plugin/v1/commit_service.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
// Copyright 2023-2024 Buf Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package buf.registry.plugin.v1;

import "buf/registry/plugin/v1/commit.proto";
import "buf/registry/plugin/v1/digest.proto";
import "buf/registry/plugin/v1/resource.proto";
import "buf/validate/validate.proto";

option go_package = "buf.build/gen/go/bufbuild/registry/protocolbuffers/go/buf/registry/plugin/v1";

// Operate on Commits.
service CommitService {
// Get Commits.
rpc GetCommits(GetCommitsRequest) returns (GetCommitsResponse) {
option idempotency_level = NO_SIDE_EFFECTS;
}
// List Commits for a given Plugin, Label, or Commit.
rpc ListCommits(ListCommitsRequest) returns (ListCommitsResponse) {
option idempotency_level = NO_SIDE_EFFECTS;
}
}

message GetCommitsRequest {
// References to request a Commit for.
//
// See the documentation on ResourceRef for resource resolution details.
//
// Resolution is as follows:
// - If a Plugin is referenced, the Commit of the default Label is returned.
// - If a Label is referenced, the Commit of this Label is returned.
// - If a Commit is referenced, this Commit is returned.
repeated ResourceRef resource_refs = 1 [
(buf.validate.field).repeated.min_items = 1,
(buf.validate.field).repeated.max_items = 250
];
// The DigestType to use for Digests returned on Commits.
//
// If this DigestType is not available, an error is returned.
// Note that certain DigestTypes may be deprecated over time.
//
// If not set, the latest DigestType is used, currently p1.
DigestType digest_type = 2 [(buf.validate.field).enum.defined_only = true];
}

message GetCommitsResponse {
// The found Commits in the same order as requested.
repeated Commit commits = 1 [(buf.validate.field).repeated.min_items = 1];
}

message ListCommitsRequest {
// The list order.
enum Order {
ORDER_UNSPECIFIED = 0;
// Order by create_time newest to oldest.
ORDER_CREATE_TIME_DESC = 1;
// Order by create_time oldest to newest.
ORDER_CREATE_TIME_ASC = 2;
}
// The maximum number of items to return.
//
// The default value is 10.
uint32 page_size = 1 [(buf.validate.field).uint32.lte = 250];
// The page to start from.
//
// If empty, the first page is returned.
string page_token = 2 [(buf.validate.field).string.max_len = 4096];
// The reference to list Commits for.
//
// See the documentation on Ref for resource resolution details.
//
// Once the resource is resolved, the following Commits are listed (subject to any additional filters in the request):
// - If a Plugin is referenced, all Commits for the Plugin are returned.
// - If a Label is referenced, the Commit the Label points to is returned.
// Use ListLabelHistory to get the history of Commits for a Label.
// - If a Commit is referenced, this Commit is returned.
ResourceRef resource_ref = 3 [(buf.validate.field).required = true];
// The order to return the Commits.
//
// If not specified, defaults to ORDER_CREATE_TIME_DESC.
Order order = 4 [(buf.validate.field).enum.defined_only = true];
// The DigestType to use for Digests returned on Commits.
//
// If this DigestType is not available, an error is returned.
// Note that certain DigestTypes may be deprecated over time.
//
// If not set, the latest DigestType is used, currently p1.
DigestType digest_type = 5 [(buf.validate.field).enum.defined_only = true];
// Only return Commits with an id that contains this string using a case-insensitive comparison.
string id_query = 6 [(buf.validate.field).string.max_len = 36];
}

message ListCommitsResponse {
// The next page token.
//
// If empty, there are no more pages.
string next_page_token = 1 [(buf.validate.field).string.max_len = 4096];
// The listed Commits.
repeated Commit commits = 2;
}
Loading