Skip to content

Commit a71984c

Browse files
authored
fix(cli): do not double render the envelope on attestation push (#909)
Signed-off-by: Miguel Martinez Trivino <[email protected]>
1 parent 37f12c6 commit a71984c

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

app/cli/internal/action/attestation_push.go

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
package action
1717

1818
import (
19-
"bytes"
2019
"context"
2120
"encoding/json"
2221
"fmt"
@@ -38,7 +37,7 @@ type AttestationPushOpts struct {
3837

3938
type AttestationResult struct {
4039
Digest string `json:"digest"`
41-
Envelope string `json:"envelope"`
40+
Envelope *dsse.Envelope `json:"envelope"`
4241
Status *AttestationStatusResult `json:"status"`
4342
}
4443

@@ -144,14 +143,7 @@ func (action *AttestationPush) Run(ctx context.Context, attestationID string, ru
144143
return nil, err
145144
}
146145

147-
var rawEnvelope bytes.Buffer
148-
encoder := json.NewEncoder(&rawEnvelope)
149-
encoder.SetIndent("", " ")
150-
if err := encoder.Encode(envelope); err != nil {
151-
return nil, fmt.Errorf("failed to encode output: %w", err)
152-
}
153-
154-
attestationResult := &AttestationResult{Envelope: rawEnvelope.String(), Status: attestationStatus}
146+
attestationResult := &AttestationResult{Envelope: envelope, Status: attestationStatus}
155147

156148
action.Logger.Debug().Msg("render completed")
157149
if action.c.CraftingState.DryRun {

0 commit comments

Comments
 (0)