Skip to content

Commit

Permalink
add retry logic to getting all target metadata form notary
Browse files Browse the repository at this point in the history
  • Loading branch information
James-Pickett committed Aug 2, 2023
1 parent 55dd7bf commit af7b1f2
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions pkg/make/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
"github.com/go-kit/kit/log"
"github.com/go-kit/kit/log/level"
"github.com/kolide/kit/fsutil"
"github.com/kolide/launcher/pkg/backoff"
"github.com/kolide/launcher/pkg/contexts/ctxlog"

"github.com/theupdateframework/notary/client"
Expand Down Expand Up @@ -461,9 +462,12 @@ func bootstrapFromNotary(notaryConfigDir, remoteServerURL, localRepo, gun string
return fmt.Errorf("create an instance of the TUF repository: %w", err)
}

if _, err := repo.GetAllTargetMetadataByName(""); err != nil {
return fmt.Errorf("getting all target metadata: %w", err)
}
backoff.WaitFor(func() error {
if _, err := repo.GetAllTargetMetadataByName(""); err != nil {
return fmt.Errorf("getting all target metadata: %w", err)
}
return nil
}, 5*time.Minute, 30*time.Second)

// Stage TUF metadata and create bindata from it so it can be distributed as part of the Launcher executable
source := filepath.Join(notaryConfigDir, "tuf", gun, "metadata")
Expand Down

0 comments on commit af7b1f2

Please sign in to comment.