Merge "Add new job template, macro and jenkins job for SFC with docker"
[releng/builder.git] / jjb / integration / integration-macros.yaml
index b4365356428fbebc67a5d10c4b871dcf0b2716e5..46ccd1269ec7953ef89c23950cecb8aebb20e8c9 100644 (file)
         - shell: |
             #!/bin/bash
             function copy-ssh-keys-to-slave() {
-                RETRIES=30
+                RETRIES=60
                 for j in $(seq 1 $RETRIES); do
                     if `ssh-copy-id -i /home/jenkins/.ssh/id_rsa.pub "jenkins@${i}" > /dev/null 2>&1`; then
                         ssh jenkins@${i} 'echo "$(facter ipaddress_eth0) $(/bin/hostname)" | sudo tee -a /etc/hosts'
             echo "OpenStack IPS are ${JCLOUDS_IPS}"
 
             IFS=',' read -ra ADDR <<< "${JCLOUDS_IPS}"
-
+            pids=""
             for i in "${ADDR[@]}"; do
-                copy-ssh-keys-to-slave &
+                ( copy-ssh-keys-to-slave ) &
+                # Store PID of process
+                pids+=" $!"
             done
 
-            wait
+            # Detect when a process failed to copy ssh keys and fail build
+            for p in $pids; do
+                if wait $p; then
+                    echo "Process $p successfully copied ssh keys."
+                else
+                    echo "Process $p failed to copy ssh keys."
+                    exit 1
+                fi
+            done
             echo "Copying ssh keys complete."
 
 # Macro: integration-get-slave-addresses