dca51be2b7aefc8744932234cf2bd079b6b9c91d
[ci-management.git] / jjb / scripts / vpp / csit-device.sh
1 #!/usr/bin/env bash
2
3 # Copyright (c) 2020 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 echo "---> jjb/scripts/vpp/csit-device.sh"
17
18 set -exuo pipefail
19
20 line="*************************************************************************"
21 if [[ "${SILO}" = "production" ]] && [[ ${JOB_NAME} == *tx2 ]] ; then
22     echo -e "\n$line\nSkipping ${JOB_NAME} on Jenkins ${SILO}..."
23     exit 0
24 fi
25
26 # Clone CSIT git repository and proceed with entry script located there.
27 #
28 # Variables read:
29 # - WORKSPACE - Jenkins workspace to create csit subdirectory in.
30 # - GIT_URL - Git clone URL
31 # - CSIT_REF - Override ref of CSIT git repository to checkout.
32 # Directories updated:
33 # - ${WORKSPACE}/csit - Created, holding a checked out CSIT repository.
34 # - Multiple other side effects by entry script(s), see CSIT repository.
35
36 cd "${WORKSPACE}"
37 git clone "${GIT_URL}/csit" --depth=1 --no-single-branch --no-checkout
38 pushd "${WORKSPACE}/csit"
39 if [[ -n "${CSIT_REF-}" ]]; then
40     git fetch --depth=1 "${GIT_URL}/csit" "${CSIT_REF}"
41     git checkout FETCH_HEAD
42 else
43     git checkout HEAD
44 fi
45 popd
46 csit_entry_dir="${WORKSPACE}/csit/resources/libraries/bash/entry"
47 source "${csit_entry_dir}/with_oper_for_vpp.sh" "per_patch_device.sh"