@@ -127,146 +127,7 @@ jobs:
127127
128128 echo "=== New Docker transport inventory.yaml ==="
129129 cat ./inventory.yaml
130- echo ::endgroup::
131- echo ::group::info:request
132- cat request.json || true; echo
133- echo ::endgroup::
134- echo ::group::pwd
135- pwd
136- echo ::endgroup::
137- echo ::group::list parent directory
138- ls -la .. || true; echo
139- echo ::endgroup::
140- echo ::group::list parent directory+1
141- ls -la ../.. || true; echo
142- echo ::endgroup::
143- echo ::group::list parent directory+2
144- ls -la ../../.. || true; echo
145- echo ::endgroup::
146- echo ::group::list current directory
147- ls -la . || true; echo
148- echo ::endgroup::
149- echo ::group::list ~/.puppetlabs/etc/bolt
150- ls -la ~/.puppetlabs/etc/bolt || true; echo
151- echo ::endgroup::
152- echo ::group::which bolt
153- which bolt || echo "bolt not found"; echo
154- echo ::endgroup::
155- - name : Debug container setup
156- run : |
157- echo ::group::debug_container_setup
158- for container in $(docker ps --format "table {{.Names}}" | tail -n +2); do
159- echo "=== Container: $container ==="
160-
161- # Check if SSH service is actually running
162- echo "SSH service status:"
163- docker exec $container systemctl is-active ssh || docker exec $container service ssh status || echo "SSH service check failed"
164-
165- # Check SSH daemon logs
166- echo "SSH daemon logs:"
167- docker exec $container journalctl -u ssh --no-pager -n 10 || docker exec $container tail -10 /var/log/auth.log || echo "No SSH logs found"
168-
169- # Check root password is set
170- echo "Root account status:"
171- docker exec $container passwd -S root || echo "Cannot check root account"
172-
173- # Try to manually set root password
174- echo "Setting root password to 'root':"
175- docker exec $container bash -c 'echo "root:root" | chpasswd' || echo "Failed to set root password"
176-
177- # Check authorized_keys
178- echo "Authorized keys:"
179- docker exec $container cat /root/.ssh/authorized_keys 2>/dev/null || echo "No authorized_keys file"
180-
181- # Check if we can exec into container
182- echo "Test container exec:"
183- docker exec $container whoami || echo "Cannot exec into container"
184- done
185- echo ::endgroup::
186- - name : Debug SSH connectivity
187- run : |
188- echo ::group::debug_ssh_connectivity
189- # Install sshpass for password authentication
190- sudo apt-get update && sudo apt-get install -y sshpass
191-
192- # Check if containers are running
193- docker ps
194-
195- # Check SSH processes in containers
196- for container in $(docker ps --format "table {{.Names}}" | tail -n +2); do
197- echo "Testing SSH to container: $container"
198- echo "SSH processes in $container:"
199- docker exec $container ps aux | grep sshd || echo "No sshd processes found in $container"
200-
201- # Test SSH connectivity directly with password
202- echo "Testing direct SSH connection to $container:"
203- container_ip=$(docker inspect $container | jq -r '.[0].NetworkSettings.IPAddress')
204- echo "Container IP: $container_ip"
205-
206- # Get the mapped SSH port
207- ssh_port=$(docker port $container 22 | cut -d: -f2)
208- echo "SSH port mapping: localhost:$ssh_port -> $container:22"
209-
210- # Test SSH connection with sshpass and root password
211- echo "Testing SSH with sshpass and root/root:"
212- 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"
213-
214- # Also check what's actually listening on the SSH port
215- echo "Checking what's listening on port $ssh_port:"
216- netstat -ln | grep ":$ssh_port " || echo "Nothing listening on port $ssh_port"
217-
218- # Check SSH config inside container
219- echo "SSH configuration in $container:"
220- docker exec $container cat /etc/ssh/sshd_config | grep -E "(PasswordAuthentication|PermitRootLogin|PubkeyAuthentication)" || true
221-
222- # Check if root account is set up correctly
223- echo "Root account info in $container:"
224- docker exec $container passwd -S root || true
225- done
226- echo ::endgroup::
227- - name : Wait for Docker connectivity to be ready
228- run : |
229- echo ::group::wait_for_docker
230- # Wait for Docker connectivity to be available on all containers via Bolt
231- for i in {1..12}; do
232- echo "Attempt $i: Testing Bolt Docker connectivity..."
233-
234- # Test Docker transport connectivity
235- if bundle exec bolt command run 'echo "Bolt Docker test successful"' \
236- --inventoryfile ./inventory.yaml \
237- --targets pe_nodes; then
238- echo "All containers are accessible via Bolt Docker transport!"
239- break
240- fi
241-
242- if [ $i -eq 12 ]; then
243- echo "Containers failed to become accessible after 12 attempts"
244- echo "Final inventory check:"
245- cat ./inventory.yaml
246- echo "=== Docker container status ==="
247- docker ps
248- exit 1
249- fi
250- echo "Waiting 5 seconds before retry..."
251- sleep 5
252- done
253- echo ::endgroup::
254- - name : Check container SSH configuration
255- run : |
256- echo ::group::container_ssh_config
257- for container in $(docker ps --format "table {{.Names}}" | tail -n +2); do
258- echo "=== SSH config for $container ==="
259- docker exec $container cat /etc/ssh/sshd_config | grep -E "(PasswordAuthentication|PubkeyAuthentication|PermitRootLogin)" || true
260-
261- echo "=== Test password auth ==="
262- ssh_port=$(docker port $container 22 | cut -d: -f2)
263- # Try common passwords
264- for password in "root" "password" "litmus"; do
265- echo "Trying password: $password"
266- timeout 5 sshpass -p "$password" ssh -o StrictHostKeyChecking=no -o ConnectTimeout=5 -p $ssh_port root@localhost 'echo "Password auth successful with: $password"' && break
267- done || echo "Password authentication failed"
268- done
269- echo ::endgroup::
130+ echo ::endgroup::
270131 - name : Prepare containers for Bolt tasks
271132 run : |
272133 echo ::group::prepare_containers
0 commit comments