From fc6397378f786b5ca8f80aae60775d2c4600d727 Mon Sep 17 00:00:00 2001 From: Giles Bradshaw Date: Thu, 24 Sep 2020 14:57:50 +0100 Subject: [PATCH] fix: retries only 10 times --- .drone/drone-home.jsonnet | 5 +++++ .drone/package.json | 2 +- .drone/scripts/initialise-image.sh | 7 ++++++- .drone/scripts/login.sh | 7 ++++++- 4 files changed, 18 insertions(+), 3 deletions(-) diff --git a/.drone/drone-home.jsonnet b/.drone/drone-home.jsonnet index e7f60a3..189dd3d 100644 --- a/.drone/drone-home.jsonnet +++ b/.drone/drone-home.jsonnet @@ -14,6 +14,11 @@ local config = { registry( config { script: 'sh .drone/scripts/initialise-images.sh', + secrets: [ + 'REGISTRY_DOMAIN', + 'REGISTRY_PORT', + 'REGISTRY_PASSWORD' + ], }, ) { trigger +: { diff --git a/.drone/package.json b/.drone/package.json index 33fb902..0f0cc55 100644 --- a/.drone/package.json +++ b/.drone/package.json @@ -4,6 +4,6 @@ "build": "drone jsonnet --source drone-home.jsonnet --target drone-home.yml --stream" }, "dependencies": { - "@sigyl/jsonnet-drone": "^0.3.0" + "@sigyl/jsonnet-drone": "^0.3.1" } } diff --git a/.drone/scripts/initialise-image.sh b/.drone/scripts/initialise-image.sh index 08adf61..fcc8014 100644 --- a/.drone/scripts/initialise-image.sh +++ b/.drone/scripts/initialise-image.sh @@ -5,7 +5,12 @@ do && docker tag $2 $1$2 \ && docker push $1$2 && break # substitute your command here n=$((n+1)) + if [ $n -ge 10 ]; then + echo "initialise failed" + exit 1 + fi + echo "retrying..$n" - sleep 1 + sleep 5 done diff --git a/.drone/scripts/login.sh b/.drone/scripts/login.sh index 5a3fe4f..771c6e2 100644 --- a/.drone/scripts/login.sh +++ b/.drone/scripts/login.sh @@ -4,8 +4,13 @@ do docker login $1 --username client --password $2 \ && break # substitute your command here n=$((n+1)) + + if [ $n -ge 10 ]; then + echo "login failed" + exit 1 + fi echo "retrying login..$n" - sleep 1 + sleep 5 done sh $(dirname $0)/initialise-image.sh $1 drone/drone:1.9.0 \