alexellis / alexellis/arkade

Feature Request: Add retry mechanism

Aberta
#778 9 comentários 0 reações 0 responsáveis Ver no GitHub
Linguagem predominante
Go
Estrelas
4.6k
Forks
299
Merge médio
33min
PRs com merge (30d)
10

Descrição

## 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

```

Guia de contribuição

Abrir o guia de contribuição

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.