Skip to content

Commit fac645f

Browse files
committed
add retries to git clone
1 parent 4c519b1 commit fac645f

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

collection/gcp/assets/cloud-config.yaml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,15 @@ write_files:
2525
/usr/bin/docker login -u oauth2accesstoken -p "$${ACCESS}" https://gcr.io
2626
if [ ! -d /home/composer/opencspm ]; then
2727
cd /home/composer
28-
git clone https://github.com/OpenCSPM/opencspm.git
28+
n=0
29+
until [ $n -ge 5 ]
30+
do
31+
git clone https://github.com/OpenCSPM/opencspm.git && break
32+
n=$[$n+1]
33+
sleep 5
34+
done
2935
3036
mkdir -p /home/composer/opencspm/config
31-
touch /home/composer/opencspm/config/config.yaml
32-
3337
cat << EOF > /home/composer/opencspm/config/config.yaml
3438
---
3539
db:
@@ -43,7 +47,13 @@ write_files:
4347
mkdir -p /home/composer/opencspm-controls
4448
if [ ! -d /home/composer/opencspm-controls/opencspm-darkbit-community-controls ]; then
4549
cd /home/composer/opencspm-controls
46-
git clone https://github.com/OpenCSPM/opencspm-darkbit-community-controls.git
50+
n=0
51+
until [ $n -ge 5 ]
52+
do
53+
git clone https://github.com/OpenCSPM/opencspm-darkbit-community-controls.git && break
54+
n=$[$n+1]
55+
sleep 5
56+
done
4757
fi
4858
- path: /etc/systemd/system/composer.service
4959
permissions: 0644
@@ -61,6 +71,7 @@ write_files:
6171
ExecStop=/usr/bin/docker run --rm -v /var/run/docker.sock:/var/run/docker.sock -v "/home/composer/.docker:/root/.docker" -v "/home/composer:/home/composer" -w="/home/composer/opencspom/docker" docker/compose:1.27.4 rm -f
6272
Restart=on-failure
6373
RestartSec=10
74+
TimeoutSec=600
6475
[Install]
6576
WantedBy=multi-user.target
6677
runcmd:

0 commit comments

Comments
 (0)