Skip to content

Commit 2c18ddc

Browse files
authored
chore(dagger): remove unused method (#2173)
Signed-off-by: Miguel Martinez <[email protected]>
1 parent b950db2 commit 2c18ddc

File tree

1 file changed

+0
-65
lines changed

1 file changed

+0
-65
lines changed

extras/dagger/main.go

Lines changed: 0 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package main
33

44
import (
55
"context"
6-
"encoding/base64"
76
"encoding/json"
87
"fmt"
98
"main/internal/dagger"
@@ -512,67 +511,3 @@ func (m *Chainloop) WorkflowCreate(
512511
}, execOpts).
513512
Stdout(ctx)
514513
}
515-
516-
type AttestationResult struct {
517-
AttestationID string
518-
Digest string
519-
Statement string
520-
Bundle string
521-
HasPolicyViolations bool
522-
}
523-
524-
func (m *Chainloop) AttestationResult(
525-
ctx context.Context,
526-
// Chainloop API token
527-
token *dagger.Secret,
528-
// Attestation ID
529-
id string,
530-
) (*AttestationResult, error) {
531-
var err error
532-
info, err := cliContainer(0, token, m.Instance).
533-
WithExec([]string{
534-
"workflow", "run", "describe",
535-
"--id", id,
536-
"--output", "json",
537-
}, execOpts).
538-
Stdout(ctx)
539-
if err != nil {
540-
return nil, err
541-
}
542-
543-
var resp struct {
544-
Attestation struct {
545-
Digest string
546-
Envelope struct {
547-
Payload string
548-
}
549-
Bundle string
550-
PolicyEvaluationStatus struct {
551-
HasViolations bool
552-
}
553-
}
554-
}
555-
556-
if err := json.Unmarshal([]byte(info), &resp); err != nil {
557-
return nil, err
558-
}
559-
560-
attestation := resp.Attestation
561-
statement, err := base64.StdEncoding.DecodeString(attestation.Envelope.Payload)
562-
if err != nil {
563-
return nil, err
564-
}
565-
566-
bundle, err := base64.StdEncoding.DecodeString(attestation.Bundle)
567-
if err != nil {
568-
return nil, err
569-
}
570-
571-
return &AttestationResult{
572-
AttestationID: id,
573-
Digest: attestation.Digest,
574-
Statement: string(statement),
575-
Bundle: string(bundle),
576-
HasPolicyViolations: attestation.PolicyEvaluationStatus.HasViolations,
577-
}, nil
578-
}

0 commit comments

Comments
 (0)