SEBA: add UPSTREAM_PROJECT parameter to install.sh
[iec.git] / src / use_cases / seba_on_arm / test / ponsim / install.sh
1 #!/bin/bash
2 # shellcheck disable=SC2016
3
4 set -ex
5
6 basepath="$(cd "$(dirname "$(readlink -f "$0")")"; pwd)"
7
8 IEC_PATH="$(readlink -f "$(git -C "${basepath}" rev-parse --show-toplevel)")"
9 HELM_CHARTS_PATH="src/use_cases/seba_on_arm/src_repo/helm-charts"
10 HELM_CHARTS_REV_IEC="cord-7.0-arm64"
11 HELM_CHARTS_REV_REC="cord-7.0-arm64-rec"
12 UPSTREAM_PROJECT="${UPSTREAM_PROJECT:-iec}"
13
14 if [ "$#" -gt 0 ]; then UPSTREAM_PROJECT="$1"; fi
15
16 case "${UPSTREAM_PROJECT}" in
17   "iec")
18     HELM_CHARTS_REV="${HELM_CHARTS_REV_IEC}"
19     ;;
20   "rec")
21     HELM_CHARTS_REV="${HELM_CHARTS_REV_REC}"
22     ;;
23   *)
24     echo "Invalid upstream project ${UPSTREAM_PROJECT}"
25     echo "  Specify either iec or rec"
26     exit 1
27     ;;
28 esac
29
30 export M="/tmp/milestones"
31 export SEBAVALUE=
32 export WORKSPACE="${HOME}"
33 export HELM_CHARTS_REV
34
35 # Using opencord automation-tools from the cord-6.1 maintenance branch
36 AUTO_TOOLS="${WORKSPACE}/automation-tools"
37 AUTO_TOOLS_REPO="https://github.com/iecedge/automation-tools.git"
38 AUTO_TOOLS_REV="${AUTO_TOOLS_VER:-cord-7.0-arm64}"
39
40 rm -rf "${M}"
41 mkdir -p "${M}" "${WORKSPACE}/cord/test"
42
43 # Update helm-charts submdule needed later
44 # ignore subproject commit and use latest remote version
45 git -C "${IEC_PATH}" submodule update --init --remote "${HELM_CHARTS_PATH}"
46 git -C "${IEC_PATH}/${HELM_CHARTS_PATH}" checkout "${HELM_CHARTS_REV}"
47
48 test -d "${AUTO_TOOLS}" || git clone "${AUTO_TOOLS_REPO}" "${AUTO_TOOLS}"
49 git -C "${AUTO_TOOLS}" checkout "${AUTO_TOOLS_REV}"
50
51 # Faking helm-charts repo clone to our own git submodule if not already there
52 CHARTS="${WORKSPACE}/cord/helm-charts"
53 test -d "${CHARTS}" || test -L "${CHARTS}" || \
54     ln -s "${IEC_PATH}/${HELM_CHARTS_PATH}" "${CHARTS}"
55
56 cd "${AUTO_TOOLS}/seba-in-a-box"
57 # shellcheck source=/dev/null
58 . env.sh
59
60 # Now calling make, to install SiaB and PONSim
61 make stable