When trying to install a plugin with the Jenkins CLI and providing a URL as argument, the proxy configuration of the Jenkins master does not seem to be taken into account.
For example if I use the following command:
java -jar jenkins-cli.jar -logger FINE -s https://my.jenkinsexample.com -noCertificateCheck -auth myUser:myPassword install-plugin https://jenkins-updates.cloudbees.com/download/plugins/cloudbees-aws-cli/1.5.9/cloudbees-aws-cli.hpi
But requires to be behind an HTTP proxy to be able to download that plugin, it fails with:
ERROR: Unexpected exception occurred while performing install-plugin command.
java.net.ConnectException: Connection timed out
Even if I have a proxy configured under *Manage Jenkins > Manage Plugins > Advanced*.
Evidence
- https://github.com/jenkinsci/jenkins/blob/jenkins-2.176.1/core/src/main/java/hudson/cli/InstallPluginCommand.java#L100-L122
- https://github.com/jenkinsci/jenkins/blob/jenkins-2.176.1/core/src/main/java/hudson/FilePath.java#L965-L976
Workaround
Only workaround seem to be to set the proxy via system properties on the master:
-Dhttps.proxyHost=myproxy.server.com -Dhttps.proxyPort=8080 -Dhttps.proxyUser=myUser -Dhttp.proxyPassword=myPassword
- is duplicated by
-
JENKINS-63228 jenkins-cli install-plugin URL doesn't use configured proxy
- Resolved