yardstick: Take builders out of jjb 77/14477/2
authorFatih Degirmenci <fatih.degirmenci@ericsson.com>
Sun, 22 May 2016 21:19:15 +0000 (23:19 +0200)
committerFatih Degirmenci <fatih.degirmenci@ericsson.com>
Tue, 24 May 2016 06:40:15 +0000 (06:40 +0000)
Change-Id: I246bcdd9f1fa300639bd7ec744cefe82e293b222
Signed-off-by: Fatih Degirmenci <fatih.degirmenci@ericsson.com>
jjb/yardstick/yardstick-ci-jobs.yml
jjb/yardstick/yardstick-cleanup.sh [new file with mode: 0755]
jjb/yardstick/yardstick-daily.sh [new file with mode: 0755]
jjb/yardstick/yardstick-vtcdaily.sh [new file with mode: 0755]

index a907d34..1b17db4 100644 (file)
 - builder:
     name: yardstick-daily
     builders:
-        - shell: |
-            #!/bin/bash
-            set -e
-            [[ $CI_DEBUG == true ]] && redirect="/dev/stdout" || redirect="/dev/null"
-
-            # labconfig is used only for joid
-            labconfig=""
-            sshkey=""
-            if [[ ${INSTALLER_TYPE} == 'apex' ]]; then
-                instack_mac=$(sudo virsh domiflist instack | grep default | \
-                              grep -Eo "[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+")
-                INSTALLER_IP=$(/usr/sbin/arp -e | grep ${instack_mac} | awk {'print $1'})
-                sshkey="-v /root/.ssh/id_rsa:/root/.ssh/id_rsa"
-                if [[ -n $(sudo iptables -L FORWARD |grep "REJECT"|grep "reject-with icmp-port-unreachable") ]]; then
-                    #note: this happens only in opnfv-lf-pod1
-                    sudo iptables -D FORWARD -o virbr0 -j REJECT --reject-with icmp-port-unreachable
-                    sudo iptables -D FORWARD -i virbr0 -j REJECT --reject-with icmp-port-unreachable
-                fi
-            elif [[ ${INSTALLER_TYPE} == 'joid' ]]; then
-                # If production lab then creds may be retrieved dynamically
-                # creds are on the jumphost, always in the same folder
-                labconfig="-v $LAB_CONFIG/admin-openrc:/home/opnfv/openrc"
-                # If dev lab, credentials may not be the default ones, just provide a path to put them into docker
-                # replace the default one by the customized one provided by jenkins config
-            fi
-
-            opts="--privileged=true --rm"
-            envs="-e INSTALLER_TYPE=${INSTALLER_TYPE} -e INSTALLER_IP=${INSTALLER_IP} \
-                -e NODE_NAME=${NODE_NAME} -e EXTERNAL_NETWORK=${EXTERNAL_NETWORK} \
-                -e YARDSTICK_BRANCH=${GIT_BRANCH##origin/} -e DEPLOY_SCENARIO=${DEPLOY_SCENARIO}"
-
-            # Pull the latest image
-            docker pull opnfv/yardstick:$DOCKER_TAG >$redirect
-
-            # Run docker
-            cmd="sudo docker run ${opts} ${envs} ${labconfig} ${sshkey} opnfv/yardstick \
-                run_tests.sh ${YARDSTICK_DB_BACKEND} ${YARDSTICK_SUITE_NAME}"
-            echo "Yardstick: Running docker cmd: ${cmd}"
-            ${cmd}
-
-            echo "Yardstick: done!"
+        - shell:
+            !include-raw-escape: ./yardstick-daily.sh
 
 - builder:
     name: yardstick-vtcdaily
     builders:
-        - shell: |
-            #!/bin/bash
-            set -e
-            [[ $CI_DEBUG == true ]] && redirect="/dev/stdout" || redirect="/dev/null"
-
-            cd $WORKSPACE
-            ./ci/apexlake-verify
+        - shell:
+            !include-raw-escape: ./yardstick-vtcdaily.sh
 
 - builder:
     name: yardstick-fetch-os-creds
 - builder:
     name: yardstick-cleanup
     builders:
-        - shell: |
-            #!/bin/bash
-            [[ $CI_DEBUG == true ]] && redirect="/dev/stdout" || redirect="/dev/null"
-
-            echo "Cleaning up docker containers/images..."
-            # Remove previous running containers if exist
-            if [[ ! -z $(docker ps -a | grep opnfv/yardstick) ]]; then
-                echo "Removing existing opnfv/yardstick containers..."
-                docker ps -a | grep opnfv/yardstick | awk '{print $1}' | xargs docker rm -f >$redirect
-
-            fi
-
-            # Remove existing images if exist
-            if [[ ! -z $(docker images | grep opnfv/yardstick) ]]; then
-                echo "Docker images to remove:"
-                docker images | head -1 && docker images | grep opnfv/yardstick
-                image_tags=($(docker images | grep opnfv/yardstick | awk '{print $2}'))
-                for tag in "${image_tags[@]}"; do
-                    echo "Removing docker image opnfv/yardstick:$tag..."
-                    docker rmi opnfv/yardstick:$tag >$redirect
-
-                done
-            fi
+        - shell:
+            !include-raw-escape: ./yardstick-cleanup.sh
 ########################
 # parameter macros
 ########################
