Add comments for some tag exclusions
[csit.git] / resources / libraries / bash / entry / with_oper_for_vpp.sh
1 #!/usr/bin/env bash
2
3 # Copyright (c) 2018 Cisco and/or its affiliates.
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at:
7 #
8 #     http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16 set -exuo pipefail
17
18 # Typical usage:
19 # $ source "./with_oper_for_vpp.sh" "per_patch_perf.sh"
20 #
21 # This wrapper is mostly useful for Jenkins invocation,
22 # because in manual testing people usually already have checked out
23 # the branches they want to test (which might not yet be available in Gerrit).
24 #
25 # Assumptions:
26 # + There is a directory holding initial CSIT code to use, this script is there.
27 # + First argument is filename of next entry script to execute.
28 #   TODO: Support relative paths? Relative to BASH_ENTRY_DIR?
29 # Consequences:
30 # + A csit branch name is computed.
31 # + Possibly overriden, based on CSIT_REF value.
32 # + The computed or overriden CSIT refspec is checked out.
33 # + The argument entry script is sourced, with arguments shifted.
34
35 # "set -eu" handles failures from the following two lines.
36 BASH_ENTRY_DIR="$(dirname $(readlink -e "${BASH_SOURCE[0]}"))"
37 BASH_FUNCTION_DIR="$(readlink -e "${BASH_ENTRY_DIR}/../function")"
38 source "${BASH_FUNCTION_DIR}/common.sh" || {
39     echo "Source failed." >&2
40     exit 1
41 }
42 common_dirs || die
43 source "${BASH_FUNCTION_DIR}/branch.sh" || die "Source failed."
44 checkout_csit_for_vpp "${GERRIT_BRANCH}" || die
45 cmd="${1}"
46 shift
47 source "${BASH_ENTRY_DIR}/${cmd}" "$@"