fix: validate webhook deployment script arguments#4129
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: immanuwell The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Welcome @immanuwell! |
|
Hi @immanuwell. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Tip We noticed you've done this a few times! Consider joining the org to skip this step and gain Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
@divyenpatel @xing-yang please take a look |
What this PR does / why we need it:
deploy-vsphere-csi-validation-webhook.shhad busted CLI error handling.Unknown flags tried to run
usagelike a command, and--namespacewith no value died on a bareshift, so the script faceplanted before it even touched the cluster. Kinda rough.This patch adds a real
usage()helper, returns0for--help, validates--namespace, and keeps the normal path the same.Which issue this PR fixes: None
Testing done:
bash -n manifests/vanilla/deploy-vsphere-csi-validation-webhook.shRepro with the old script blob from
HEAD:tmp_old=$(mktemp) && git show HEAD:manifests/vanilla/deploy-vsphere-csi-validation-webhook.sh > "$tmp_old" && chmod +x "$tmp_old" && bash "$tmp_old" --bad-flagold output:
usage: command not foundtmp_old=$(mktemp) && git show HEAD:manifests/vanilla/deploy-vsphere-csi-validation-webhook.sh > "$tmp_old" && chmod +x "$tmp_old" && bash -x "$tmp_old" --namespaceold behavior: exits after a bare
shiftRepro with this patch:
bash manifests/vanilla/deploy-vsphere-csi-validation-webhook.sh --bad-flagnow prints a clean unknown-option error and usage text
bash manifests/vanilla/deploy-vsphere-csi-validation-webhook.sh --namespacenow prints a clean missing-value error and usage text
bash manifests/vanilla/deploy-vsphere-csi-validation-webhook.sh --helpnow exits
0bash manifests/vanilla/deploy-vsphere-csi-validation-webhook.sh --namespace vmware-system-csistill follows the normal path, and in this env stops at
kubectl not foundSpecial notes for your reviewer:
No matching issue found, so this is just a tiny paper-cut fix.
Release note: