Skip to content
This repository has been archived by the owner on May 6, 2022. It is now read-only.

Commit

Permalink
Update the run-migration-tests.sh script
Browse files Browse the repository at this point in the history
  • Loading branch information
mszostok committed Sep 27, 2019
1 parent 33a1ce7 commit 30d7340
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 10 deletions.
3 changes: 2 additions & 1 deletion contrib/hack/ci/lib/deps_ver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@

# Upgrade binary versions in a controlled fashion
# along with the script contents (config, flags...)
readonly STABLE_KIND_VERSION=v0.4.0
readonly STABLE_KUBERNETES_VERSION=v1.15.3
readonly STABLE_KIND_VERSION=v0.5.1
readonly STABLE_HELM_VERSION=v2.14.3
68 changes: 62 additions & 6 deletions contrib/hack/ci/lib/utilities.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ shout() {
"
}

# Installs kind and helm dependencies locally.

# Installs kind dependency locally.
# Required envs:
# - KIND_VERSION
# - INSTALL_DIR
Expand All @@ -40,12 +41,68 @@ install::local::kind() {

pushd "${INSTALL_DIR}"

shout "- Install kind ${KIND_VERSION} locally to a tempdir GOPATH..."
env "GOPATH=${INSTALL_DIR}" GO111MODULE="on" go get "sigs.k8s.io/kind@${KIND_VERSION}"
os=$(host::os)
arch=$(host::arch)

shout "- Install kind ${KIND_VERSION} locally to a tempdir..."

curl -sSLo kind "https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-${os}-${arch}"
chmod +x kind
mv kind "${INSTALL_DIR}/bin"

popd
}

host::os() {
local host_os
case "$(uname -s)" in
Darwin)
host_os=darwin
;;
Linux)
host_os=linux
;;
*)
kube::log::error "Unsupported host OS. Must be Linux or Mac OS X."
exit 1
;;
esac
echo "${host_os}"
}

host::arch() {
local host_arch
case "$(uname -m)" in
x86_64*)
host_arch=amd64
;;
i?86_64*)
host_arch=amd64
;;
amd64*)
host_arch=amd64
;;
aarch64*)
host_arch=arm64
;;
arm64*)
host_arch=arm64
;;
arm*)
host_arch=arm
;;
ppc64le*)
host_arch=ppc64le
;;
*)
kube::log::error "Unsupported host arch. Must be x86_64, arm, arm64, or ppc64le."
exit 1
;;
esac
echo "${host_arch}"
}


# Installs kind and helm dependencies locally.
# Required envs:
# - HELM_VERSION
Expand Down Expand Up @@ -82,9 +139,8 @@ install::cluster::tiller() {
install::cluster::service_catalog_v2() {
shout "- Installing Service Catalog in version 0.2.x"
helm repo add svc-cat https://svc-catalog-charts.storage.googleapis.com
# TODO: After https://github.com/kyma-project/kyma/issues/5217, change `helm install svc-cat/catalog` to `helm install svc-cat/catalog-apiserver`
# install always the newest service catalog with apiserver
helm install svc-cat/catalog --name ${SC_CHART_NAME} --namespace ${SC_NAMESPACE} --wait
helm install svc-cat/catalog-v0.2 --name ${SC_CHART_NAME} --namespace ${SC_NAMESPACE} --wait
}

#
Expand All @@ -94,7 +150,7 @@ readonly KIND_CLUSTER_NAME="kind-ci"

kind::create_cluster() {
shout "- Create k8s cluster..."
kind create cluster --name=${KIND_CLUSTER_NAME} --wait=5m
kind create cluster --name=${KIND_CLUSTER_NAME} --image=kindest/node:${KUBERNETES_VERSION} --wait=5m
export KUBECONFIG="$(kind get kubeconfig-path --name=${KIND_CLUSTER_NAME})"
}

Expand Down
1 change: 1 addition & 0 deletions contrib/hack/ci/run-e2e-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ main() {
echo "Skipping kind and helm installation cause SKIP_DEPS_INSTALLATION is set to true."
fi

export KUBERNETES_VERSION=${STABLE_KUBERNETES_VERSION}
kind::create_cluster

install::cluster::tiller
Expand Down
15 changes: 12 additions & 3 deletions contrib/hack/ci/run-migration-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ set -E # needs to be set if we want the ERR trap
readonly CURRENT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
readonly REPO_ROOT_DIR=${CURRENT_DIR}/../../../
readonly TMP_DIR=$(mktemp -d)

source "${CURRENT_DIR}/lib/utilities.sh" || { echo 'Cannot load CI utilities.'; exit 1; }
source "${CURRENT_DIR}/deps_ver.sh" || { echo 'Cannot load dependencies versions.'; exit 1; }
source "${CURRENT_DIR}/lib/deps_ver.sh" || { echo 'Cannot load dependencies versions.'; exit 1; }

SKIP_DEPS_INSTALLATION=${SKIP_DEPS_INSTALLATION:-}

SC_CHART_NAME="catalog"
export SC_NAMESPACE="catalog"
Expand Down Expand Up @@ -91,8 +93,15 @@ examiner::execute_test() {
main() {
shout "Starting migration test"

export INSTALL_DIR=${TMP_DIR} KIND_VERSION=${STABLE_KIND_VERSION} HELM_VERSION=${STABLE_HELM_VERSION}
install::local::kind_and_helm
if [[ "${SKIP_DEPS_INSTALLATION}" == "" ]]; then
export INSTALL_DIR=${TMP_DIR} KIND_VERSION=${STABLE_KIND_VERSION} HELM_VERSION=${STABLE_HELM_VERSION}
install::local::kind
install::local::helm
else
echo "Skipping kind and helm installation cause SKIP_DEPS_INSTALLATION is set to true."
fi

export KUBERNETES_VERSION=${STABLE_KUBERNETES_VERSION}
kind::create_cluster

install::cluster::tiller
Expand Down

0 comments on commit 30d7340

Please sign in to comment.