From a138782eba16eac6f1540efea2ed6261db0f1e41 Mon Sep 17 00:00:00 2001 From: Ram Lavi Date: Mon, 6 Jan 2025 08:42:40 +0200 Subject: [PATCH] cluster: Bump kubevirtci tag, refactor install function Bump to latest kubevirtci tag Refactor cluster::install(), replacing single bracket "-o" syntax. Signed-off-by: Ram Lavi --- cluster/cluster.sh | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/cluster/cluster.sh b/cluster/cluster.sh index 31df81a2e..d517e1a7b 100755 --- a/cluster/cluster.sh +++ b/cluster/cluster.sh @@ -13,7 +13,7 @@ # limitations under the License. export KUBEVIRT_PROVIDER=${KUBEVIRT_PROVIDER:-'k8s-1.30'} -export KUBEVIRTCI_TAG=${KUBEVIRTCI_TAG:-2409241245-d93dec16} +export KUBEVIRTCI_TAG=${KUBEVIRTCI_TAG:-2412171619-fbd31717} KUBEVIRTCI_REPO='https://github.com/kubevirt/kubevirtci.git' # The CLUSTER_PATH var is used in cluster folder and points to the _kubevirtci where the cluster is deployed from. @@ -28,20 +28,22 @@ function cluster::_get_tag() { } function cluster::install() { - # Remove cloned kubevirtci repository if it does not match the requested one - if [ -d ${CLUSTER_PATH} ]; then - if [ $(cluster::_get_repo) != ${KUBEVIRTCI_REPO} -o $(cluster::_get_tag) != ${KUBEVIRTCI_TAG} ]; then - rm -rf ${CLUSTER_PATH} - fi - fi - - if [ ! -d ${CLUSTER_PATH} ]; then - git clone https://github.com/kubevirt/kubevirtci.git ${CLUSTER_PATH} - ( - cd ${CLUSTER_PATH} - git checkout ${KUBEVIRTCI_TAG} - ) - fi + local current_repo + current_repo="$(cluster::_get_repo)" + local current_tag + current_tag="$(cluster::_get_tag)" + + if [[ -d "$CLUSTER_PATH" ]] && { [[ "$current_repo" != "$KUBEVIRTCI_REPO" ]] || [[ "$current_tag" != "$KUBEVIRTCI_TAG" ]]; }; then + rm -rf "$CLUSTER_PATH" + fi + + if [[ ! -d "$CLUSTER_PATH" ]]; then + git clone https://github.com/kubevirt/kubevirtci.git "$CLUSTER_PATH" || return 1 + ( + cd "$CLUSTER_PATH" || exit 1 + git checkout "$KUBEVIRTCI_TAG" || exit 1 + ) + fi } function cluster::path() {