Skip to content

Commit

Permalink
virtctl.sh: add deprecation warning and parent dir fallback (#1278)
Browse files Browse the repository at this point in the history
* virtctl.sh: add deprecation warning

We want to remove virtctl.sh in the long run [1], for now we are issuing
a deprecation warning.

[1]: #1277

Signed-off-by: Daniel Hiller <[email protected]>

* virtctl.sh: add fallback to parent directory

Since there might be usages outside kubevirt that source kubevirtci
cluster-up folder from kubevirt main repo, we add a fallback that uses
the parent directory.

Signed-off-by: Daniel Hiller <[email protected]>

---------

Signed-off-by: Daniel Hiller <[email protected]>
  • Loading branch information
dhiller authored Sep 24, 2024
1 parent d93dec1 commit 1a63576
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion cluster-up/virtctl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@

set -e

>&2 echo "WARNING: usage of '${BASH_SOURCE[0]}' is deprecated!"
>&2 echo " see: https://github.com/kubevirt/kubevirtci/issues/1277"

if [ -z "$KUBEVIRTCI_PATH" ]; then
KUBEVIRTCI_PATH="$(
cd "$(dirname "$BASH_SOURCE[0]")/"
Expand All @@ -38,5 +41,12 @@ elif [ -n "$KUBECONFIG" ]; then
CONFIG_ARGS="--kubeconfig=${KUBECONFIG}"
fi

${KUBEVIRTCI_PATH}/../_out/cmd/virtctl/virtctl $CONFIG_ARGS "$@"
KUBEVIRT_OUT_PATH=${KUBEVIRTCI_PATH}/../_out
if [ ! -d ${KUBEVIRT_OUT_PATH} ]; then
# see https://github.com/kubevirt/kubevirt/pull/12872
>&2 echo "WARNING: $KUBEVIRT_OUT_PATH not found, falling back to parent"
KUBEVIRT_OUT_PATH=${KUBEVIRTCI_PATH}/../../_out
>&2 echo " $KUBEVIRT_OUT_PATH"
fi
${KUBEVIRT_OUT_PATH}/cmd/virtctl/virtctl $CONFIG_ARGS "$@"

0 comments on commit 1a63576

Please sign in to comment.