From de23941771abfcb5aec795292e9c8cd3b446e43b Mon Sep 17 00:00:00 2001 From: David Zager Date: Fri, 5 Jul 2024 15:35:46 -0400 Subject: [PATCH] :seedling: make hack scripts runnable via curl Signed-off-by: David Zager --- .github/actions/install-konveyor/action.yml | 20 ++++++++++++-- hack/install-konveyor.sh | 29 ++++----------------- hack/start-minikube.sh | 19 -------------- 3 files changed, 23 insertions(+), 45 deletions(-) diff --git a/.github/actions/install-konveyor/action.yml b/.github/actions/install-konveyor/action.yml index 18290c43..da37a74e 100644 --- a/.github/actions/install-konveyor/action.yml +++ b/.github/actions/install-konveyor/action.yml @@ -17,8 +17,24 @@ inputs: runs: using: "composite" steps: - # TODO(djzager): Need to figure out overriding operator image - # or maybe just installing manager via kustomize. + - name: Install kubectl + shell: bash + run: | + if command -v kubectl >/dev/null 2>&1; then + echo "kubectl is already installed...yay" + exit 0 + fi + curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" + sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl + - name: Install operator-sdk + shell: bash + run: | + if command -v operator-sdk >/dev/null 2>&1; then + echo "operator-sdk is already installed...yay" + exit 0 + fi + curl -LO https://github.com/operator-framework/operator-sdk/releases/download/v1.35.0/operator-sdk_linux_amd64 + sudo install -o root -g root -m 0755 operator-sdk_linux_amd64 /usr/local/bin/operator-sdk - name: Install Konveyor env: OPERATOR_BUNDLE_IMAGE: ${{ inputs.bundle_image }} diff --git a/hack/install-konveyor.sh b/hack/install-konveyor.sh index b9954225..dc9e3182 100755 --- a/hack/install-konveyor.sh +++ b/hack/install-konveyor.sh @@ -4,39 +4,19 @@ set -e set -x set -o pipefail -# Figure out where we are being run from. -# This relies on script being run from: -# - ${PROJECT_ROOT}/hack/install-tackle.sh -# - ${PROJECT_ROOT}/bin/install-tackle.sh -__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -__root="$(cd "$(dirname "${__dir}")" && pwd)" -__repo="$(basename "${__root}")" -__bin_dir="${__root}/bin" -__os="$(uname -s | tr '[:upper:]' '[:lower:]')" -__arch="$(uname -m | sed 's/x86_64/amd64/' | sed 's/aarch64/arm64/')" - -# Update PATH for execution of this script -PATH="${__bin_dir}:${PATH}" - NAMESPACE="${NAMESPACE:-konveyor-tackle}" OPERATOR_BUNDLE_IMAGE="${OPERATOR_BUNDLE_IMAGE:-quay.io/konveyor/tackle2-operator-bundle:latest}" TACKLE_CR="${TACKLE_CR:-}" TIMEOUT="${TIMEOUT:-10m}" if ! command -v kubectl >/dev/null 2>&1; then - kubectl_bin="${__bin_dir}/kubectl" - mkdir -p "${__bin_dir}" - curl -Lo "${kubectl_bin}" "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/${__os}/${__arch}/kubectl" - chmod +x "${kubectl_bin}" + echo "Please install kubectl. See https://kubernetes.io/docs/tasks/tools/" + exit 1 fi if ! command -v operator-sdk >/dev/null 2>&1; then - operator_sdk_bin="${__bin_dir}/operator-sdk" - mkdir -p "${__bin_dir}" - - version=$(curl --silent "https://api.github.com/repos/operator-framework/operator-sdk/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') - curl -Lo "${operator_sdk_bin}" "https://github.com/operator-framework/operator-sdk/releases/download/${version}/operator-sdk_${__os}_${__arch}" - chmod +x "${operator_sdk_bin}" + echo "Please install operator-sdk. See https://sdk.operatorframework.io/docs/installation/" + exit 1 fi debug() { @@ -108,5 +88,6 @@ EOF deployments.apps } +kubectl get customresourcedefinitions.apiextensions.k8s.io clusterserviceversions.operators.coreos.com || operator-sdk olm install kubectl get customresourcedefinitions.apiextensions.k8s.io tackles.tackle.konveyor.io || run_bundle install_tackle diff --git a/hack/start-minikube.sh b/hack/start-minikube.sh index d29c8cd6..f172cf4b 100755 --- a/hack/start-minikube.sh +++ b/hack/start-minikube.sh @@ -2,20 +2,6 @@ set -e set -x -# Figure out where we are being run from. -# This relies on script being run from: -# - ${PROJECT_ROOT}/hack/install-tackle.sh -# - ${PROJECT_ROOT}/bin/install-tackle.sh -__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -__root="$(cd "$(dirname "${__dir}")" && pwd)" -__repo="$(basename "${__root}")" -__bin_dir="${__root}/bin" -__os="$(uname -s | tr '[:upper:]' '[:lower:]')" -__arch="$(uname -m | sed 's/x86_64/amd64/' | sed 's/aarch64/arm64/')" - -# Update PATH for execution of this script -export PATH="${__bin_dir}:${PATH}" - # Inputs via environment variables MINIKUBE_DRIVER="${MINIKUBE_DRIVER:-}" MINIKUBE_CONTAINER_RUNTIME="${MINIKUBE_CONTAINER_RUNTIME:-}" @@ -23,7 +9,6 @@ MINIKUBE_KUBERNETES_VERSION="${MINIKUBE_KUBERNETES_VERSION:-}" MINIKUBE_CPUS="${MINIKUBE_CPUS:-}" MINIKUBE_MEMORY="${MINIKUBE_MEMORY:-}" MINIKUBE_CNI="${MINIKUBE_CNI:-}" -OLM="${OLM:-true}" # Check pre-reqs # May want to leave this for the user to install @@ -53,7 +38,3 @@ fi # Enable ingress minikube addons enable ingress - -if [ "${OLM}" = "true" ]; then - curl -sL https://github.com/operator-framework/operator-lifecycle-manager/releases/download/v0.26.0/install.sh | bash -s v0.26.0 -fi