File tree 2 files changed +14
-8
lines changed
2 files changed +14
-8
lines changed Original file line number Diff line number Diff line change 32
32
TRYS=$REGISTER_TRYS
33
33
REGISTERED=1
34
34
35
- if test $REGISTER_MODE = " FRESH" -o $RUNNER_IS_PRESENT -ne 0 ; then
35
+ if test $REGISTER_MODE = " FRESH" -o $RUNNER_IS_PRESENT -ne 0 ; then
36
36
while test $TRYS -gt 0 -a $REGISTERED -gt 0 ; do
37
37
TRYS=$( expr $TRYS - 1)
38
38
gitlab-runner register -n --url=${GITLAB_URL} --registration-token=${REGISTER_TOKEN} \
39
39
--executor=docker --name=docker-multi-runner \
40
40
--run-untagged=true --locked=false --docker-image=docker:latest \
41
41
--docker-privileged \
42
- --docker-extra-hosts=" jarvis:192.168.34.98 "
42
+ --docker-extra-hosts=" HOSTNAME:HOSTIP "
43
43
REGISTERED=$?
44
44
if [ $REGISTERED -ne 0 ] ; then
45
- echo " ${GITLAB_URL} not ready $TRYS trys left, next try in 10 second for ${GITLAB_URL} "
45
+ echo " ${GITLAB_URL} not ready $TRYS trys left, next try in 10 second for ${GITLAB_URL} "
46
46
sleep 10
47
47
else
48
48
# Gitlab is ready, so remove ALL runner and re-registrer only one runner
@@ -56,9 +56,9 @@ if test $REGISTER_MODE = "FRESH" -o $RUNNER_IS_PRESENT -ne 0 ; then
56
56
--executor=docker --name=docker-multi-runner \
57
57
--run-untagged=true --locked=false --docker-image=docker:latest \
58
58
--docker-privileged \
59
- --docker-extra-hosts=" jarvis:192.168.34.98 "
59
+ --docker-extra-hosts=" HOSTNAME:HOSTIP "
60
60
fi
61
- done
61
+ done
62
62
fi
63
63
64
64
# launch gitlab-ci-multi-runner passing all arguments
Original file line number Diff line number Diff line change @@ -25,11 +25,12 @@ echo "Setting HOSTNAME to $GIVEN_HOSTNAME"
25
25
HOSTNAME=$GIVEN_HOSTNAME
26
26
27
27
echo " Type your hostIP, I guess it is one of $( hostname -I) "
28
- echo " Remember, 127.0.0.1 is NOT the correct IP and the docker-Network starts with 172.x.y.z"
29
-
28
+ echo " Remember, 127.0.0.1 is NOT the correct IP and the docker-Network starts with 172.x.y.z and is also not correct "
29
+
30
30
read -e -p " Your hostIP : " -i $HOSTIP GIVEN_HOSTIP
31
31
HOSTIP=$GIVEN_HOSTIP
32
-
32
+ echo " Setting HOSTIP to $GIVEN_HOSTIP "
33
+ echo " "
33
34
type openssl 2> /dev/null
34
35
if [ $? -eq 0 ] ; then
35
36
echo " openssl installed :-)"
@@ -95,6 +96,11 @@ cp -r preconfig/jenkins/* $USER_DATA_DIR/jenkins/
95
96
sed s#BASE_DATA_DIR#${USER_DATA_DIR} # g docker-compose.yml.template > docker-compose.yml
96
97
sed -i s#HOSTIP#${HOSTIP} # g docker-compose.yml
97
98
sed -i s#HOSTNAME#${HOSTNAME} # g docker-compose.yml
99
+
100
+ # Gitlabrunner needs extra_hosts to clone stuff via hostname
101
+ sed -i s#HOSTNAME#${HOSTNAME} # g gitlabrunner/entrypointAutoregister
102
+ sed -i s#HOSTIP#${HOSTIP} # g gitlabrunner/entrypointAutoregister
103
+
98
104
chmod a+rw docker-compose.yml
99
105
echo " -------------------------------------------------------------------------------------------"
100
106
echo " -------------------------------------------------------------------------------------------"
You can’t perform that action at this time.
0 commit comments