Issue
I need to install kubectl on a windows node in Jenkins https://v1-19.docs.kubernetes.io/docs/tasks/tools/install-kubectl/
I don't have curl installed and I'd like to follow that exact step to install kubectl
curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.19.14/bin/windows/amd64/kubectl.exe
Any suggestion? The other powershell command in that link doesn't work for me. Edit: As mentioned in my comment I tried:
Invoke-WebRequest "storage.googleapis.com/kubernetes-release/release/v1.19.14/bin/…" -OutFile "kubectl.exe
However the script just run and never stops The console just show:
[Pipeline] powershell
Solution
cmd + powershell
PowerShell.exe -Command "&{$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest https://storage.googleapis.com/kubernetes-release/release/v1.19.14/bin/windows/amd64/kubectl.exe -OutFile kubectl.exe}"
plain groovy
new URL('https://storage.googleapis.com/kubernetes-release/release/v1.19.14/bin/windows/amd64/kubectl.exe').withInputStream{
new File('/.tmp/kubectl.exe') << it
}
groovy without withInputStream
def url = new URL('https://storage.googleapis.com/kubernetes-release/release/v1.19.14/bin/windows/amd64/kubectl.exe')
def stream = url.openStream()
new File('/.tmp/kubectl.exe') << stream
stream.close()
Answered By - daggett