feat(hcp-sbom): implement retry logic for downloading Packer release zip

HRP-2522-Remove_syft_bin
Hari Om 2 days ago
parent b90187ae09
commit 13cad73e1a

@ -241,7 +241,15 @@ func downloadPackerRelease(ctx context.Context, goos, goarch string) (string, er
log.Printf("[INFO] Downloading Packer %s for %s/%s...", version, goos, goarch)
// Download the release zip.
zipPath, err := downloadURLToTempFile(ctx, client, zipURL, ".zip")
var zipPath string
err = retry.Config{
Tries: 3,
RetryDelay: func() time.Duration {return 5 * time.Second},
}.Run(ctx , func(ctx context.Context) error {
var e error
zipPath, e = downloadURLToTempFile(ctx, client, zipURL, ".zip")
return e
})
if err != nil {
return "", fmt.Errorf("failed to download Packer release zip: %w", err)
}

Loading…
Cancel
Save