Fix the missing whitespace for the list of pids
[releng/builder.git] / jjb / integration / integration-macros.yaml
index c180baec8404b57993a1ffa2835ac3d6886bee8a..da2da40d0d2431ee6c255f937359f6c1cba09287 100644 (file)
@@ -94,7 +94,7 @@
     name: integration-gerrit-scm
     scm:
         - git:
-            credentials-id: '{credentials-id}'
+            credentials-id: 'opendaylight-jenkins-ssh'
             url: '$GIT_BASE'
             basedir: '{basedir}'
             refspec: '{refspec}'
     name: integration-distribution-scm
     scm:
         - git:
-            credentials-id: '{credentials-id}'
+            credentials-id: 'opendaylight-jenkins-ssh'
             basedir: 'distribution'
             url: '$DISTROGITURL'
             refspec: ''
     wrappers:
       - jclouds:
           instances:
-            - rk-c7-java:
-                cloud-name: 'Rackspace DFW - Integration Dynamic Lab'
+            - '{controller-image}':
+                cloud-name: 'ODLPUB'
                 count: '{controller-vms}'
-                stop-on-terminate: False
             - '{mininet-image}':
-                cloud-name: '{mininet-cloud-name}'
+                cloud-name: 'ODLPUB'
                 count: '{mininet-vms}'
-                stop-on-terminate: False
+
+# Macro: integration-openstack-controller-mininet
+# Operation: this macro will spin the controller and mininet vms
+# Used by: {project}-csit-* job templates
+
+- wrapper:
+    name: integration-openstack-controller-mininet
+    wrappers:
+      - openstack:
+          instances:
+            - cloud-name: 'ODLRPC'
+              template-name: '{controller-image}'
+              count: '{controller-vms}'
+            - cloud-name: 'ODLRPC'
+              template-name: '{mininet-image}'
+              count: '{mininet-vms}'
+
+# Macro: integration-jclouds-controller-devstack
+# Operation: this macro will spin the controller and devstack vms
+# Used by: {project}-csit-openstack job templates
+- wrapper:
+    name: integration-jclouds-controller-devstack
+    wrappers:
+      - jclouds:
+          instances:
+            - '{controller-image}':
+                cloud-name: 'ODLPUB'
+                count: '{controller-vms}'
+            - '{openstack-image}':
+                cloud-name: 'ODLPUB'
+                count: '{openstack-vms}'
+
+# Macro: integration-openstack-controller-devstack
+# Operation: this macro will spin the controller and devstack vms
+# Used by: {project}-csit-openstack job templates
+- wrapper:
+    name: integration-openstack-controller-devstack
+    wrappers:
+      - openstack:
+          instances:
+            - cloud-name: 'ODLRPC'
+              template-name: '{controller-image}'
+              count: '{controller-vms}'
+            - cloud-name: 'ODLRPC'
+              template-name: '{openstack-image}'
+              count: '{openstack-vms}'
 
 #################
 # Shell Scripts #
 #################
 
+# Macro: integration-copy-ssh-keys
+# Operation: Copy ssh public key used as authentication for robot
+# Used by: {project}-csit-* job templates
+
+- builder:
+    name: integration-copy-ssh-keys
+    builders:
+        - shell: |
+            #!/bin/bash
+            function copy-ssh-keys-to-slave() {
+                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 "Successfully copied public keys to slave ${i}"
+                        break
+                    elif [ $j -eq $RETRIES ]; then
+                        echo "SSH not responding on ${i} after $RETIRES tries. Giving up."
+                        exit 1
+                    else
+                        echo "SSH not responding on ${i}. Retrying in 10 seconds..."
+                        sleep 10
+                    fi
+                done
+            }
+
+            echo "OpenStack IPS are ${JCLOUDS_IPS}"
+
+            IFS=',' read -ra ADDR <<< "${JCLOUDS_IPS}"
+            pids=""
+            for i in "${ADDR[@]}"; do
+                ( copy-ssh-keys-to-slave ) &
+                # Store PID of process
+                pids+=" $!"
+            done
+
+            # 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
 # Operation: this macro gets the IP addresses of the dynamic vms
 # Used by: {project}-csit-* job templates
             !include-raw:
                 - include-raw-integration-deploy-controller-run-test.sh
 
-# Macro: include-raw-integration-deploy-robot-testing
-# Operation: this macro only resolves suite path from testplan
-# Used by: {project}-openstack-{functionality}-daily-{openstack}-{odl} job templates
-
-- builder:
-    name: include-raw-integration-deploy-devstack-testing
-    builders:
-        - shell:
-            !include-raw:
-                - include-raw-integration-deploy-devstack-testing.sh
-
-# Macro: integration-deploy-controller
-# Operation: this macro prepares 3-node cluster controller
-# Used by: {project}-csit-3node-* job templates
-
-- builder:
-    name: integration-deploy-controller
-    builders:
-        - shell:
-            !include-raw:
-                - include-raw-integration-deploy-controller.sh
-
 # Macro: integration-configure-clustering
 # Operation: this macro configures the clustering
 # Used by: {project}-csit-3node-* job templates
             !include-raw:
                 - include-raw-integration-rebase-gerrit-patch.sh
 
+- builder:
+    name: integration-deploy-openstack-run-test
+    builders:
+        - shell:
+            !include-raw:
+                - include-raw-integration-deploy-openstack-run-test.sh
 ##############
 # Publishers #
 ##############
             unstable-threshold: '{unstable-if}'
             pass-threshold: '{pass-if}'
             only-critical: false
+
+- publisher:
+    name: integration-robot-tempest
+    publishers:
+        - robot:
+            output-path: ''
+            other-files:
+                - tempest_results.html
+            unstable-threshold: '{unstable-if}'
+            pass-threshold: '{pass-if}'
+            only-critical: false
+
+- publisher:
+    name: integration-csit-archive-build
+    publishers:
+        - postbuildscript:
+            builders:
+                - shell: |
+                    #!/bin/bash
+                    mkdir $WORKSPACE/archives
+                    curl --output robot-plugin.zip "$BUILD_URL/robot/report/*zip*/robot-plugin.zip"
+                    unzip -d $WORKSPACE/archives robot-plugin.zip
+                    mv *log* *.log *.csv *.png $WORKSPACE/archives || true  # Don't fail if file missing
+            script-only-if-succeeded: False
+            script-only-if-failed: False
+            mark-unstable-if-failed: True