Skip to content

Commit c28a6c8

Browse files
gaultierory-bot
authored andcommitted
fix: always retry curl invocations to surmount transient third-party failures
GitOrigin-RevId: b23ca94a4e1ba11367012a70a9e528b614f3ceb9
1 parent 1b6e8f3 commit c28a6c8

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

install.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,9 +271,9 @@ http_download_curl() {
271271
source_url=$2
272272
header=$3
273273
if [ -z "$header" ]; then
274-
code=$(curl -w '%{http_code}' -sL -o "$local_file" "$source_url")
274+
code=$(curl --retry 7 --retry-connrefused -w '%{http_code}' -sL -o "$local_file" "$source_url")
275275
else
276-
code=$(curl -w '%{http_code}' -sL -H "$header" -o "$local_file" "$source_url")
276+
code=$(curl --retry 7 --retry-connrefused -w '%{http_code}' -sL -H "$header" -o "$local_file" "$source_url")
277277
fi
278278
if [ "$code" != "200" ]; then
279279
log_debug "http_download_curl received HTTP status $code"

internal/certification/scripts/install.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ mkdir -p go/bin
2020
source "$HOME"/.profile
2121

2222
# go/dep
23-
curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
23+
curl --retry 7 --retry-connrefused https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
2424

2525
# Docker
2626
sudo apt-get update
@@ -30,7 +30,7 @@ sudo apt-get -y install \
3030
curl \
3131
gnupg2 \
3232
software-properties-common
33-
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
33+
curl --retry 7 --retry-connrefused -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add -
3434
sudo add-apt-repository \
3535
"deb [arch=amd64] https://download.docker.com/linux/debian \
3636
$(lsb_release -cs) \

internal/certification/scripts/start.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,13 @@ docker start kong
1212

1313
dockerize -wait http://localhost:8001/ -timeout 30s
1414

15-
ip=$(curl ifconfig.co)
15+
ip=$(curl --retry 7 --retry-connrefused ifconfig.co)
1616

17-
curl -i -X DELETE --url http://localhost:8001/apis/hydra-oauth
18-
curl -i -X DELETE --url http://localhost:8001/apis/login-consent
17+
curl --retry 7 --retry-connrefused -i -X DELETE --url http://localhost:8001/apis/hydra-oauth
18+
curl --retry 7 --retry-connrefused -i -X DELETE --url http://localhost:8001/apis/login-consent
1919

2020
curl -i -X POST \
21+
--retry 7 --retry-connrefused \
2122
--url http://localhost:8001/apis/ \
2223
--data 'name=hydra-oauth' \
2324
--data upstream_url=http://"${ip}":9000/ \
@@ -26,6 +27,7 @@ curl -i -X POST \
2627
--data 'preserve_host=true'
2728

2829
curl -i -X POST \
30+
--retry 7 --retry-connrefused \
2931
--url http://localhost:8001/apis/ \
3032
--data 'name=login-consent' \
3133
--data upstream_url=http://"$ip":9001/ \

0 commit comments

Comments
 (0)