Skip to content

Commit 6def213

Browse files
committed
fix(docker): Multi does not launch a second Jenkins controller anymore.
1 parent b415756 commit 6def213

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

docker-compose.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ services:
5959
- python
6060
- node
6161
- android
62-
- multi
6362
- golang
6463
- default
6564
# The CASC_RELOAD_TOKEN environment variable is used by the Jenkins controller to restart the Configuration as Code (JCasc) plugin configuration.

dockerfiles/agent-discovery/find-name.sh

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,21 @@ while true; do
7979
sleep 2 # Wait for 5 seconds before the next iteration of the loop.
8080
done
8181

82+
# Check if jenkins_controller is reachable, otherwise fall back to multi_jenkins_controller
83+
JENKINS_CONTROLLER="jenkins_controller"
84+
if ! curl -s -f http://jenkins_controller:8080/login > /dev/null; then
85+
JENKINS_CONTROLLER="multi_jenkins_controller"
86+
fi
87+
8288
# Check If Jenkins is running or not
8389
# If the message is found, awk exits with a non-zero status (1), and the loop continues.
8490
# If the message is not found, the loop exits, and the "Jenkins is running" message is displayed.
85-
timeout 60 bash -c 'until curl -s -f http://jenkins_controller:8080/login > /dev/null; do sleep 5; done' && echo "Jenkins is running" || echo "Jenkins is not running"
91+
timeout 60 bash -c 'until curl -s -f http://$JENKINS_CONTROLLER:8080/login > /dev/null; do sleep 5; done' && echo "Jenkins is running" || echo "Jenkins is not running"
8692
echo "Jenkins is ready"
8793
# Get the Jenkins version
88-
JENKINS_VERSION=$(curl -s -I -k http://admin:admin@jenkins_controller:8080 | grep -i '^X-Jenkins:' | awk '{print $2}')
94+
JENKINS_VERSION=$(curl -s -I -k http://admin:admin@$JENKINS_CONTROLLER:8080 | grep -i '^X-Jenkins:' | awk '{print $2}')
8995
echo "Jenkins version is: $JENKINS_VERSION"
9096

9197
# Use the token in the curl command to reload the configuration
92-
# curl -X POST "http://admin:admin@jenkins_controller:8080/reload-configuration-as-code/?casc-reload-token=$JCASC_TOKEN"
93-
curl -X POST "http://admin:admin@jenkins_controller:8080/reload-configuration-as-code/?casc-reload-token=thisisnotsecure"
98+
# curl -X POST "http://admin:admin@$JENKINS_CONTROLLER:8080/reload-configuration-as-code/?casc-reload-token=$JCASC_TOKEN"
99+
curl -X POST "http://admin:admin@$JENKINS_CONTROLLER:8080/reload-configuration-as-code/?casc-reload-token=thisisnotsecure"

0 commit comments

Comments
 (0)