]> Frank Brehm's Git Trees - profitbricks/jenkins-build-scripts.git/commitdiff
liveboot: TestLink build + tests integration
authorThilo Fromm <thilo.fromm@profitbricks.com>
Tue, 2 Apr 2013 12:21:37 +0000 (14:21 +0200)
committerThilo Fromm <thilo.fromm@profitbricks.com>
Tue, 2 Apr 2013 12:21:37 +0000 (14:21 +0200)
Signed-off-by: Thilo Fromm <thilo.fromm@profitbricks.com>
liveboot_gw_autotest.sh
liveboot_testlink_create_build.sh [new file with mode: 0755]

index a4cbdca8130f7d4acd825a78893cefd419bbedc0..eec743ee32493696617e50652f64b44efbda0ccd 100755 (executable)
@@ -60,11 +60,24 @@ ssh -t $CORE_ROUTER "sudo rm /opt/autotest -rf ; sudo mkdir -p /opt/autotest ; s
 ssh -t $CORE_ROUTER "cd /opt ; git clone git://git/ri/autotest.git"
 ssh -t $CORE_ROUTER "cd /opt/autotest ; git checkout master"
 
+#
+# Generate TestLink Build
+#
+./liveboot_testlink_create_build.sh             \
+        "liveboot-${LIVEBOOT_BUILD_NUMBER}"     \
+        "Auto-generated by Jenkins on $(date --rfc-3339=seconds)"
+
 #
 # run autotests
 #
 #ssh -t -A $CORE_ROUTER "cd /opt/autotest ; ./run-compile.sh --config config-jenkins.xml"
-ssh -t -A $CORE_ROUTER "cd /opt/autotest ; ./run-compile.sh"
+
+# call autotest suite w/ testlink connector info
+ssh -t -A $CORE_ROUTER "cd /opt/autotest ;  \
+            ./run-compile.sh                \
+                --testlink='Profitbricks','R&I Liveboot Approval Autotest','liveboot-${LIVEBOOT_BUILD_NUMBER}'"
+
+# no testlink support in vcb tests yet
 ssh -t -A $CORE_ROUTER "cd /opt/autotest ; ./run-compile.sh --vcb=true --tracepjds"
 
 #
diff --git a/liveboot_testlink_create_build.sh b/liveboot_testlink_create_build.sh
new file mode 100755 (executable)
index 0000000..eaff6b2
--- /dev/null
@@ -0,0 +1,92 @@
+#!/bin/bash
+
+#
+# Create a TestLink build by means of xmlrpc.
+# 
+#  This helper script creates a new TestLink build in the "Profitbricks"
+#  project, test plan "R&I Liveboot Approval Autotest".
+#
+#  Example Usage: 
+#
+#    liveboot_testlink_create_build.sh                  \
+#                                       "liveboot-923"  \
+#                                       "auto-generated build at $(date)."
+#
+
+testlink_url='http://testlink/lib/api/xmlrpc.php'
+     dev_key='6805a288081cf7480d391533b354cb7c'
+
+test_project="Profitbricks"
+   test_plan="R&amp;I Liveboot Approval Autotest"
+
+
+# ---------------------
+
+
+xmlrpc() {
+    local method="tl.$1" ; shift
+    local params="
+     <member> <name>devKey</name> <value>$dev_key</value> </member>$@
+                 "
+
+    curl -s                                 \
+         --header 'content-type: text/xml'  \
+         --header 'Cache-Control: no-cache' \
+         --header 'Pragma: no-cache'        \
+         --data-binary                      \
+"
+<?xml version=\"1.0\" encoding=\"UTF-8\"?>
+<methodCall>
+    <methodName>$method</methodName>
+    <params> 
+        <param> 
+            <value> 
+                <struct> $params </struct> 
+            </value> 
+        </param> 
+    </params>
+</methodCall>" \
+        $testlink_url
+
+    echo ""
+}
+# ----
+
+get_testplan_by_name() {
+    local project="$1" ; shift
+    local plan="$@"
+    xmlrpc "getTestPlanByName" "
+        <member> <name>testprojectname</name> <value>$project</value> </member>
+        <member> <name>testplanname</name> <value>$plan</value> </member>"  \
+        | grep '<member><name>id</name>'                                    \
+        | sed 's:.*<value><string>\([0-9]*\)</string></value>.*:\1:'
+}
+# ----
+
+createBuild() {
+    local name="$1" ; shift
+    local notes="$@"
+
+    local id=`get_testplan_by_name "$test_project"  "$test_plan"`
+
+    xmlrpc "createBuild" "
+        <member> <name>testplanid</name> <value>$id</value> </member>  \
+        <member> <name>buildname</name> <value>$name</value> </member>  \
+        <member> <name>buildnotes</name> <value>$notes</value> </member>"
+}
+# ----
+
+
+if [ "testlink_create_build.sh" = `basename $0` ]; then
+
+    [ $# -lt 2 ] && {
+        echo
+        echo "USAGE: $0 '<TestLink build name>' '<comment>'"
+        echo
+        exit
+    }
+
+    name="$1" ; shift
+    createBuild "$name" $@
+    exit
+fi