From: Vratko Polak Date: Thu, 8 Aug 2019 10:42:56 +0000 (+0000) Subject: Merge "CSIT: Use entry scripts by default in perf" X-Git-Url: https://gerrit.fd.io/r/gitweb?a=commitdiff_plain;h=9b5a8ecafb5e7cc1684977ae49b987d5b407b382;hp=c59c5c69469bfb71770b839485fba69033d0f858;p=ci-management.git Merge "CSIT: Use entry scripts by default in perf" --- diff --git a/jjb/csit/include-raw-csit-perf-timed.sh b/jjb/csit/include-raw-csit-perf-timed.sh index 55605d732..99605c7e0 100644 --- a/jjb/csit/include-raw-csit-perf-timed.sh +++ b/jjb/csit/include-raw-csit-perf-timed.sh @@ -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" diff --git a/jjb/csit/include-raw-csit-perf-verify.sh b/jjb/csit/include-raw-csit-perf-verify.sh index b5026f4cd..718b580c5 100644 --- a/jjb/csit/include-raw-csit-perf-verify.sh +++ b/jjb/csit/include-raw-csit-perf-verify.sh @@ -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"