Retry curl up to 3 times for transient network errors

Signed-off-by: Amir Zarrinkafsh <nightah@me.com>
pull/465/head
Amir Zarrinkafsh 2019-11-29 09:50:26 +11:00 committed by Clément Michaud
parent 1c35be7c27
commit 68845057a2
1 changed files with 2 additions and 2 deletions

View File

@ -52,10 +52,10 @@ func (d *Docker) Manifest(tag, amd64tag, arm32v7tag, arm64v8tag string) error {
// CleanTag remove a tag from dockerhub.
func (d *Docker) CleanTag(tag string) error {
return utils.CommandWithStdout("bash", "-c", "curl -s -o /dev/null -u $DOCKER_USERNAME:$DOCKER_PASSWORD -X DELETE https://cloud.docker.com/v2/repositories/"+DockerImageName+"/tags/"+tag+"/").Run()
return utils.CommandWithStdout("bash", "-c", "curl -fs --retry 3 -o /dev/null -u $DOCKER_USERNAME:$DOCKER_PASSWORD -X DELETE https://cloud.docker.com/v2/repositories/"+DockerImageName+"/tags/"+tag+"/").Run()
}
// PublishReadme push README.md to dockerhub.
func (d *Docker) PublishReadme() error {
return utils.CommandWithStdout("bash", "-c", `jq -n --arg msg "$(<README.md)" '{"registry":"registry-1.docker.io","full_description": $msg }' | curl -s -o /dev/null -u $DOCKER_USERNAME:$DOCKER_PASSWORD -X "PATCH" -H "Content-Type: application/json" -d @- https://cloud.docker.com/v2/repositories/clems4ever/authelia/`).Run()
return utils.CommandWithStdout("bash", "-c", `jq -n --arg msg "$(<README.md)" '{"registry":"registry-1.docker.io","full_description": $msg }' | curl -fs --retry 3 -o /dev/null -u $DOCKER_USERNAME:$DOCKER_PASSWORD -X "PATCH" -H "Content-Type: application/json" -d @- https://cloud.docker.com/v2/repositories/clems4ever/authelia/`).Run()
}