diff --git a/openshift-ci/scripts/install_kustomize.sh b/openshift-ci/scripts/install_kustomize.sh new file mode 100755 index 00000000..8601126f --- /dev/null +++ b/openshift-ci/scripts/install_kustomize.sh @@ -0,0 +1,78 @@ +#!/bin/bash + +set -e +version="v3.2.3" + +# Function to detect the operating system +detect_os() { + case "$(uname -s)" in + Linux*) os="linux";; + Darwin*) os="darwin";; + CYGWIN*|MINGW*|MSYS_NT*) os="windows";; + *) echo "Unsupported OS: $(uname -s)"; exit 1;; + esac + echo "${os}" +} + +# Function to detect the architecture +detect_arch() { + case "$(uname -m)" in + x86_64) arch="amd64";; + armv7l) arch="arm";; + aarch64) arch="arm64";; + *) echo "Unsupported architecture: $(uname -m)"; exit 1;; + esac + echo "${arch}" +} + +# Function to check if Kustomize is installed +check_kustomize_installed() { + # Check if kustomize command exists and can run 'kustomize version' + if version_output=$(kustomize version 2>/dev/null); then + echo "Success: Kustomize is installed. Version: ${version_output}" + else + echo "Fail: Kustomize is not installed." + return 1 + fi +} + +# Function to download and install Kustomize +install_kustomize() { + os=$1 + arch=$2 + + local url="https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2F$version/kustomize_kustomize.v3.2.3_$os_$arch" + + echo "Downloading Kustomize from ${url}..." + curl -LO "${url}" + + echo "Extracting Kustomize..." + + output=$(ls | grep kustomize) + echo "${output}" + + mv "${output}" kustomize + + echo "Installing Kustomize..." + chmod +x kustomize + export PATH=`pwd`:$PATH + + echo "Kustomize installed successfully!" +} + +# Main script execution +main() { + echo "Detecting OS and architecture..." + os=$(detect_os) + arch=$(detect_arch) + + echo "OS: ${os}" + echo "Architecture: ${arch}" + + install_kustomize "${os}" "${arch}" + + check_kustomize_installed +} + +# Run the main function +main \ No newline at end of file diff --git a/openshift-ci/scripts/oci-model-registry-deploy.sh b/openshift-ci/scripts/oci-model-registry-deploy.sh index 6b78c835..de805810 100755 --- a/openshift-ci/scripts/oci-model-registry-deploy.sh +++ b/openshift-ci/scripts/oci-model-registry-deploy.sh @@ -10,6 +10,7 @@ OPENDATAHUB_CRDS="datascienceclusters.datasciencecluster.opendatahub.io,dsciniti DATA_SCIENCE_CLUSTER_CRDS="acceleratorprofiles.dashboard.opendatahub.io,datasciencepipelinesapplications.datasciencepipelinesapplications.opendatahub.io,odhapplications.dashboard.opendatahub.io,odhdashboardconfigs.opendatahub.io,odhdocuments.dashboard.opendatahub.io" MODEL_REGISTRY_CRDS="modelregistries.modelregistry.opendatahub.io" source "openshift-ci/scripts/colour_text_variables.sh" +source "openshift-ci/scripts/install_kustomize.sh" # Function to monitor CRDS creation and deployment. # The function takes two arguments, reference to manifest and a wait time in seconds.