Skip to content

Commit

Permalink
cluster: Bump kubevirtci tag, refactor install function
Browse files Browse the repository at this point in the history
Bump to latest kubevirtci tag
Refactor cluster::install(), replacing single bracket "-o" syntax.

Signed-off-by: Ram Lavi <[email protected]>
  • Loading branch information
RamLavi committed Jan 6, 2025
1 parent 9148625 commit a138782
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions cluster/cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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() {
Expand Down

0 comments on commit a138782

Please sign in to comment.