Skip to content

When using the extended channel, also specify the cluster version #2045

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

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
9 changes: 8 additions & 1 deletion test/run-k8s-integration-ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,18 @@ else
fi

if [ "$deployment_strategy" = "gke" ]; then
if [ "$gke_release_channel" ]; then
# To leverage old cluster versions, we need set both the release channel and
# the cluster version.
if [ "$gke_release_channel" = "extended" ]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work if $gke_release_channel is empty? I'm always a little confused by bash parsing, but if the string is empty you may end up with if [ = extended ] which is a parse error

Copy link
Contributor Author

@julianKatz julianKatz Apr 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, I did a little more looking and I believe I've got a better version now.

That first part is right AFAICT. gke_release_channel is defaulted to empty string in its var declaration and Stackoverflow says [ thing = otherThing ] is the right POSIX solution for string equality checks.

The second one was more ambiguous. I've changed it to check for a non-empty variable:

  elif [ -n "$gke_release_channel" ]; then

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, the quotes matter. [ $unknown = foo ] fails to parse, but [ "$unknown" = foo ] is okay. Interesting.

+1 to using -n, it's a little more clear (although [ ] seems to be valid anyway)

base_cmd="${base_cmd} --gke-release-channel=${gke_release_channel}"
base_cmd="${base_cmd} --gke-cluster-version=${gke_cluster_version}"
elif [ -n "$gke_release_channel" ]; then
base_cmd="${base_cmd} --gke-release-channel=${gke_release_channel}"
else
base_cmd="${base_cmd} --gke-cluster-version=${gke_cluster_version}"
fi
fi

else
base_cmd="${base_cmd} --kube-version=${kube_version}"
fi
Expand Down