github.com/verrazzano/verrazzano@v1.7.1/ci/scripts/derive_kubernetes_version.sh (about) 1 #!/bin/bash 2 # 3 # Copyright (c) 2022, Oracle and/or its affiliates. 4 # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. 5 # 6 set -o pipefail 7 8 if [ -z $1 ]; then 9 echo "Kubernetes Version is required" 10 exit 1 11 fi 12 KUBERNETES_VERSION=$1 13 14 # If the Kubernetes version starts with v, remove it 15 if [[ $KUBERNETES_VERSION == v* ]] ; then 16 KUBERNETES_VERSION="${KUBERNETES_VERSION:1}" 17 fi 18 19 # If the Kubernetes version contains the patch version, remove it 20 COUNT_DOT=$(echo "$KUBERNETES_VERSION" | tr -cd "." | wc -c) 21 22 if [ "$COUNT_DOT" -gt "1" ]; then 23 KUBERNETES_VERSION=$(echo ${KUBERNETES_VERSION} | cut -f1,2 -d'.') 24 fi 25 26 # Kubernetes version in the form <major version>.<minor version> 27 echo "$KUBERNETES_VERSION"