alexellis / alexellis/arkade

Feature Request: Add retry mechanism

Aperta
#778 9 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Go
Stelle
4.6k
Fork
299
Merge medio
33m
PR unite (30g)
10

Descrizione

## Expected Behaviour

arkade is being used in CI pipelines and from time to time might fail on network hiccups.
It would be great if internally it could retry its `http` requests for common failures.

## Current Behaviour

In the following examples you can see a network failures that caused to exit with an error without retrying

```
[2022-10-05T12:40:07.291Z] Downloading: terragrunt
[2022-10-05T12:40:07.291Z] 2022/10/05 12:40:07 Looking up version for terragrunt
[2022-10-05T12:40:07.291Z] 2022/10/05 12:40:07 Found: v0.39.0
[2022-10-05T12:40:07.292Z] Downloading: https://github.com/gruntwork-io/terragrunt/releases/download/v0.39.0/terragrunt_linux_amd64
[2022-10-05T12:40:13.910Z] Error: incorrect status for downloading tool: 503
```

```
[2022-10-06T00:02:02.842Z] Downloading: terragrunt
[2022-10-06T00:02:02.842Z] 2022/10/06 00:02:00 Looking up version for terragrunt
[2022-10-06T00:02:11.003Z] Error: Head "https://github.com/gruntwork-io/terragrunt/releases/latest": context deadline exceeded (Client.Timeout exceeded while awaiting headers)
```

## Are you a GitHub Sponsor yet (Yes/No?)

- [ ] Yes
- [x] No

## Possible Solution

Using https://github.com/hashicorp/go-retryablehttp that wouldn't require any refactoring. it just wraps the familiar HTTP client interface with automatic retries and exponential backoff.

## Context

## Your Environment

* What arkade version is this?

```
arkade version

_ _
__ _ _ __| | ____ _ __| | ___
/ _` | '__| |/ / _` |/ _` |/ _ \
| (_| | | | < (_| | (_| | __/
\__,_|_| |_|\_\__,_|\__,_|\___|

Open Source Marketplace For Developer Tools

Version: 0.8.44
Git Commit: b543e60a68285ce8a147d9b0a6493f573747b8d1

🐳 arkade needs your support: https://github.com/sponsors/alexellis

```

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.