diff --git a/jjb/yardstick/yardstick-cleanup.sh b/jjb/yardstick/yardstick-cleanup.sh
new file mode 100755 (executable)
index 0000000..4e6f7d6
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/bash
+[[ $CI_DEBUG == true ]] && redirect="/dev/stdout" || redirect="/dev/null"
+
+echo "Cleaning up docker containers/images..."
+# Remove previous running containers if exist
+if [[ ! -z $(docker ps -a | grep opnfv/yardstick) ]]; then
+    echo "Removing existing opnfv/yardstick containers..."
+    docker ps -a | grep opnfv/yardstick | awk '{print $1}' | xargs docker rm -f >$redirect
+
+fi
+
+# Remove existing images if exist
+if [[ ! -z $(docker images | grep opnfv/yardstick) ]]; then
+    echo "Docker images to remove:"
+    docker images | head -1 && docker images | grep opnfv/yardstick
+    image_tags=($(docker images | grep opnfv/yardstick | awk '{print $2}'))
+    for tag in "${image_tags[@]}"; do
+        echo "Removing docker image opnfv/yardstick:$tag..."
+        docker rmi opnfv/yardstick:$tag >$redirect
+
+    done
+fi
diff --git a/jjb/yardstick/yardstick-daily.sh b/jjb/yardstick/yardstick-daily.sh
new file mode 100755 (executable)
index 0000000..3ad6b7c
--- /dev/null
@@ -0,0 +1,40 @@
+#!/bin/bash
+set -e
+[[ $CI_DEBUG == true ]] && redirect="/dev/stdout" || redirect="/dev/null"
+
+# labconfig is used only for joid
+labconfig=""
+sshkey=""
+if [[ ${INSTALLER_TYPE} == 'apex' ]]; then
+    instack_mac=$(sudo virsh domiflist instack | grep default | \
+                  grep -Eo "[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+")
+    INSTALLER_IP=$(/usr/sbin/arp -e | grep ${instack_mac} | awk {'print $1'})
+    sshkey="-v /root/.ssh/id_rsa:/root/.ssh/id_rsa"
+    if [[ -n $(sudo iptables -L FORWARD |grep "REJECT"|grep "reject-with icmp-port-unreachable") ]]; then
+        #note: this happens only in opnfv-lf-pod1
+        sudo iptables -D FORWARD -o virbr0 -j REJECT --reject-with icmp-port-unreachable
+        sudo iptables -D FORWARD -i virbr0 -j REJECT --reject-with icmp-port-unreachable
+    fi
+elif [[ ${INSTALLER_TYPE} == 'joid' ]]; then
+    # If production lab then creds may be retrieved dynamically
+    # creds are on the jumphost, always in the same folder
+    labconfig="-v $LAB_CONFIG/admin-openrc:/home/opnfv/openrc"
+    # If dev lab, credentials may not be the default ones, just provide a path to put them into docker
+    # replace the default one by the customized one provided by jenkins config
+fi
+
+opts="--privileged=true --rm"
+envs="-e INSTALLER_TYPE=${INSTALLER_TYPE} -e INSTALLER_IP=${INSTALLER_IP} \
+    -e NODE_NAME=${NODE_NAME} -e EXTERNAL_NETWORK=${EXTERNAL_NETWORK} \
+    -e YARDSTICK_BRANCH=${GIT_BRANCH##origin/} -e DEPLOY_SCENARIO=${DEPLOY_SCENARIO}"
+
+# Pull the latest image
+docker pull opnfv/yardstick:$DOCKER_TAG >$redirect
+
+# Run docker
+cmd="sudo docker run ${opts} ${envs} ${labconfig} ${sshkey} opnfv/yardstick \
+    run_tests.sh ${YARDSTICK_DB_BACKEND} ${YARDSTICK_SUITE_NAME}"
+echo "Yardstick: Running docker cmd: ${cmd}"
+${cmd}
+
+echo "Yardstick: done!"
diff --git a/jjb/yardstick/yardstick-vtcdaily.sh b/jjb/yardstick/yardstick-vtcdaily.sh
new file mode 100755 (executable)
index 0000000..32408bc
--- /dev/null
@@ -0,0 +1,6 @@
+#!/bin/bash
+set -e
+[[ $CI_DEBUG == true ]] && redirect="/dev/stdout" || redirect="/dev/null"
+
+cd $WORKSPACE
+./ci/apexlake-verify