@@ -103,6 +103,9 @@ jobs:
103103 - name : Debug SSH connectivity
104104 run : |
105105 echo ::group::debug_ssh_connectivity
106+ # Install sshpass first
107+ sudo apt-get update && sudo apt-get install -y sshpass
108+
106109 # Check if containers are running
107110 docker ps
108111
@@ -112,35 +115,58 @@ jobs:
112115 echo "SSH processes in $container:"
113116 docker exec $container ps aux | grep sshd || echo "No sshd processes found in $container"
114117
115- # Test SSH connectivity directly
118+ # Test SSH connectivity directly with password
116119 echo "Testing direct SSH connection to $container:"
117- container_ip=$(docker inspect $container | jq -r '.[0].NetworkSettings.IPAddress')
118- echo "Container IP: $container_ip"
119-
120- # Get the mapped SSH port
121120 ssh_port=$(docker port $container 22 | cut -d: -f2)
122121 echo "SSH port mapping: localhost:$ssh_port -> $container:22"
123122
124- # Test SSH connection with timeout
125- timeout 10 ssh -o StrictHostKeyChecking=no -o ConnectTimeout=5 -p $ssh_port root@localhost 'echo "SSH connection successful"' || echo "SSH connection failed to $container"
123+ # Test SSH connection with password
124+ echo "Testing SSH with root/root:"
125+ timeout 10 sshpass -p "root" ssh -o StrictHostKeyChecking=no -o ConnectTimeout=5 -p $ssh_port root@localhost 'echo "SSH connection successful to $container"' || echo "SSH connection failed to $container"
126+ done
127+ echo ::endgroup::
128+
129+ - name : Wait for SSH to be ready
130+ run : |
131+ echo ::group::wait_for_ssh
132+ # Wait for SSH to be available on all containers via Bolt
133+ for i in {1..12}; do
134+ echo "Attempt $i: Testing Bolt SSH connectivity with root/root..."
135+
136+ # Test with root/root credentials
137+ if bundle exec bolt command run 'echo "Bolt SSH test successful"' \
138+ --inventoryfile ./inventory.yaml \
139+ --targets all \
140+ --connect-timeout 30 \
141+ --no-host-key-check \
142+ --user root \
143+ --password root; then
144+ echo "All containers are accessible via Bolt SSH!"
145+ break
146+ fi
147+
148+ if [ $i -eq 12 ]; then
149+ echo "Containers failed to become accessible after 12 attempts"
150+ echo "Final inventory check:"
151+ cat ./inventory.yaml
152+ echo "=== Docker container status ==="
153+ docker ps
154+ exit 1
155+ fi
156+ echo "Waiting 10 seconds before retry..."
157+ sleep 10
126158 done
127159 echo ::endgroup::
160+
128161 - name : Check container SSH configuration
129162 run : |
130163 echo ::group::container_ssh_config
131164 for container in $(docker ps --format "table {{.Names}}" | tail -n +2); do
132165 echo "=== SSH config for $container ==="
133166 docker exec $container cat /etc/ssh/sshd_config | grep -E "(PasswordAuthentication|PubkeyAuthentication|PermitRootLogin)" || true
134-
135- echo "=== Test password auth ==="
136- ssh_port=$(docker port $container 22 | cut -d: -f2)
137- # Try common passwords
138- for password in "root" "password" "litmus"; do
139- echo "Trying password: $password"
140- timeout 5 sshpass -p "$password" ssh -o StrictHostKeyChecking=no -o ConnectTimeout=5 -p $ssh_port root@localhost 'echo "Password auth successful with: $password"' && break
141- done || echo "Password authentication failed"
142167 done
143- echo ::endgroup::
168+ echo ::endgroup::
169+
144170 - name : Install PE on test cluster
145171 timeout-minutes : 120
146172 run : |
0 commit comments