-
Notifications
You must be signed in to change notification settings - Fork 0
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
Changes from 39 commits
Commits
Show all changes
51 commits
Select commit
Hold shift + click to select a range
e2a11ff
wip
mfridman aa08ddf
wip; pass format lint
mfridman 2577109
disable push
mfridman 2a1a374
Enable push
emcfarlane 861779d
first pass at tidying up registry config
mfridman badc37d
wip
mfridman fa7e531
wip
mfridman c5e3a78
wip
mfridman 0eac937
wip
mfridman a82217d
wip
mfridman dff06aa
wip
mfridman adb18e6
wip
emcfarlane 69b571b
switch to commits and labels
emcfarlane 0208156
wip
mfridman a3472e1
wip
mfridman af0c906
wip
mfridman df121ef
Update commit service and Digest P1
emcfarlane 6887aab
add collection entity instead of enum
mfridman c0a6fdc
wip
mfridman 7741a6b
fix lint
mfridman 365a2e4
commit
mfridman b34ff09
commit
mfridman 681ee14
fix collection id
emcfarlane bab5cf2
add plugin image uploads
emcfarlane a7468f6
update plugin create request
mfridman 0badaec
update upload_service.proto
mfridman b1f3222
s/module/plugin and comments
mfridman 3e44a69
update comment
mfridman fd48e8f
remove todo: digest
mfridman 428ed38
remove todo: compression
mfridman 04cb0ab
remove todo: source_url
mfridman 69c0d42
cleanup field numbers
mfridman ab84720
Merge branch 'main' into mf/plugins
bufdev 38293c9
remove legacy docker-based plugin definitions; misc cleanup
mfridman b687e13
remove compression type
mfridman 9af8a88
copy plugin info and update comments
mfridman d9ba013
flatten and remove nested filter message
mfridman a801d90
update comment
mfridman 6813f20
add scoped label refs to upload
mfridman 4282fe1
updates following review
mfridman 398d8e0
restore protovalidate for now
mfridman 304e859
add partial collection_service.proto
mfridman c47e631
add source_control_url to upload
mfridman 2e7c067
add collection service definitions; misc cleanup
mfridman 624adc0
fix comment
mfridman b3ac2f4
use The for consistency
mfridman f6f7205
Add a limit to upload
mfridman 3dee9d4
add GetPluginCollectionAssociations
mfridman 1782bc5
rename from v1beta1 to v1
mfridman 45eb887
add compression.proto and use in both upload and download
mfridman dea5e2a
rename from v1 to v1beta1
mfridman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.v1beta1; | ||
|
||
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/v1beta1"; | ||
|
||
// 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 Label 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 | ||
}]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// 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.v1beta1; | ||
|
||
import "buf/registry/plugin/v1beta1/digest.proto"; | ||
import "buf/registry/plugin/v1beta1/plugin_info.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/v1beta1"; | ||
|
||
// 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 license of the Plugin Commit. | ||
License license = 7; | ||
// The documentation of the Plugin Commit. | ||
Doc doc = 8; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.v1beta1; | ||
|
||
import "buf/registry/plugin/v1beta1/commit.proto"; | ||
import "buf/registry/plugin/v1beta1/digest.proto"; | ||
import "buf/registry/plugin/v1beta1/resource.proto"; | ||
import "buf/validate/validate.proto"; | ||
|
||
option go_package = "buf.build/gen/go/bufbuild/registry/protocolbuffers/go/buf/registry/plugin/v1beta1"; | ||
|
||
// 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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// 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.v1beta1; | ||
|
||
import "buf/validate/validate.proto"; | ||
|
||
option go_package = "buf.build/gen/go/bufbuild/registry/protocolbuffers/go/buf/registry/plugin/v1beta1"; | ||
|
||
// A digest of a Commit's content. | ||
// | ||
// A digest represents all content for a single Commit. | ||
message Digest { | ||
// The type of the Digest. | ||
DigestType type = 1 [ | ||
(buf.validate.field).required = true, | ||
(buf.validate.field).enum.defined_only = true | ||
]; | ||
// The value of the Digest. | ||
bytes value = 2 [(buf.validate.field).required = true]; | ||
} | ||
|
||
// The type of Digest. | ||
enum DigestType { | ||
DIGEST_TYPE_UNSPECIFIED = 0; | ||
// The p1 digest function. | ||
DIGEST_TYPE_P1 = 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.v1beta1; | ||
|
||
import "buf/registry/plugin/v1beta1/commit.proto"; | ||
import "buf/registry/plugin/v1beta1/resource.proto"; | ||
import "buf/validate/validate.proto"; | ||
|
||
option go_package = "buf.build/gen/go/bufbuild/registry/protocolbuffers/go/buf/registry/plugin/v1beta1"; | ||
|
||
// Download contents. | ||
service DownloadService { | ||
// Download contents for given set of Plugins. | ||
// | ||
// Contents are WASM modules that are compiled and executed within a suitable runtime. | ||
rpc Download(DownloadRequest) returns (DownloadResponse) { | ||
option idempotency_level = NO_SIDE_EFFECTS; | ||
} | ||
} | ||
|
||
message DownloadRequest { | ||
// A request for content for a single version of a Plugin. | ||
message Value { | ||
// The reference to get content for. | ||
// | ||
// See the documentation on Reference for reference resolution details. | ||
// | ||
// Once the resource is resolved, the following content is returned: | ||
// - If a Plugin is referenced, the content of the latest commit of the default label is | ||
// returned. | ||
// - If a Label is referenced, the content of the Commit of this Label is returned. | ||
// - If a Commit is referenced, the content for this Commit is returned. | ||
ResourceRef resource_ref = 1 [(buf.validate.field).required = true]; | ||
} | ||
// The references to get contents for. | ||
repeated Value values = 1 [ | ||
(buf.validate.field).repeated.min_items = 1, | ||
(buf.validate.field).repeated.max_items = 250 | ||
]; | ||
} | ||
|
||
message DownloadResponse { | ||
// Content for a single version of a Plugin. | ||
message Content { | ||
// The Commit associated with the Content. | ||
Commit commit = 1 [(buf.validate.field).required = true]; | ||
// The content. | ||
bytes content = 2 [(buf.validate.field).required = true]; | ||
} | ||
repeated Content contents = 1 [(buf.validate.field).repeated.min_items = 1]; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why or why not is
source_control_url
not a field here, when it is for the module commit?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add this field.
I do have a question where this vcs url should come from?
buf plugin push --source-control-url
For option 1 we're putting more work on the user because they don't have a readily available commit to use via the bufplugin-go sdk. They'd have to stamp this into the binary via a linker flag?
Option 2 makes sense if we expose
--source-control-url string
onbuf plugin push
command.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the answer to why or why not this field was not present in this PR already? This determines how you think about this solution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I excluded it because it (initially) made less sense for plugins. For modules, you commit proto files, license, readme to vcs. There's a direct link between the committed files, a commit and the resulting contents pushed up to the BSR.
The GitHub action pushes each vcs commit (regardless of proto changes) to the BSR.
For plugins, you're typically not building and committing the compiled wasm module into vcs. And you're very unlikely to be publishing for every vcs commit, instead, you'd be doing a bunch of work on the plugin and when it's ready tag it and release. The model felt slightly different here.
I agree we should add this field to the
Commit
response though. If a plugin from the BSR can point to the corresponding source code from which it was built then it's a net win. The only question (at least for me) is how this gets populated.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to me that there's no reason to differentiate here - I would add
buf plugin push --source-control-url