Skip to content
Merged
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
14 changes: 11 additions & 3 deletions app/controlplane/pkg/data/workflowrun.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,17 @@ func (r *WorkflowRunRepo) FindByIDInOrg(ctx context.Context, orgID, id uuid.UUID

// SaveAttestation Saves the attestation for a workflow run in the database
func (r *WorkflowRunRepo) SaveAttestation(ctx context.Context, id uuid.UUID, att *dsse.Envelope, digest string) error {
run, err := r.data.DB.WorkflowRun.UpdateOneID(id).
SetAttestationDigest(digest).
Save(ctx)
q := r.data.DB.WorkflowRun.UpdateOneID(id).
SetAttestationDigest(digest)

// the envelope will come empty in normal attestations, since bundles are stored separately
// But old CLIs might still send the envelope instead of the bundle. In those cases, we store it
// as before. But this is a DEPRECATED behaviour that will be removed eventually.
if att != nil {
// Set attestation when using old CLI versions
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, so make it even more obvious that this is a deprecated behavior

q.SetAttestation(att)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but I thought that we wanted to store always bundle. Didn't we end up doing some sort of automatic wrapping on a bundle?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could. But even if we do it, old attestations must still be supported

}
run, err := q.Save(ctx)
if err != nil && !ent.IsNotFound(err) {
return err
} else if run == nil {
Expand Down
Loading