Merge "Remove jjb custom scripting"
[releng/builder.git] / jjb / integration / integration-macros.yaml
index c180baec8404b57993a1ffa2835ac3d6886bee8a..37b962ca270f46e96156b9181a9178cdaeaa28cc 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: ''
     triggers:
         - timed: 'H H * * *'
 
-# Macro: integration-jclouds-controller-mininet
+# Macro: integration-openstack-controller-mininet
 # Operation: this macro will spin the controller and mininet vms
 # Used by: {project}-csit-* job templates
 
 - wrapper:
-    name: integration-jclouds-controller-mininet
+    name: integration-openstack-controller-mininet
     wrappers:
-      - jclouds:
+      - openstack:
           instances:
-            - rk-c7-java:
-                cloud-name: 'Rackspace DFW - Integration Dynamic Lab'
-                count: '{controller-vms}'
-                stop-on-terminate: False
-            - '{mininet-image}':
-                cloud-name: '{mininet-cloud-name}'
-                count: '{mininet-vms}'
-                stop-on-terminate: False
+            - cloud-name: 'ODLRPC'
+              template-name: '{controller-image}'
+              count: '{controller-vms}'
+            - cloud-name: 'ODLRPC'
+              template-name: '{mininet-image}'
+              count: '{mininet-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=30
+                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}"
+
+            for i in "${ADDR[@]}"; do
+                copy-ssh-keys-to-slave &
+            done
+
+            wait
+            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-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