Fix curl options for downloading kubectl #118
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
At the moment, the command for downloading kubectl binary has a hidden but real issue.
"--progress-bar -LO" options make it look good but curl won't fail if, by any chances, it is not able to download a binary. It's even worse, curl does create a file which contains an error message and is named 'kubectl'.
On the next step, the script moves this "binary" to /usr/loca/bin/, assigns an executable flag and an end user eventually will run this xml file instead of real kubectl tool.
What it really has to do is to fail (return non 0 exit code) and do not create any file at all.
Of course, there is another, global problem, but it's not bound to the scope of this issue.
A bigger problem is that, it doesn't matter curl creates a file with a wrong content or it doesn't, the script it self won't react on a non-zero exit code of any commands and nothing stops it from going further. So, if the script is not able to download a working copy of binary, it won't tell anyone about that. It will be a surprise for user later ;)
Anyway, I think, it's another issue and it's a subject to discussion in another thread.