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
4 changes: 4 additions & 0 deletions app/controlplane/internal/dispatcher/dispatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
13 changes: 7 additions & 6 deletions app/controlplane/plugins/sdk/v1/fanout.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion app/controlplane/plugins/sdk/v1/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down Expand Up @@ -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 {
Expand Down
13 changes: 7 additions & 6 deletions app/controlplane/plugins/sdk/v1/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
}
}
Expand Down
125 changes: 68 additions & 57 deletions app/controlplane/plugins/sdk/v1/plugin/api/fanout.pb.go

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

1 change: 1 addition & 0 deletions app/controlplane/plugins/sdk/v1/plugin/api/fanout.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
Expand Down
22 changes: 12 additions & 10 deletions app/controlplane/plugins/sdk/v1/plugin/api/translation.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
}

Expand All @@ -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,
},
}

Expand Down
7 changes: 4 additions & 3 deletions app/controlplane/plugins/sdk/v1/testdata/attestations/full.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |
Expand All @@ -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 |
| --- | --- |
Expand Down
Loading