Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prow.sh: more flexible CSI_PROW_DEPLOYMENT #158

Merged
merged 1 commit into from
May 25, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions prow.sh
Original file line number Diff line number Diff line change
Expand Up @@ -654,22 +654,30 @@ delete_cluster_inside_prow_job() {
# Looks for the deployment as specified by CSI_PROW_DEPLOYMENT and CSI_PROW_KUBERNETES_VERSION
# in the given directory.
find_deployment () {
local dir file
local dir file k8sver
dir="$1"

# Fixed deployment name? Use it if it exists, otherwise fail.
# major/minor without release- prefix.
k8sver="$(echo "${CSI_PROW_KUBERNETES_VERSION}" | sed -e 's/\([0-9]*\)\.\([0-9]*\).*/\1.\2/' -e 's/^release-//')"

# Fixed deployment name? Use it if it exists.
if [ "${CSI_PROW_DEPLOYMENT}" ]; then
file="$dir/${CSI_PROW_DEPLOYMENT}/deploy.sh"
if ! [ -e "$file" ]; then
if [ -e "$file" ]; then
echo "$file"
return 0
fi

# CSI_PROW_DEPLOYMENT=kubernetes-x.yy is handled below with a fallback
# to kubernetes-latest. If it is something else, then fail here.
if ! echo "${CSI_PROW_DEPLOYMENT}" | grep -q "^kubernetes-${k8sver}\$"; then
return 1
fi
echo "$file"
return 0
fi

# Ignore: See if you can use ${variable//search/replace} instead.
# shellcheck disable=SC2001
file="$dir/kubernetes-$(echo "${CSI_PROW_KUBERNETES_VERSION}" | sed -e 's/\([0-9]*\)\.\([0-9]*\).*/\1.\2/')${CSI_PROW_DEPLOYMENT_SUFFIX}/deploy.sh"
file="$dir/kubernetes-${k8sver}${CSI_PROW_DEPLOYMENT_SUFFIX}/deploy.sh"
if ! [ -e "$file" ]; then
file="$dir/kubernetes-latest${CSI_PROW_DEPLOYMENT_SUFFIX}/deploy.sh"
if ! [ -e "$file" ]; then
Expand Down