Merge "CSIT: Use entry scripts by default in perf"
authorVratko Polak <vrpolak@cisco.com>
Thu, 8 Aug 2019 10:42:56 +0000 (10:42 +0000)
committerGerrit Code Review <gerrit@fd.io>
Thu, 8 Aug 2019 10:42:56 +0000 (10:42 +0000)
jjb/csit/include-raw-csit-perf-timed.sh
jjb/csit/include-raw-csit-perf-verify.sh

index 55605d7..99605c7 100644 (file)
@@ -1,52 +1,38 @@
-#!/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
-
-# make sure there is no csit directory
-if [ -d "./csit/" ]; then
-    rm -rf ./csit/
-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 -E "${BRANCH_ID}-[0-9]+" | 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-verify-perf.sh ]
-then
-    # make sure that bootstrap.sh is executable
-    chmod +x bootstrap-verify-perf.sh
-    # run the script
-    ./bootstrap-verify-perf.sh
+#!/usr/bin/env bash
+
+# Copyright (c) 2019 Cisco and/or its affiliates.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at:
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+set -exuo pipefail
+
+# Clone CSIT git repository and proceed with entry script located there.
+#
+# Variables read:
+# - WORKSPACE - Jenkins workspace to create csit subdirectory in.
+# - CSIT_REF - Override ref of CSIT git repository to checkout.
+# Directories updated:
+# - ${WORKSPACE}/csit - Created, holding a checked out CSIT repository.
+# - Multiple other side effects by entry script(s), see CSIT repository.
+
+cd "${WORKSPACE}"
+git clone https://gerrit.fd.io/r/csit --depth=1 --no-single-branch --no-checkout
+pushd "${WORKSPACE}/csit"
+if [[ -n "${CSIT_REF-}" ]]; then
+    git fetch --depth=1 https://gerrit.fd.io/r/csit "${CSIT_REF}"
+    git checkout FETCH_HEAD
 else
-    echo 'ERROR: No bootstrap-verify-perf.sh found'
-    exit 1
+    git checkout HEAD
 fi
-
-# vim: ts=4 ts=4 sts=4 et :
+popd
+csit_entry_dir="${WORKSPACE}/csit/resources/libraries/bash/entry"
+source "${csit_entry_dir}/with_oper_for_vpp.sh" "bootstrap_verify_perf.sh"
index b5026f4..718b580 100644 (file)
@@ -1,6 +1,19 @@
-#!/bin/bash
+#!/usr/bin/env bash
 
-set -xeu -o pipefail
+# Copyright (c) 2019 Cisco and/or its affiliates.
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at:
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+set -exuo pipefail
 
 if [[ ${GERRIT_EVENT_TYPE} == 'comment-added' ]]; then
     TRIGGER=`echo ${GERRIT_EVENT_COMMENT_TEXT} \
@@ -8,23 +21,8 @@ if [[ ${GERRIT_EVENT_TYPE} == 'comment-added' ]]; then
 else
     TRIGGER=''
 fi
-
-# grep to see where minion is running
-grep search /etc/resolv.conf  || true
-
 # Export test tags as string.
 export TEST_TAG_STRING=${TRIGGER#$"perftest"}
 
-# execute csit bootstrap script if it exists
-if [ ! -e bootstrap-verify-perf.sh ]
-then
-    echo 'ERROR: No bootstrap-verify-perf.sh found'
-    exit 1
-fi
-
-# make sure that bootstrap-verify-perf.sh is executable
-chmod +x bootstrap-verify-perf.sh
-# run the script
-./bootstrap-verify-perf.sh
-
-# vim: ts=4 ts=4 sts=4 et :
+csit_entry_dir="${WORKSPACE}/resources/libraries/bash/entry"
+source "${csit_entry_dir}/bootstrap_verify_perf.sh"