Skip to content

Commit 70cbda9

Browse files
authored
feat(controlplane): public attestations/materials (#331)
Signed-off-by: Miguel Martinez Trivino <[email protected]>
1 parent a427fcc commit 70cbda9

37 files changed

+1516
-314
lines changed

app/cli/cmd/workflow_list.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func WorkflowListTableOutput(workflows []*action.WorkflowItem) error {
5151
}
5252

5353
headerRow := table.Row{"ID", "Name", "Project", "Created At", "Runner", "Last Run status"}
54-
headerRowFull := table.Row{"ID", "Name", "Project", "Team", "Created At", "Runner", "Last Run status", "Last Run At", "Last Run ID", "Contract ID"}
54+
headerRowFull := table.Row{"ID", "Name", "Project", "Team", "Created At", "Runner", "Last Run status", "Public", "Contract ID"}
5555

5656
t := newTableWriter()
5757
if full {
@@ -62,14 +62,10 @@ func WorkflowListTableOutput(workflows []*action.WorkflowItem) error {
6262

6363
for _, p := range workflows {
6464
var row table.Row
65-
var lastRunRunner, lastRunState, lastRunID, lastRunAt string
65+
var lastRunRunner, lastRunState string
6666
if lr := p.LastRun; lr != nil {
6767
lastRunRunner = lr.RunnerType
68-
lastRunID = lr.ID
6968
lastRunState = lr.State
70-
if lr.CreatedAt != nil {
71-
lastRunAt = p.CreatedAt.Format(time.RFC822)
72-
}
7369
}
7470

7571
if !full {
@@ -81,7 +77,7 @@ func WorkflowListTableOutput(workflows []*action.WorkflowItem) error {
8177
row = table.Row{
8278
p.ID, p.Name, p.Project, p.Team,
8379
p.CreatedAt.Format(time.RFC822), lastRunRunner, lastRunState,
84-
lastRunAt, lastRunID, p.ContractID,
80+
p.Public, p.ContractID,
8581
}
8682
}
8783

app/cli/internal/action/workflow_list.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ type WorkflowItem struct {
3636
RunsCount int32 `json:"runsCount"`
3737
ContractID string `json:"contractID,omitempty"`
3838
LastRun *WorkflowRunItem `json:"lastRun,omitempty"`
39+
// A public workflow means that any user can
40+
// - access to all its workflow runs
41+
// - their attestation and materials
42+
Public bool `json:"public"`
3943
}
4044

4145
type WorkflowItemWithRobotAccount struct {
@@ -73,6 +77,7 @@ func pbWorkflowItemToAction(wf *pb.WorkflowItem) *WorkflowItem {
7377
Project: wf.Project, Team: wf.Team, RunsCount: wf.RunsCount,
7478
ContractID: wf.ContractId,
7579
LastRun: pbWorkflowRunItemToAction(wf.LastRun),
80+
Public: wf.Public,
7681
}
7782

7883
return res

app/controlplane/api/controlplane/v1/response_messages.pb.go

Lines changed: 193 additions & 181 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/controlplane/api/controlplane/v1/response_messages.pb.validate.go

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/controlplane/api/controlplane/v1/response_messages.proto

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ message WorkflowItem {
3333

3434
WorkflowRunItem last_run = 7;
3535
string contract_id = 8;
36+
// A public workflow means that any user can
37+
// - access to all its workflow runs
38+
// - their attestation and materials
39+
bool public = 9;
3640
}
3741

3842
message WorkflowRunItem {

app/controlplane/api/controlplane/v1/workflow.pb.go

Lines changed: 203 additions & 48 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/controlplane/api/controlplane/v1/workflow.pb.validate.go

Lines changed: 263 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/controlplane/api/controlplane/v1/workflow.proto

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ service WorkflowService {
2626
rpc Create (WorkflowServiceCreateRequest) returns (WorkflowServiceCreateResponse);
2727
rpc List (WorkflowServiceListRequest) returns (WorkflowServiceListResponse);
2828
rpc Delete (WorkflowServiceDeleteRequest) returns (WorkflowServiceDeleteResponse);
29+
rpc ChangeVisibility (WorkflowServiceChangeVisibilityRequest) returns (WorkflowServiceChangeVisibilityResponse);
2930
}
3031

3132
message WorkflowServiceCreateRequest {
@@ -50,3 +51,15 @@ message WorkflowServiceListRequest {}
5051
message WorkflowServiceListResponse {
5152
repeated WorkflowItem result = 1;
5253
}
54+
55+
message WorkflowServiceChangeVisibilityRequest {
56+
string id = 1 [(validate.rules).string.uuid = true];
57+
// A public workflow means that any user can
58+
// - access to all its workflow runs
59+
// - their attestation and materials
60+
bool public = 2;
61+
}
62+
63+
message WorkflowServiceChangeVisibilityResponse {
64+
WorkflowItem result = 1;
65+
}

0 commit comments

Comments
 (0)