Branching for csit-vpp-verify-semiweekly job 09/1609/3
authorJan Gelety <jgelety@cisco.com>
Thu, 16 Jun 2016 22:09:01 +0000 (00:09 +0200)
committerJan Gelety <jgelety@cisco.com>
Fri, 17 Jun 2016 20:59:40 +0000 (22:59 +0200)
- introduce per branch semiweekly jobs: master, stable/1606
- check remote verified branches and use the latest one of
  the desired branch

Change-Id: I715ee9e9c4732033bf7fd6a1fd25cdabe2c62e1d
Signed-off-by: Jan Gelety <jgelety@cisco.com>
jjb/csit/csit.yaml
jjb/csit/include-raw-csit-vpp-master-verify-semiweekly.sh [deleted file]
jjb/csit/include-raw-csit-vpp-verify-semiweekly.sh [new file with mode: 0644]

index 7376cf8..385668d 100644 (file)
@@ -6,7 +6,7 @@
         - 'csit-vpp-perf-{stream}-{type}'
         - 'csit-vpp-functional-{stream}-virl'
         - 'csit-vpp-verify-master-weekly'
-        - 'csit-vpp-master-verify-semiweekly'
+        - 'csit-vpp-verify-{stream}-semiweekly'
 
     project: 'csit'
     branch: 'master'
 
 
 - job-template:
-    name: 'csit-vpp-master-verify-semiweekly'
-    description: 'Purpose of this job is to validate latest vpp build stored in nexus against verified CSIT codebase.'
+    name: 'csit-vpp-verify-{stream}-semiweekly'
+    description: 'Purpose of this job is to validate latest vpp build from corresponding branch stored in nexus against verified CSIT codebase of corresponding branch.'
 
     project-type: freestyle
     node: verify
         - gerrit-parameter:
             branch: '{branch}'
 
-    scm:
-        - git-scm:
-            credentials-id: '{ssh-credentials}'
-            branch: 'master'
-
     wrappers:
         - ssh-agent-credentials:
             users:
             branch: '{branch}'
 
     builders:
+        - shell: 'echo "BRANCH_ID={branch-id}" > $WORKSPACE/variables.prop'
+        - inject:
+            properties-file: variables.prop
         - shell:
-            !include-raw-escape jjb/csit/include-raw-csit-vpp-master-verify-semiweekly.sh
+            !include-raw-escape jjb/csit/include-raw-csit-vpp-verify-semiweekly.sh
 
     publishers:
         - archive-artifacts:
 
 - parameter:
     name: test-type-parameter
-
     parameters:
         - string:
             name: TYPE
diff --git a/jjb/csit/include-raw-csit-vpp-master-verify-semiweekly.sh b/jjb/csit/include-raw-csit-vpp-master-verify-semiweekly.sh
deleted file mode 100644 (file)
index 0b32264..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/bash
-set -xeu -o pipefail
-
-# Clone csit and start tests
-git clone https://gerrit.fd.io/r/csit --branch csit-verified
-
-cd csit
-
-# execute csit bootstrap script if it exists
-if [ -e bootstrap-vpp-master-verify-semiweekly.sh ]
-then
-    # make sure that bootstrap.sh is executable
-    chmod +x bootstrap-vpp-master-verify-semiweekly.sh
-    # run the script
-    ./bootstrap-vpp-master-verify-semiweekly.sh
-else
-    echo 'ERROR: No bootstrap-verify-master.sh found'
-    exit 1
-fi
-
-# vim: ts=4 ts=4 sts=4 et :
diff --git a/jjb/csit/include-raw-csit-vpp-verify-semiweekly.sh b/jjb/csit/include-raw-csit-vpp-verify-semiweekly.sh
new file mode 100644 (file)
index 0000000..13df074
--- /dev/null
@@ -0,0 +1,47 @@
+#!/bin/bash
+set -xeu -o pipefail
+
+# check BRANCH_ID value
+if [ "$BRANCH_ID" == "" ]; then
+    echo "branch_id not provided => 'master' will be used"
+    BRANCH_ID="master"
+fi
+
+# clone csit
+git clone --depth 1 --no-single-branch https://gerrit.fd.io/r/csit
+
+# if the git clone fails, complain clearly and exit
+if [ $? != 0 ]; then
+    echo "Failed to run: git clone --depth 1 --no-single-branch https://gerrit.fd.io/r/csit"
+    exit 1
+fi
+
+cd csit
+
+# get the latest verified version of the required branch
+BRANCH_NAME=$(echo $(git branch -r | grep csit-verified-${BRANCH_ID} | tail -n 1))
+
+if [ "${BRANCH_NAME}" == "" ]; then
+    echo "No verified version found for requested branch - exiting"
+    exit 1
+fi
+
+# remove 'origin/' from the branch name
+BRANCH_NAME=$(echo ${BRANCH_NAME#origin/})
+
+# checkout to the required branch
+git checkout ${BRANCH_NAME}
+
+# execute csit bootstrap script if it exists
+if [ -e bootstrap-vpp-verify-semiweekly.sh ]
+then
+    # make sure that bootstrap.sh is executable
+    chmod +x bootstrap-vpp-verify-semiweekly.sh
+    # run the script
+    ./bootstrap-vpp-verify-semiweekly.sh
+else
+    echo 'ERROR: No bootstrap-vpp-verify-semiweekly.sh found'
+    exit 1
+fi
+
+# vim: ts=4 ts=4 sts=4 et :