Skip to content

Commit

Permalink
finalising changes.
Browse files Browse the repository at this point in the history
Signed-off-by: chaosinthecrd <[email protected]>
  • Loading branch information
ChaosInTheCRD authored and jkjell committed Jan 23, 2024
1 parent 6ba1969 commit cd129ce
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions attestation/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ func (ctx *AttestationContext) RunAttestors() error {
Reason: fmt.Sprintf("unknown run type %v", attestor.RunType()),
}
}

attestors[attestor.RunType()] = append(attestors[attestor.RunType()], attestor)
}

for _, atts := range attestors {
Expand Down
13 changes: 13 additions & 0 deletions run.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"github.com/in-toto/go-witness/cryptoutil"
"github.com/in-toto/go-witness/dsse"
"github.com/in-toto/go-witness/intoto"
"github.com/in-toto/go-witness/log"
)

type runOptions struct {
Expand Down Expand Up @@ -85,6 +86,18 @@ func Run(stepName string, signer cryptoutil.Signer, opts ...RunOption) (RunResul
return result, fmt.Errorf("failed to run attestors: %w", err)
}

fail := false
for _, r := range runCtx.CompletedAttestors() {
if r.Error != nil {
fail = true
log.Errorf("attestor %s failed: %s", r.Attestor.Name(), r.Error)
}
}

if fail {
return result, fmt.Errorf("attestors failed with errors")
}

result.Collection = attestation.NewCollection(ro.stepName, runCtx.CompletedAttestors())
result.SignedEnvelope, err = signCollection(result.Collection, dsse.SignWithSigners(ro.signer), dsse.SignWithTimestampers(ro.timestampers...))
if err != nil {
Expand Down

0 comments on commit cd129ce

Please sign in to comment.