From 4af76f3aff2833922846f7cbf6fc3490dd72ea93 Mon Sep 17 00:00:00 2001 From: Todd Malsbary Date: Tue, 6 Oct 2020 14:16:21 -0700 Subject: [PATCH] Clone baremetal-operator.git in baremetal deploy Without this, the bmh_install step will fail if the repo is not already present. Issue-ID: ICN-475 Signed-off-by: Todd Malsbary Change-Id: If6b2454f844cbc6d92355571b6b6642d2cc73c2c --- deploy/metal3/scripts/01_metal3.sh | 17 +++++++++++++++++ env/lib/common.sh | 11 +++++++++++ 2 files changed, 28 insertions(+) diff --git a/deploy/metal3/scripts/01_metal3.sh b/deploy/metal3/scripts/01_metal3.sh index e8bad40..f1b827b 100755 --- a/deploy/metal3/scripts/01_metal3.sh +++ b/deploy/metal3/scripts/01_metal3.sh @@ -15,6 +15,22 @@ fi IMAGE_URL=http://172.22.0.1/images/${BM_IMAGE} IMAGE_CHECKSUM=http://172.22.0.1/images/${BM_IMAGE}.md5sum +function clone_repos { + mkdir -p "${M3PATH}" + if [[ -d ${BMOPATH} && "${FORCE_REPO_UPDATE}" == "true" ]]; then + rm -rf "${BMOPATH}" + fi + if [ ! -d "${BMOPATH}" ] ; then + pushd "${M3PATH}" + git clone "${BMOREPO}" + popd + fi + pushd "${BMOPATH}" + git checkout "${BMOBRANCH}" + git pull -r || true + popd +} + function get_default_interface_ipaddress { local _ip=$1 local _default_interface=$(awk '$2 == 00000000 { print $1 }' /proc/net/route) @@ -254,6 +270,7 @@ function deprovision_all_hosts { } if [ "$1" == "launch" ]; then + clone_repos launch_baremetal_operator exit 0 fi diff --git a/env/lib/common.sh b/env/lib/common.sh index 8ce0006..9c08025 100755 --- a/env/lib/common.sh +++ b/env/lib/common.sh @@ -43,6 +43,17 @@ IRONIC_IPMI_INTERFACE_IP=${IRONIC_IPMI_INTERFACE_IP:-} BM_IMAGE_URL=${BM_IMAGE_URL:-"https://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64.img"} BM_IMAGE=${BM_IMAGE:-"bionic-server-cloudimg-amd64.img"} +#Path to clone the metal3 dev env repo +M3PATH="$(go env GOPATH)/src/github.com/metal3-io" +#Path to clone the baremetal operator repo +BMOPATH="${M3PATH}/baremetal-operator" +#Baremetal operator repository URL +BMOREPO="${BMOREPO:-https://github.com/metal3-io/baremetal-operator.git}" +#Baremetal operator repository branch to checkout +BMOBRANCH="${BMOBRANCH:-10eb5aa3e614d0fdc6315026ebab061cbae6b929}" +#Discard existing baremetal operator repo directory +FORCE_REPO_UPDATE="${FORCE_REPO_UPDATE:-true}" + #refered from onap function call_api { #Runs curl with passed flags and provides -- 2.16.6