Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions app/cli/cmd/workflow_contract_describe.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func newWorkflowContractDescribeCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "describe",
Short: "Describe the information of the contract",
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, _ []string) error {
res, err := action.NewWorkflowContractDescribe(ActionOpts).Run(name, revision)
if err != nil {
return err
Expand Down Expand Up @@ -81,15 +81,15 @@ func encodeContractOutput(run *action.WorkflowContractWithVersionItem) error {

func contractDescribeTableOutput(contractWithVersion *action.WorkflowContractWithVersionItem) error {
revision := contractWithVersion.Revision

c := contractWithVersion.Contract

t := output.NewTableWriter()
t.SetTitle("Contract")
t.AppendRow(table.Row{"Name", c.Name})
t.AppendSeparator()
t.AppendRow(table.Row{"Scope", c.ScopedEntity.String()})
t.AppendSeparator()
t.AppendRow(table.Row{"Description", c.Description})
t.AppendRow(table.Row{"Description", revision.Description}) // description is always provided through version
t.AppendSeparator()
t.AppendRow(table.Row{"Associated Workflows", stringifyAssociatedWorkflows(contractWithVersion)})
t.AppendSeparator()
Expand Down
16 changes: 9 additions & 7 deletions app/cli/pkg/action/workflow_contract_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,12 @@ type WorkflowRef struct {
}

type WorkflowContractVersionItem struct {
ID string `json:"id"`
Revision int `json:"revision"`
CreatedAt *time.Time `json:"createdAt"`
BodyV1 *schemav1.CraftingSchema `json:"bodyV1"`
RawBody *ContractRawBody `json:"rawBody"`
ID string `json:"id"`
Revision int `json:"revision"`
Description string `json:"description"`
CreatedAt *time.Time `json:"createdAt"`
BodyV1 *schemav1.CraftingSchema `json:"bodyV1"`
RawBody *ContractRawBody `json:"rawBody"`
}

type ContractRawBody struct {
Expand Down Expand Up @@ -123,8 +124,9 @@ func pbWorkflowContractItemToAction(in *pb.WorkflowContractItem) *WorkflowContra
func pbWorkflowContractVersionItemToAction(in *pb.WorkflowContractVersionItem) *WorkflowContractVersionItem {
return &WorkflowContractVersionItem{
Revision: int(in.GetRevision()), ID: in.GetId(), BodyV1: in.GetV1(),
CreatedAt: toTimePtr(in.GetCreatedAt().AsTime()),
RawBody: &ContractRawBody{Body: string(in.RawContract.GetBody()), Format: in.RawContract.GetFormat().String()},
Description: in.Description,
CreatedAt: toTimePtr(in.GetCreatedAt().AsTime()),
RawBody: &ContractRawBody{Body: string(in.RawContract.GetBody()), Format: in.RawContract.GetFormat().String()},
}
}

Expand Down
604 changes: 310 additions & 294 deletions app/controlplane/api/controlplane/v1/response_messages.pb.go

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions app/controlplane/api/controlplane/v1/response_messages.proto
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ message PolicyReference {
message WorkflowContractItem {
string id = 1;
string name = 2;
string description = 6;
// deprecated: description now belongs to the version, as it's versioned since the introduction of new contracts v2
string description = 6 [deprecated = true];
google.protobuf.Timestamp created_at = 3;
google.protobuf.Timestamp updated_at = 10;
int32 latest_revision = 4;
Expand Down Expand Up @@ -222,9 +223,12 @@ message WorkflowContractVersionItem {

RawBody raw_contract = 5;

// The name of the contract used for this run
// The name of the contract
string contract_name = 6;

// The contract version description
string description = 7;

message RawBody {
bytes body = 1;
Format format = 2 [(buf.validate.field).enum = {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion app/controlplane/internal/service/attestation.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ func (s *AttestationService) GetContract(ctx context.Context, req *cpAPI.Attesta

resp := &cpAPI.AttestationServiceGetContractResponse_Result{
Workflow: bizWorkflowToPb(wf),
Contract: bizWorkFlowContractVersionToPb(contractVersion.Version),
Contract: bizWorkFlowContractVersionToPb(contractVersion.Version, contractVersion.Contract),
}

return &cpAPI.AttestationServiceGetContractResponse{Result: resp}, nil
Expand Down
Loading
Loading