mirror of
https://github.com/hashicorp/packer.git
synced 2026-05-28 04:35:38 -04:00
feat(hcp-sbom): implement retry logic for downloading Packer release zip
This commit is contained in:
parent
b90187ae09
commit
13cad73e1a
1 changed files with 9 additions and 1 deletions
|
|
@ -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…
Reference in a new issue