diff --git a/provisioner/hcp-sbom/release_download.go b/provisioner/hcp-sbom/release_download.go index 77ae095ce..84c181047 100644 --- a/provisioner/hcp-sbom/release_download.go +++ b/provisioner/hcp-sbom/release_download.go @@ -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) }