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

Support policy checks #69

Merged
merged 28 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
63634d0
Add BreakingState and ReviewState to ListLabelHistoryResponse
bufdev Feb 13, 2024
40e9a5f
Merge branch 'main' into breaking-review-labels
bufdev Feb 13, 2024
e346d75
Take two
bufdev Feb 13, 2024
abae8ae
format
bufdev Feb 13, 2024
451ee8c
fixes
bufdev Feb 13, 2024
88530ad
fix
bufdev Feb 13, 2024
94a8cfd
newline
bufdev Feb 13, 2024
b0403a8
comment
bufdev Feb 13, 2024
9b136e4
LabelReviewState -> CommitReviewState and update docs
nicksnyder Feb 15, 2024
dc29366
commit -> Commit
nicksnyder Feb 15, 2024
855d3d0
lint
nicksnyder Feb 15, 2024
f2007cd
clarify docs for Label.commit_id
nicksnyder Feb 15, 2024
b826484
Standardize on "governance workflow"
nicksnyder Feb 16, 2024
4368113
CommitReviewState -> GovernanceWorkflowState
nicksnyder Feb 16, 2024
2f7a199
lint
nicksnyder Feb 16, 2024
347ea32
Support GovernanceWorkflowState being blocked on another governance w…
nicksnyder Feb 16, 2024
f3d9cb2
clarify docs for blocked commits
nicksnyder Feb 16, 2024
a0a968a
Update buf/registry/module/v1beta1/label.proto
nicksnyder Feb 16, 2024
3eeb39c
clarify behavior of blocked state
nicksnyder Feb 16, 2024
f7687d9
governance flow -> policy checks
nicksnyder Feb 16, 2024
03c229f
accepted -> approved
nicksnyder Feb 16, 2024
ed33e9c
validation rule
nicksnyder Feb 16, 2024
f42ba0c
Rename PolicyChecks{State|Status} to PolicyCheck{State|Status}
nicksnyder Feb 26, 2024
da077c5
Merge branch 'main' into breaking-review-labels
nicksnyder Feb 26, 2024
d126dac
Merge branch 'main' into breaking-review-labels
bufdev Feb 26, 2024
4546866
Merge branch 'breaking-review-labels' of https://github.com/bufbuild/…
bufdev Feb 26, 2024
46300fc
commit
bufdev Feb 26, 2024
108b279
commit
bufdev Feb 26, 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
27 changes: 26 additions & 1 deletion buf/registry/module/v1beta1/label.proto
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,9 @@ message Label {
(buf.validate.field).required = true,
(buf.validate.field).string.uuid = true
];
// The id of the Commit currently associated with the Label.
// The id of the currently passed or accepted Commit currently associated with the Label.
//
// Labels will only point to passed or accepted commits, and never point to rejected or pending Commits.
// To get the history of the Commits that have been associated with a Label, use ListLabelHistory.
string commit_id = 8 [
(buf.validate.field).required = true,
Expand All @@ -71,6 +72,30 @@ message Label {
(buf.validate.field).required = true,
(buf.validate.field).string.uuid = true
];

// Whether or not governance review is enabled for this Label.
//
// Governance is an enterprise-only feature - contact us to learn more!
bool review_enabled = 10;
// The current review state of the Label.
//
// This field will only be set if governance is enabled.
LabelReviewState review_state = 11 [(buf.validate.field).enum.defined_only = true];
nicksnyder marked this conversation as resolved.
Show resolved Hide resolved
}

// The label state in the governance review flow.
//
// Governance is an enterprise-only feature - contact us to learn more!
enum LabelReviewState {
LABEL_REVIEW_STATE_UNSPECIFIED = 0;
// The last Commit pushed to the Label did not fail any governance checks and therefore did not need review.
LABEL_REVIEW_STATE_PASSED = 1;
// The last Commit pushed to the Label was reviewed after failing governance checks and was accepted.
LABEL_REVIEW_STATE_ACCEPTED = 2;
// The last Commit pushed to the Label was reviewed after failing governance checks and was rejected.
LABEL_REVIEW_STATE_REJECTED = 3;
// The last Commit pushed to the Label has not yet been reviewed after failing governance checks and is pending.
LABEL_REVIEW_STATE_PENDING = 4;
}

// LabelRef is a reference to a Label, either an id or a fully-qualified name.
Expand Down
27 changes: 24 additions & 3 deletions buf/registry/module/v1beta1/label_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import "buf/registry/module/v1beta1/digest.proto";
import "buf/registry/module/v1beta1/label.proto";
import "buf/registry/module/v1beta1/resource.proto";
import "buf/validate/validate.proto";
import "google/protobuf/timestamp.proto";

option go_package = "buf.build/gen/go/bufbuild/registry/protocolbuffers/go/buf/registry/module/v1beta1";

Expand Down Expand Up @@ -96,7 +97,9 @@ message ListLabelsRequest {
// Once the resource is resolved, the following Labels are listed:
// - If a Module is referenced, all Labels for the Module are returned.
// - If a Label is referenced, this Label is returned.
nicksnyder marked this conversation as resolved.
Show resolved Hide resolved
// - If a Commit is referenced, all Labels for the Commit are returned.
// - If a Commit is referenced, all Labels for the Commit are returned. Note that this will
// not return any Labels where the Commit is currently rejected or pending, it will only
// return Labels for Commits that are passed or accepted.
nicksnyder marked this conversation as resolved.
Show resolved Hide resolved
ResourceRef resource_ref = 3 [(buf.validate.field).required = true];
// The order to return the Labels.
//
Expand All @@ -106,6 +109,10 @@ message ListLabelsRequest {
// TODO: We are purposefully not making the default the zero enum value, however
// we may want to consider this.
Order order = 4 [(buf.validate.field).enum.defined_only = true];
// Only return Labels that have these governance review states.
//
// By default, Labels with any governance review state are returned.
repeated LabelReviewState review_states = 5;
}

message ListLabelsResponse {
Expand Down Expand Up @@ -157,12 +164,26 @@ message ListLabelHistoryRequest {
}

message ListLabelHistoryResponse {
message Value {
// The Commit.
Commit commit = 1 [(buf.validate.field).required = true];

// The Label's review state.
//
// This field will only be set if governance is enabled for the Label.
nicksnyder marked this conversation as resolved.
Show resolved Hide resolved
LabelReviewState review_state = 2 [(buf.validate.field).enum.defined_only = true];
// When the review state was last updated.
//
// This field will only be set if governance is enabled for the Label.
google.protobuf.Timestamp review_state_updated_at = 3;
}
nicksnyder marked this conversation as resolved.
Show resolved Hide resolved

// 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 that represent the history of the Label.
repeated Commit commits = 2;
// The ordered history of the Label.
repeated Value values = 2;
}

message CreateOrUpdateLabelsRequest {
Expand Down
2 changes: 2 additions & 0 deletions buf/registry/module/v1beta1/upload_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ message UploadRequest {
//
// If the ModuleRef refers to a Module that has associated Content, this field should *not*
// be set, and setting it is an error.
//
// The commit_id must point to a passed or accepted Commit.
string commit_id = 2 [(buf.validate.field).string.uuid = true];
}
// Content to upload for a given reference.
Expand Down
Loading