Merge "doc(hicn): do not build doxygen"
[ci-management.git] / jjb / scripts / csit / device-semiweekly.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/csit/device-semiweekly.sh"
17
18 set -exuo pipefail
19
20 # Clone CSIT git repository and proceed with entry script located there.
21 #
22 # Variables read:
23 # - WORKSPACE - Jenkins workspace to create csit subdirectory in.
24 # - GIT_URL - Git clone URL
25 # - BRANCH_ID - CSIT operational branch to be used for test.
26 # Directories updated:
27 # - ${WORKSPACE}/csit - Created, holding a checked out CSIT repository.
28 # - Multiple other side effects by entry script(s), see CSIT repository.
29
30 cd "${WORKSPACE}"
31 git clone "${GIT_URL}/csit" --depth=1 --no-single-branch --no-checkout
32 # Check BRANCH_ID value.
33 if [[ -z "${BRANCH_ID-}" ]]; then
34     echo "BRANCH_ID not provided => 'oper' belonging to master will be used."
35     BRANCH_ID="oper"
36 fi
37 pushd "${WORKSPACE}/csit"
38 # Get the latest verified version of the required branch.
39 BRANCH_NAME=$(echo $(git branch -r | grep -E "${BRANCH_ID}-[0-9]+" | tail -n 1))
40 if [[ -z "${BRANCH_NAME-}" ]]; then
41     echo "No verified CSIT branch found - exiting!"
42     exit 1
43 fi
44 # Remove 'origin/' from the branch name.
45 BRANCH_NAME=$(echo ${BRANCH_NAME#origin/})
46 # Checkout the required csit branch.
47 git checkout "${BRANCH_NAME}"
48 popd
49 csit_entry_dir="${WORKSPACE}/csit/resources/libraries/bash/entry"
50 source "${csit_entry_dir}/bootstrap_vpp_device.sh"
51 cp -R "${WORKSPACE}/csit/archives" "${WORKSPACE}/archives" || true