From 13cad73e1a286da770853e395d6fc7e8d65f73c0 Mon Sep 17 00:00:00 2001 From: Hari Om Date: Wed, 20 May 2026 13:47:31 +0530 Subject: [PATCH] feat(hcp-sbom): implement retry logic for downloading Packer release zip --- provisioner/hcp-sbom/release_download.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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) }