|
82 | 82 | # Also add additional SSH options for container environments |
83 | 83 | sed -i -e '/ssh:/a\ connect-timeout: 30' ./inventory.yaml || true; echo |
84 | 84 | sed -i -e '/ssh:/a\ host-key-check: false' ./inventory.yaml || true; echo |
| 85 | + # Set root credentials if not already present |
| 86 | + sed -i -e '/ssh:/a\ user: root' ./inventory.yaml || true; echo |
| 87 | + sed -i -e '/ssh:/a\ password: root' ./inventory.yaml || true; echo |
85 | 88 | echo ::endgroup:: |
86 | 89 | echo ::group::list contents of ./inventory.yaml |
87 | 90 | ls -l ./inventory.yaml || true; echo |
@@ -122,59 +125,22 @@ jobs: |
122 | 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 | 126 | done |
124 | 127 | echo ::endgroup:: |
125 | | - - name: Wait for SSH to be ready |
| 128 | + - name: Check container SSH configuration |
126 | 129 | run: | |
127 | | - echo ::group::wait_for_ssh |
128 | | - # Look for SSH keys created by litmus |
129 | | - if [ -f ./id_rsa ]; then |
130 | | - SSH_KEY="./id_rsa" |
131 | | - elif [ -f ./.vagrant/machines/*/virtualbox/private_key ]; then |
132 | | - SSH_KEY="./.vagrant/machines/*/virtualbox/private_key" |
133 | | - elif [ -f ./spec/fixtures/id_rsa ]; then |
134 | | - SSH_KEY="./spec/fixtures/id_rsa" |
135 | | - else |
136 | | - echo "No SSH key found, trying password authentication" |
137 | | - SSH_KEY="" |
138 | | - fi |
139 | | - |
140 | | - echo "Using SSH key: $SSH_KEY" |
141 | | - |
142 | | - # Wait for SSH to be available on all containers via Bolt |
143 | | - for i in {1..12}; do |
144 | | - echo "Attempt $i: Testing Bolt SSH connectivity..." |
145 | | - |
146 | | - # Build bolt command with appropriate auth |
147 | | - if [ -n "$SSH_KEY" ]; then |
148 | | - bolt_cmd="bundle exec bolt command run 'echo Bolt SSH test successful' \ |
149 | | - --inventoryfile ./inventory.yaml \ |
150 | | - --targets all \ |
151 | | - --connect-timeout 30 \ |
152 | | - --no-host-key-check \ |
153 | | - --private-key $SSH_KEY \ |
154 | | - --user root" |
155 | | - else |
156 | | - bolt_cmd="bundle exec bolt command run 'echo Bolt SSH test successful' \ |
157 | | - --inventoryfile ./inventory.yaml \ |
158 | | - --targets all \ |
159 | | - --connect-timeout 30 \ |
160 | | - --no-host-key-check" |
161 | | - fi |
162 | | - |
163 | | - if eval $bolt_cmd; then |
164 | | - echo "All containers are accessible via Bolt SSH!" |
165 | | - break |
166 | | - fi |
| 130 | + echo ::group::container_ssh_config |
| 131 | + for container in $(docker ps --format "table {{.Names}}" | tail -n +2); do |
| 132 | + echo "=== SSH config for $container ===" |
| 133 | + docker exec $container cat /etc/ssh/sshd_config | grep -E "(PasswordAuthentication|PubkeyAuthentication|PermitRootLogin)" || true |
167 | 134 | |
168 | | - if [ $i -eq 12 ]; then |
169 | | - echo "Containers failed to become accessible after 12 attempts" |
170 | | - echo "Final inventory check:" |
171 | | - cat ./inventory.yaml |
172 | | - exit 1 |
173 | | - fi |
174 | | - echo "Waiting 10 seconds before retry..." |
175 | | - sleep 10 |
| 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" |
176 | 142 | done |
177 | | - echo ::endgroup:: |
| 143 | + echo ::endgroup:: |
178 | 144 | - name: Install PE on test cluster |
179 | 145 | timeout-minutes: 120 |
180 | 146 | run: | |
|
0 commit comments