diff --git a/app/controlplane/internal/dispatcher/dispatcher.go b/app/controlplane/internal/dispatcher/dispatcher.go index 800be0957..b7a98bc63 100644 --- a/app/controlplane/internal/dispatcher/dispatcher.go +++ b/app/controlplane/internal/dispatcher/dispatcher.go @@ -126,6 +126,10 @@ func (d *FanOutDispatcher) Run(ctx context.Context, opts *RunOpts) error { }, } + if wfRun.Attestation != nil { + workflowMetadata.WorkflowRun.AttestationDigest = wfRun.Attestation.Digest + } + // Dispatch the integrations for _, item := range queue { req := generateRequest(item, workflowMetadata) diff --git a/app/controlplane/plugins/sdk/v1/fanout.go b/app/controlplane/plugins/sdk/v1/fanout.go index ccc7d24ea..6799935b9 100644 --- a/app/controlplane/plugins/sdk/v1/fanout.go +++ b/app/controlplane/plugins/sdk/v1/fanout.go @@ -120,12 +120,13 @@ type ChainloopMetadata struct { } type ChainloopMetadataWorkflowRun struct { - ID string - State string - StartedAt time.Time - FinishedAt time.Time - RunnerType string - RunURL string + ID string + State string + StartedAt time.Time + FinishedAt time.Time + RunnerType string + RunURL string + AttestationDigest string } type ChainloopMetadataWorkflow struct { diff --git a/app/controlplane/plugins/sdk/v1/helpers.go b/app/controlplane/plugins/sdk/v1/helpers.go index 408e029d5..77ef9a0fc 100644 --- a/app/controlplane/plugins/sdk/v1/helpers.go +++ b/app/controlplane/plugins/sdk/v1/helpers.go @@ -105,6 +105,7 @@ func (r *renderer) summaryTable(m *ChainloopMetadata, predicate chainloop.Normal tw.AppendRow(table.Row{"Workflow Run"}) tw.AppendSeparator() tw.AppendRow(table.Row{"ID", wr.ID}) + tw.AppendRow(table.Row{"Attestation", wr.AttestationDigest}) tw.AppendRow(table.Row{"Started At", wr.StartedAt.Format(time.RFC822)}) tw.AppendRow(table.Row{"Finished At", wr.FinishedAt.Format(time.RFC822)}) tw.AppendRow(table.Row{"State", wr.State}) @@ -141,7 +142,7 @@ func (r *renderer) summaryTable(m *ChainloopMetadata, predicate chainloop.Normal } mt.AppendRow(table.Row{"Value", wrap.String(value, 100)}) if m.Hash != nil { - mt.AppendRow(table.Row{"Digest", m.Hash.Hex}) + mt.AppendRow(table.Row{"Digest", m.Hash.String()}) } if annotations := m.Annotations; len(annotations) > 0 { diff --git a/app/controlplane/plugins/sdk/v1/helpers_test.go b/app/controlplane/plugins/sdk/v1/helpers_test.go index 0484fff73..4775263fa 100644 --- a/app/controlplane/plugins/sdk/v1/helpers_test.go +++ b/app/controlplane/plugins/sdk/v1/helpers_test.go @@ -102,12 +102,13 @@ func (s *helperTestSuite) SetupTest() { Team: "test-team", }, WorkflowRun: &ChainloopMetadataWorkflowRun{ - ID: "beefdead", - State: "success", - StartedAt: date, - FinishedAt: date.Add(10 * time.Minute), - RunnerType: "github-actions", - RunURL: "chainloop.dev/runner", + ID: "beefdead", + State: "success", + StartedAt: date, + FinishedAt: date.Add(10 * time.Minute), + RunnerType: "github-actions", + RunURL: "chainloop.dev/runner", + AttestationDigest: "sha256:deadbeef", }, } } diff --git a/app/controlplane/plugins/sdk/v1/plugin/api/fanout.pb.go b/app/controlplane/plugins/sdk/v1/plugin/api/fanout.pb.go index 281c3b903..d8c03e811 100644 --- a/app/controlplane/plugins/sdk/v1/plugin/api/fanout.pb.go +++ b/app/controlplane/plugins/sdk/v1/plugin/api/fanout.pb.go @@ -1157,12 +1157,13 @@ type ExecuteRequest_Metadata_WorkflowRun struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - State string `protobuf:"bytes,2,opt,name=state,proto3" json:"state,omitempty"` - RunnerType string `protobuf:"bytes,3,opt,name=runner_type,json=runnerType,proto3" json:"runner_type,omitempty"` - RunUrl string `protobuf:"bytes,4,opt,name=run_url,json=runUrl,proto3" json:"run_url,omitempty"` - StartedAt *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=started_at,json=startedAt,proto3" json:"started_at,omitempty"` - FinishedAt *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=finished_at,json=finishedAt,proto3" json:"finished_at,omitempty"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + State string `protobuf:"bytes,2,opt,name=state,proto3" json:"state,omitempty"` + RunnerType string `protobuf:"bytes,3,opt,name=runner_type,json=runnerType,proto3" json:"runner_type,omitempty"` + RunUrl string `protobuf:"bytes,4,opt,name=run_url,json=runUrl,proto3" json:"run_url,omitempty"` + StartedAt *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=started_at,json=startedAt,proto3" json:"started_at,omitempty"` + FinishedAt *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=finished_at,json=finishedAt,proto3" json:"finished_at,omitempty"` + AttestationDigest string `protobuf:"bytes,7,opt,name=attestation_digest,json=attestationDigest,proto3" json:"attestation_digest,omitempty"` } func (x *ExecuteRequest_Metadata_WorkflowRun) Reset() { @@ -1239,6 +1240,13 @@ func (x *ExecuteRequest_Metadata_WorkflowRun) GetFinishedAt() *timestamppb.Times return nil } +func (x *ExecuteRequest_Metadata_WorkflowRun) GetAttestationDigest() string { + if x != nil { + return x.AttestationDigest + } + return "" +} + var File_fanout_proto protoreflect.FileDescriptor var file_fanout_proto_rawDesc = []byte{ @@ -1310,7 +1318,7 @@ var file_fanout_proto_rawDesc = []byte{ 0x6f, 0x22, 0x36, 0x0a, 0x0e, 0x41, 0x74, 0x74, 0x61, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0xd9, 0x07, 0x0a, 0x0e, 0x45, 0x78, + 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x88, 0x08, 0x0a, 0x0e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x42, 0x0a, 0x11, 0x72, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x65, @@ -1342,7 +1350,7 @@ var file_fanout_proto_rawDesc = []byte{ 0x18, 0x06, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0d, 0x75, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x65, 0x64, 0x54, 0x6f, 0x43, 0x61, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x4e, 0x61, - 0x6d, 0x65, 0x1a, 0xe0, 0x03, 0x0a, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, + 0x6d, 0x65, 0x1a, 0x8f, 0x04, 0x0a, 0x08, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x12, 0x41, 0x0a, 0x08, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x2e, @@ -1357,7 +1365,7 @@ var file_fanout_proto_rawDesc = []byte{ 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, 0x61, 0x6d, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x65, 0x61, 0x6d, 0x12, 0x18, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x1a, 0xe5, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x1a, 0x94, 0x02, 0x0a, 0x0b, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x52, 0x75, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x73, 0x74, @@ -1372,55 +1380,58 @@ var file_fanout_proto_rawDesc = []byte{ 0x73, 0x68, 0x65, 0x64, 0x5f, 0x61, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0a, 0x66, 0x69, 0x6e, 0x69, 0x73, - 0x68, 0x65, 0x64, 0x41, 0x74, 0x22, 0x11, 0x0a, 0x0f, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3c, 0x0a, 0x15, 0x49, 0x73, 0x53, 0x75, - 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x64, 0x54, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x6d, 0x61, 0x74, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x5f, 0x74, 0x79, - 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x6d, 0x61, 0x74, 0x65, 0x72, 0x69, - 0x61, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x22, 0x38, 0x0a, 0x16, 0x49, 0x73, 0x53, 0x75, 0x62, 0x73, - 0x63, 0x72, 0x69, 0x62, 0x65, 0x64, 0x54, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x0a, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x64, - 0x32, 0x9c, 0x04, 0x0a, 0x0d, 0x46, 0x61, 0x6e, 0x6f, 0x75, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x12, 0x37, 0x0a, 0x08, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x12, 0x14, - 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72, - 0x69, 0x62, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5b, 0x0a, 0x14, 0x56, - 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x12, 0x20, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, - 0x74, 0x65, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x56, 0x61, 0x6c, 0x69, - 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x55, 0x0a, 0x12, 0x56, 0x61, 0x6c, 0x69, - 0x64, 0x61, 0x74, 0x65, 0x41, 0x74, 0x74, 0x61, 0x63, 0x68, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x1e, - 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x41, 0x74, 0x74, - 0x61, 0x63, 0x68, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, - 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x41, 0x74, 0x74, - 0x61, 0x63, 0x68, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x31, 0x0a, 0x06, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x12, 0x2e, 0x61, 0x70, 0x69, 0x2e, - 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, - 0x61, 0x70, 0x69, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x49, 0x0a, 0x0e, 0x49, 0x73, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, - 0x65, 0x64, 0x54, 0x6f, 0x12, 0x1a, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x49, 0x73, 0x53, 0x75, 0x62, + 0x68, 0x65, 0x64, 0x41, 0x74, 0x12, 0x2d, 0x0a, 0x12, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x64, 0x69, 0x67, 0x65, 0x73, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x11, 0x61, 0x74, 0x74, 0x65, 0x73, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x44, 0x69, + 0x67, 0x65, 0x73, 0x74, 0x22, 0x11, 0x0a, 0x0f, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3c, 0x0a, 0x15, 0x49, 0x73, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x64, 0x54, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x1b, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x49, 0x73, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, - 0x62, 0x65, 0x64, 0x54, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37, 0x0a, - 0x08, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x12, 0x14, 0x2e, 0x61, 0x70, 0x69, 0x2e, - 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x15, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x31, 0x0a, 0x06, 0x41, 0x74, 0x74, 0x61, 0x63, 0x68, - 0x12, 0x12, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x41, 0x74, 0x74, 0x61, 0x63, 0x68, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x41, 0x74, 0x74, 0x61, 0x63, - 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x34, 0x0a, 0x07, 0x45, 0x78, 0x65, - 0x63, 0x75, 0x74, 0x65, 0x12, 0x13, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x45, 0x78, 0x65, 0x63, 0x75, - 0x74, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x61, 0x70, 0x69, 0x2e, - 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, - 0x53, 0x5a, 0x51, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x68, - 0x61, 0x69, 0x6e, 0x6c, 0x6f, 0x6f, 0x70, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x63, 0x68, 0x61, 0x69, - 0x6e, 0x6c, 0x6f, 0x6f, 0x70, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, - 0x6c, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x73, 0x2f, 0x73, - 0x64, 0x6b, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2f, 0x61, 0x70, 0x69, - 0x3b, 0x61, 0x70, 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x12, 0x23, 0x0a, 0x0d, 0x6d, 0x61, 0x74, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x5f, 0x74, 0x79, 0x70, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x6d, 0x61, 0x74, 0x65, 0x72, 0x69, 0x61, + 0x6c, 0x54, 0x79, 0x70, 0x65, 0x22, 0x38, 0x0a, 0x16, 0x49, 0x73, 0x53, 0x75, 0x62, 0x73, 0x63, + 0x72, 0x69, 0x62, 0x65, 0x64, 0x54, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x1e, 0x0a, 0x0a, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x0a, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x64, 0x32, + 0x9c, 0x04, 0x0a, 0x0d, 0x46, 0x61, 0x6e, 0x6f, 0x75, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x12, 0x37, 0x0a, 0x08, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x12, 0x14, 0x2e, + 0x61, 0x70, 0x69, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, + 0x62, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5b, 0x0a, 0x14, 0x56, 0x61, + 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x12, 0x20, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, + 0x65, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, + 0x61, 0x74, 0x65, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x55, 0x0a, 0x12, 0x56, 0x61, 0x6c, 0x69, 0x64, + 0x61, 0x74, 0x65, 0x41, 0x74, 0x74, 0x61, 0x63, 0x68, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x1e, 0x2e, + 0x61, 0x70, 0x69, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x41, 0x74, 0x74, 0x61, + 0x63, 0x68, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, + 0x61, 0x70, 0x69, 0x2e, 0x56, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x41, 0x74, 0x74, 0x61, + 0x63, 0x68, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x31, + 0x0a, 0x06, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x12, 0x12, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x53, + 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x49, 0x0a, 0x0e, 0x49, 0x73, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, + 0x64, 0x54, 0x6f, 0x12, 0x1a, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x49, 0x73, 0x53, 0x75, 0x62, 0x73, + 0x63, 0x72, 0x69, 0x62, 0x65, 0x64, 0x54, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x1b, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x49, 0x73, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, + 0x65, 0x64, 0x54, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37, 0x0a, 0x08, + 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x12, 0x14, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x52, + 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, + 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x31, 0x0a, 0x06, 0x41, 0x74, 0x74, 0x61, 0x63, 0x68, 0x12, + 0x12, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x41, 0x74, 0x74, 0x61, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x41, 0x74, 0x74, 0x61, 0x63, 0x68, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x34, 0x0a, 0x07, 0x45, 0x78, 0x65, 0x63, + 0x75, 0x74, 0x65, 0x12, 0x13, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x45, 0x78, 0x65, 0x63, 0x75, 0x74, + 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x45, + 0x78, 0x65, 0x63, 0x75, 0x74, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x53, + 0x5a, 0x51, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x68, 0x61, + 0x69, 0x6e, 0x6c, 0x6f, 0x6f, 0x70, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x63, 0x68, 0x61, 0x69, 0x6e, + 0x6c, 0x6f, 0x6f, 0x70, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, + 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x73, 0x2f, 0x73, 0x64, + 0x6b, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x3b, + 0x61, 0x70, 0x69, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/app/controlplane/plugins/sdk/v1/plugin/api/fanout.proto b/app/controlplane/plugins/sdk/v1/plugin/api/fanout.proto index bc069032d..8d4fdbcb3 100644 --- a/app/controlplane/plugins/sdk/v1/plugin/api/fanout.proto +++ b/app/controlplane/plugins/sdk/v1/plugin/api/fanout.proto @@ -133,6 +133,7 @@ message ExecuteRequest { string run_url = 4; google.protobuf.Timestamp started_at = 5; google.protobuf.Timestamp finished_at = 6; + string attestation_digest = 7; } } } diff --git a/app/controlplane/plugins/sdk/v1/plugin/api/translation.go b/app/controlplane/plugins/sdk/v1/plugin/api/translation.go index 63f3a8e77..8956d9abf 100644 --- a/app/controlplane/plugins/sdk/v1/plugin/api/translation.go +++ b/app/controlplane/plugins/sdk/v1/plugin/api/translation.go @@ -118,11 +118,12 @@ func MetadataSDKToProto(in *sdk.ChainloopMetadata) *ExecuteRequest_Metadata { Team: in.Workflow.Team, }, WorkflowRun: &ExecuteRequest_Metadata_WorkflowRun{ - Id: in.WorkflowRun.ID, - State: in.WorkflowRun.State, - RunnerType: in.WorkflowRun.RunnerType, - RunUrl: in.WorkflowRun.RunURL, - StartedAt: timestamppb.New(in.WorkflowRun.StartedAt), + Id: in.WorkflowRun.ID, + State: in.WorkflowRun.State, + RunnerType: in.WorkflowRun.RunnerType, + RunUrl: in.WorkflowRun.RunURL, + StartedAt: timestamppb.New(in.WorkflowRun.StartedAt), + AttestationDigest: in.WorkflowRun.AttestationDigest, }, } @@ -142,11 +143,12 @@ func MetadataProtoToSDK(in *ExecuteRequest_Metadata) *sdk.ChainloopMetadata { Team: in.Workflow.Team, }, WorkflowRun: &sdk.ChainloopMetadataWorkflowRun{ - ID: in.WorkflowRun.Id, - State: in.WorkflowRun.State, - RunnerType: in.WorkflowRun.RunnerType, - RunURL: in.WorkflowRun.RunUrl, - StartedAt: in.WorkflowRun.StartedAt.AsTime(), + ID: in.WorkflowRun.Id, + State: in.WorkflowRun.State, + RunnerType: in.WorkflowRun.RunnerType, + RunURL: in.WorkflowRun.RunUrl, + StartedAt: in.WorkflowRun.StartedAt.AsTime(), + AttestationDigest: in.WorkflowRun.AttestationDigest, }, } diff --git a/app/controlplane/plugins/sdk/v1/testdata/attestations/full.md b/app/controlplane/plugins/sdk/v1/testdata/attestations/full.md index 2829b58a9..118e1ee74 100644 --- a/app/controlplane/plugins/sdk/v1/testdata/attestations/full.md +++ b/app/controlplane/plugins/sdk/v1/testdata/attestations/full.md @@ -5,6 +5,7 @@ | Project | test-project | | Workflow Run | | | ID | beefdead | +| Attestation | sha256:deadbeef | | Started At | 22 Nov 21 00:00 UTC | | Finished At | 22 Nov 21 00:10 UTC | | State | success | @@ -16,17 +17,17 @@ | Name | image | | Type | CONTAINER_IMAGE | | Value | index.docker.io/bitnami/nginx | -| Digest | 264f55a6ff9cec2f4742a9faacc033b29f65c04dd4480e71e23579d484288d61 | +| Digest | sha256:264f55a6ff9cec2f4742a9faacc033b29f65c04dd4480e71e23579d484288d61 | | Name | skynet-sbom | | Type | SBOM_CYCLONEDX_JSON | | Value | sbom.cyclonedx.json | -| Digest | 16159bb881eb4ab7eb5d8afc5350b0feeed1e31c0a268e355e74f9ccbe885e0c | +| Digest | sha256:16159bb881eb4ab7eb5d8afc5350b0feeed1e31c0a268e355e74f9ccbe885e0c | | Annotations | ------ | | | component: nginx | | Name | skynet2-sbom | | Type | SBOM_CYCLONEDX_JSON | | Value | sbom.cyclonedx.json | -| Digest | 16159bb881eb4ab7eb5d8afc5350b0feeed1e31c0a268e355e74f9ccbe885e0c | +| Digest | sha256:16159bb881eb4ab7eb5d8afc5350b0feeed1e31c0a268e355e74f9ccbe885e0c | # Environment Variables | Name | Value | | --- | --- | diff --git a/app/controlplane/plugins/sdk/v1/testdata/attestations/full.txt b/app/controlplane/plugins/sdk/v1/testdata/attestations/full.txt index 4ee8d13ec..b5b880d1a 100644 --- a/app/controlplane/plugins/sdk/v1/testdata/attestations/full.txt +++ b/app/controlplane/plugins/sdk/v1/testdata/attestations/full.txt @@ -9,6 +9,7 @@ │ Workflow Run │ │ ├──────────────┼──────────────────────┤ │ ID │ beefdead │ +│ Attestation │ sha256:deadbeef │ │ Started At │ 22 Nov 21 00:00 UTC │ │ Finished At │ 22 Nov 21 00:10 UTC │ │ State │ success │ @@ -17,26 +18,26 @@ │ │ branch: stable │ │ │ toplevel: true │ └──────────────┴──────────────────────┘ -┌────────────────────────────────────────────────────────────────────────────────┐ -│ Materials │ -├─────────────┬──────────────────────────────────────────────────────────────────┤ -│ Name │ image │ -│ Type │ CONTAINER_IMAGE │ -│ Value │ index.docker.io/bitnami/nginx │ -│ Digest │ 264f55a6ff9cec2f4742a9faacc033b29f65c04dd4480e71e23579d484288d61 │ -├─────────────┼──────────────────────────────────────────────────────────────────┤ -│ Name │ skynet-sbom │ -│ Type │ SBOM_CYCLONEDX_JSON │ -│ Value │ sbom.cyclonedx.json │ -│ Digest │ 16159bb881eb4ab7eb5d8afc5350b0feeed1e31c0a268e355e74f9ccbe885e0c │ -│ Annotations │ ------ │ -│ │ component: nginx │ -├─────────────┼──────────────────────────────────────────────────────────────────┤ -│ Name │ skynet2-sbom │ -│ Type │ SBOM_CYCLONEDX_JSON │ -│ Value │ sbom.cyclonedx.json │ -│ Digest │ 16159bb881eb4ab7eb5d8afc5350b0feeed1e31c0a268e355e74f9ccbe885e0c │ -└─────────────┴──────────────────────────────────────────────────────────────────┘ +┌───────────────────────────────────────────────────────────────────────────────────────┐ +│ Materials │ +├─────────────┬─────────────────────────────────────────────────────────────────────────┤ +│ Name │ image │ +│ Type │ CONTAINER_IMAGE │ +│ Value │ index.docker.io/bitnami/nginx │ +│ Digest │ sha256:264f55a6ff9cec2f4742a9faacc033b29f65c04dd4480e71e23579d484288d61 │ +├─────────────┼─────────────────────────────────────────────────────────────────────────┤ +│ Name │ skynet-sbom │ +│ Type │ SBOM_CYCLONEDX_JSON │ +│ Value │ sbom.cyclonedx.json │ +│ Digest │ sha256:16159bb881eb4ab7eb5d8afc5350b0feeed1e31c0a268e355e74f9ccbe885e0c │ +│ Annotations │ ------ │ +│ │ component: nginx │ +├─────────────┼─────────────────────────────────────────────────────────────────────────┤ +│ Name │ skynet2-sbom │ +│ Type │ SBOM_CYCLONEDX_JSON │ +│ Value │ sbom.cyclonedx.json │ +│ Digest │ sha256:16159bb881eb4ab7eb5d8afc5350b0feeed1e31c0a268e355e74f9ccbe885e0c │ +└─────────────┴─────────────────────────────────────────────────────────────────────────┘ ┌────────────────────────────────┐ │ Environment Variables │ ├─────────┬──────────────────────┤ diff --git a/app/controlplane/plugins/sdk/v1/testdata/attestations/truncated.txt b/app/controlplane/plugins/sdk/v1/testdata/attestations/truncated.txt index f4f432809..fb722c87d 100644 --- a/app/controlplane/plugins/sdk/v1/testdata/attestations/truncated.txt +++ b/app/controlplane/plugins/sdk/v1/testdata/attestations/truncated.txt @@ -9,6 +9,7 @@ │ Workflow Run │ │ ├──────────────┼──────────────────────┤ │ ID │ beefdead │ +│ Attestation │ sha256:deadbeef │ │ Started At │ 22 Nov 21 00:00 UTC │ │ Finished At │ 22 Nov 21 00:10 UTC │ │ State │ success │ @@ -17,20 +18,19 @@ │ │ branch: stable │ │ │ toplevel: true │ └──────────────┴──────────────────────┘ -┌────────────────────────────────────────────────────────────────────────────────┐ -│ Materials │ -├─────────────┬──────────────────────────────────────────────────────────────────┤ -│ Name │ image │ -│ Type │ CONTAINER_IMAGE │ -│ Value │ index.docker.io/bitnami/nginx │ -│ Digest │ 264f55a6ff9cec2f4742a9faacc033b29f65c04dd4480e71e23579d484288d61 │ -├─────────────┼──────────────────────────────────────────────────────────────────┤ -│ Name │ skynet-sbom │ -│ Type │ SBOM_CYCLONEDX_JSON │ -│ Value │ sbom.cyclonedx.json │ -│ Digest │ 16159bb881eb4ab7eb5d8afc5350b0feeed1e31c0a268e355e74f9ccbe885e0c │ -│ Annotations │ ------ │ -│ │ component: nginx ... (truncated) +┌───────────────────────────────────────────────────────────────────────────────────────┐ +│ Materials │ +├─────────────┬─────────────────────────────────────────────────────────────────────────┤ +│ Name │ image │ +│ Type │ CONTAINER_IMAGE │ +│ Value │ index.docker.io/bitnami/nginx │ +│ Digest │ sha256:264f55a6ff9cec2f4742a9faacc033b29f65c04dd4480e71e23579d484288d61 │ +├─────────────┼─────────────────────────────────────────────────────────────────────────┤ +│ Name │ skynet-sbom │ +│ Type │ SBOM_CYCLONEDX_JSON │ +│ Value │ sbom.cyclonedx.json │ +│ Digest │ sha256:16159bb881eb4ab7eb5d8afc5350b0feeed1e31c0a268e355e74f9ccbe885e0c │ +│ Annotations │ -----... (truncated) Get Full Attestation