This repository was archived by the owner on Feb 14, 2023. It is now read-only.
File tree 1 file changed +23
-7
lines changed
1 file changed +23
-7
lines changed Original file line number Diff line number Diff line change @@ -14,27 +14,43 @@ function target_cf() {
14
14
local cf_domain=$( cat " ${ROOT} /cf-install-values/cf-install-values.yml" | \
15
15
grep system_domain | awk ' {print $2}' | tr -d ' "' )
16
16
17
- cf api --skip-ssl-validation " https://api.${cf_domain} "
17
+ cf_with_retry api --skip-ssl-validation " https://api.${cf_domain} "
18
18
local password=$( cat " ${ROOT} /cf-install-values/cf-install-values.yml" | \
19
19
grep cf_admin_password | awk ' {print $2}' )
20
- cf auth " admin" " ${password} "
20
+ cf_with_retry auth " admin" " ${password} "
21
21
}
22
22
23
23
function create_org_and_space() {
24
- cf create-org " ${ORG_NAME} "
25
- cf create-space -o " ${ORG_NAME} " " ${SPACE_NAME} "
24
+ cf_with_retry create-org " ${ORG_NAME} "
25
+ cf_with_retry create-space -o " ${ORG_NAME} " " ${SPACE_NAME} "
26
26
}
27
27
28
28
function deploy_app() {
29
29
local name=" ${1} "
30
- cf push " ${name} " -o " cfrouting/httpbin" -i " ${INSTANCES} "
30
+ cf_with_retry push " ${name} " -o " cfrouting/httpbin" -i " ${INSTANCES} "
31
+ }
32
+
33
+ function cf_with_retry() {
34
+ cf_command=$*
35
+
36
+ set +euo pipefail
37
+
38
+ for i in {1..3}
39
+ do
40
+ echo " Running cf ${cf_command} ..."
41
+ cf $cf_command && set -euo pipefail && return
42
+ sleep 10
43
+ done
44
+
45
+ echo " cf_with_retry command has failed 3 times"
46
+ exit
31
47
}
32
48
33
49
function main() {
34
50
target_cf
35
51
create_org_and_space
36
- cf target -o " ${ORG_NAME} " -s " ${SPACE_NAME} "
37
- cf enable-feature-flag diego_docker
52
+ cf_with_retry target -o " ${ORG_NAME} " -s " ${SPACE_NAME} "
53
+ cf_with_retry enable-feature-flag diego_docker
38
54
deploy_app " ${APP_NAME} "
39
55
}
40
56
You can’t perform that action at this time.
0 commit comments