Chef Cookbooks: Installing Jenkins plugin with chef failing - jenkins

I am trying to setup a Jenkins server using one of the Chef cookbooks from the supermarket. Unfortunately it is failing with the below error. The plugin recipe requires for the Global security configuration - "Enable CLI with remoting" to be enabled. Can anybody help me to enable it from a Chef recipe so that
java -jar jenkins-cli.jar -s http://localhost:8080 -remoting
installs the plugin.
Thanks
Here is the error log
java.io.IOException: No X-Jenkins-CLI2-Port among [X-Jenkins, null, Server, X-Content-Type-Options, X-You-Are-In-Group-Disabled, X-Hudson, X-Permission-Implied-By, Date, X-Jenkins-Session, X-You-Are-Authenticated-As, X-Required-Permission, Set-Cookie, Expires, Content-Length, Content-Type]
at hudson.cli.CLI.getCliTcpPort(CLI.java:311)
at hudson.cli.CLI.<init>(CLI.java:137)
at hudson.cli.CLIConnectionFactory.connect(CLIConnectionFactory.java:82)
at hudson.cli.CLI._main(CLI.java:615)
at hudson.cli.CLI.main(CLI.java:426)
Suppressed: java.io.IOException: Server returned HTTP response code: 403 for URL: http://localhost:8080/cli?remoting=true
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1876)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474)
at hudson.cli.FullDuplexHttpStream.<init>(FullDuplexHttpStream.java:101)
at hudson.cli.CLI.connectViaHttp(CLI.java:163)
at hudson.cli.CLI.<init>(CLI.java:141)

As per the official documentation, remoting option is disabled by default. you can enable it by going to Configure Global Security. I don't think by programatically we can't enable it. For more details use this official link. Remoting Connection Mode | official Jenkins
This is the solution they are providing for your problem. Hope this helps.
Go to Manage Jenkins > Configure Global Security and choose "Fixed" or "Random" under TCP port for JNLP agents.

You can enable the remoting option by writing a bit of Groovy that gets run when Jenkins starts, but a better option is to configure the proper authentication and use the ssh or http methods.
https://github.com/chef-cookbooks/jenkins#authentication
See also: https://stackoverflow.com/a/51106793/3794873

Related

SonarQube Scanner doesn't use both global or specific proxy settings

We're using sonar scanner in our Jenkins pipeline to scan our code in a JNLP slave.
Both Sonarscanner and SonarQube are running in Docker containers in Openshift.
Our SonarQube server is behind a proxy without authentication.
Sonar scanner doesn't read any proxy information we submit to it through either -D http.ProxyHost in start command or in the configuration file. There is no way to reach our Sonarqube server behind the proxy. Could you help us figure out what to do?
I tried all ways to fix it but nothing works:
Passing -D https.ProxyHost -D https.ProxyPort (without http:// header)
putting them into sonar-scanner.properties
Passing proxy values in environment variables HTTP_PROXY, HTTPS_PROXY, JAVA_OPTS...
Doing a curl to the SonarQube server works -> Firewall is ok, connectivity is ok.
I couldn't find any issues tracker regarding this project in Github and the Jira tracker is closed to submitting new issues.
Has anyone encountered the same issue? There is another question related to this but no answer have been given: SonarQube scanner can't connect to server
Thanks,
Lain92
I had the same problem, and the way I found to fix this is using an environment variable.
export JAVA_TOOL_OPTIONS="-Dhttp.proxyHost=<PROXY> -Dhttp.proxyPort=8080 -Dhttps.proxyHost=<PROXY> -Dhttps.proxyPort=8080 -Dhttp.nonProxyHosts=\"localhost|127.0.0.1\""
Note that "-Dhttp.proxyHost" does not have space between D and http.proxy.

Getting 401 Unauthorized error while trying to launch Jenkins slave via command line through JNLP using -secret option

I am trying to launch my Jenkins slave via command line through JNLP, so that I can put the command in the task scheduler. However, I am facing authentication issues only when I use the -secret option with the secret key generated by Jenkins. Works fine if I pass the -auth option with the same username password that I use for Jenkins.
java -jar slave.jar -jnlpUrl http://<jenkins host>:<port>/jenkins/computer/<Slave name>/slave-agent.jnlp -secret <secret_key> -workDir "C:\Jenkins\Robot"
Note: the command I try to execute is as is copied from Jenkins page.
It gives following error:
org.jenkinsci.remoting.engine.WorkDirManager initializeWorkDirINFO: Using C:\Jenkins\Robot\remoting as a remoting work directory Both error and output logs will be printed to C:\Jenkins\Robot\remoting Not use http_proxy property or environment variable which is invalid: unknown protocol: one.proxy.att.com Failing to obtain http://<host:port>/jenkins/computer/<job>/slave-agent.jnlp?encrypt=true
java.io.IOException: Failed to load http://<host:port>/jenkins/computer/<job>//slave-agent.jnlp?encrypt=true: 401 Unauthorized
at hudson.remoting.Launcher.parseJnlpArguments(Launcher.java:485)
at hudson.remoting.Launcher.run(Launcher.java:316)
at hudson.remoting.Launcher.main(Launcher.java:277)
Waiting 10 seconds before retry
However, if I change command as follows, it runs successfully.
java -jar slave.jar -jnlpUrl http://<jenkins host>:<port>/jenkins/computer/<Slave name>/slave-agent.jnlp/slave-agent.jnlp -auth <user>:<pass> -workDir "C:\Jenkins\Robot"
I cannot keep my credentials in the launch file as this will remain in public shared repository. Pls help.
I think that your issue may come from a security management.
Have you enable TCP port for JNLP agents in your Global Security ?
Go to Manage Jenkins > Global Security, Enable TCP port for JNLP agents, select Fixed and fill the port you used in your jnlpUrl, then select Java Web Start Agent Protocol/4 and save your config.
Further documentation here.
I had a similar problem. I resolved it by allowing anonymous access to Jenkins (the option is available in Manage Jenkins page, Kerberos properties section - we use Kerberos Single Sign-On plugin for Jenkins authentication, so not sure how would other authentication plugins work).
I'd also recommend limiting the scope of anonymous access if you enable it.

There is no "Launch agent via Java Web Start" option in my jenkins when I adding a windows slave node

I have already configured the java enviroment and installtion
path
This is a duplicate question from Server Fault: Answer Here
Java Web Start utilizes TCP so it has to be enabled and configured in Jenkins...
Login to Jenkins as admin
Manage Jenkins > Configure Global Security > TCP port for JNLP agents
Do yourself a favor and pick a static port assignment...
As of Jenkins version 2.176.3, there is option enabled when "Launch agent by connecting it to the master" which is same as "launch agent via java web start" once you enable the "Manage Jenkins => Configure Global Security => Agents => TCP port for inbound agents" as mentioned above.
e.g. Fixed: 50000
Make sure that you've enabled a JNLP port in Manager Jenkins -> Configure Global Security. If no JNLP port is specified, then the JNLP slave option will not appear.
I had similar issue after updating my Jenkins, I then used "Launch agent by connecting it to the master" method to launch and my port "TCP port for inbound agents" under
- Manage Jenkins => Configure Global Security => Agents => TCP port for inbound agents got changed to 8888. I have updated it back to 50000 and that resolved the issue. Hope it helps.
On some systems I used to get a button to download the agent's JNLP. On my new linux mint system, I instead get the "JNLP not available" message. So was lost as to where to get the JNLP file. However, looking in the command below I saw the URL for downloading it, eg:
http://127.0.0.1:8080/computer/build_slave/jenkins-agent.jnlp
Go to the slave machine, paste the URL in the browser to download it!
This might also be due to missing permissions for the user trying to setup the agent via java web start, at least that was the case in my scenario;
To verify this, try to download the jnlp directly; URL would be of the form [jenkins url]/computer/[agent name]/slave-agent.jnlp, if there is a permissions issue you will get something along the lines of:
Access Denied
xxxx is missing the Agent/Connect permission

Jenkins Update Center broken -- java.io.IOException: Downloaded file /var/lib/jenkins/plugins/*.jpi.tmp does not match expected SHA-1 [duplicate]

I have installed Jenkins by deploying its WAR file to Tomcat. On typing
http://localhost:8080/jenkins
In browser, jenkins home page is opening which means jenkins is successfully installed. I configured system settings, gave jdk and maven path and save them. Then to install plugins, I clicked on Jenkins->Manage plugins and clicked on Available tab but could not find any plugins. I tried three solutions:
Configured proxy for Jenkins by going to Jenkins->Manage Plugins->Advanced(did not find plugins)
Restarted server, refreshed browser and went to Jenkins->Manage plugins->Available (still did not find any plugins). So, I read somewhere that we have update plugins forcefully if they are not updated automatically. So, went to Jenkins->Manage Plugins->Advanced and clicked the tab 'Check now' (Still did not find any plugins on clicking on Available tab).
Finally I read somewhere that if we add the pluginGroup 'org.jvnet.hudson.tools' to settings.xml file of maven, problem may be resolved. So, added the corresponding code to settings.xml:
Then I tried again but still could not find any plugins in
Jenkins->Manage plugins->Available
If any other solution is there which can resolve this problem please let me know.
Go to: Manage Jenkins → Manage Plugins → Advanced, then click Check now in the bottom right-hand corner. When you go back to Available tab all plugins should be listed.
At the plugins section of Jenkins open the "Advanced Settings" tab and paste the following URL into the Update Server URL field (at the bottom): https://updates.jenkins.io/update-center.json
For me the following worked:
Go to Manage Jenkins->Configure Global Security
Click the checkbox for "Use browser for metadata download"
I also have security disabled and prevent cross site forgery unchecked.
You can force update the plugin list by hand.
This worked for me:
wget -O default.js http://updates.jenkins-ci.org/update-center.json
sed '1d;$d' default.js > default.json
curl -X POST -H "Accept: application/json" -d #default.json http://localhost:8080/updateCenter/byId/default/postBack --verbose
(I created this in order to be able to deploy Jenkins and install plugins in batch)
The problem may be that your browser proxy settings are not configured properly.
Jenkins doesn't retrieve the plugin list directly from the update center, it tells your browser to retrieve it and post it back to Jenkins. So the HTTP proxy settings within Jenkins are ignored for this step.
So if you are using a browser that is configured to only work within your network, to connect to local servers such as a Jenkins instance, then you won't be able to update the plugin list.
(This just happened to me and took a frustrating hour to work out.)
This was so frustrating... Not because of difficulty but lack of clarity and good documentation, at least for the issues I encountered. I ended up having to set up the Manage Plugins -> Advanced -> HTTP Proxy Configuration in a very specific, picky way. If I didn't do exactly this, minus the last noted thing on the bottom, I could not get this working. Maybe it's my work's firewall, maybe it's jenkins, either way give this a shot if you haven't been able to successfully update your proxy settings. I used the Validate Proxy tool in the menu. I'll very briefly describe the infographic basics below
Don't add http:// or https:// to your Server field
Use your jenkins credentials for Username and Password, not your proxy credentials (if that's even applicable)
Add http:// to your Test URL if you're checking something like Google or Yahoo
Submit your changes
Then run check-now
(Optional?) Change Update site from HTTP to HTTPS
You should be able to now update your plugins fingers-crossed
Change the update site from
https://updates.jenkins.io/update-center.json
to
http://updates.jenkins-ci.org/update-center.json
I had this issue when using nginx as a secure reverse proxy. I needed to update the url from which to download the updates list, as suggested above, only with https to prevent mixed content errors in chrome.
The reason why I could not find a plugin that i searched for in Jenkins->Manage plugins->Available:
It had already been installed and it was in Jenkins->Manage plugins->Installed.
I came across this SO answer while I was experiencing the same issue. When I would click "Check Now" to force Jenkins to download the latest list, my browser would just hang. It wasn't until I tailed the Jenkins log that I found this here:
Mar 10, 2014 1:15:54 PM hudson.security.csrf.CrumbFilter doFilter
WARNING: No valid crumb was included in request for /administrativeMonitor/hudson.diagnosis.ReverseProxySetupMonitor/test. Returning 403.
Looks like the issue has to do with how I've put Jenkins behind a reverse proxy and enabled the option to prevent Cross Site Request Forgery. Once I disabled that, the "Check Now" completed within 30 seconds.
For me, the following works out. I experience this empty available list issue after a fresh install jenkins 1.638 on Ubuntu 1404 in virtual box. We're under an ISA proxy server.
Go to Jenkins->Manage Plugins->Advanced and setup the proxy as below:
Host: 192.168.x.x (your Proxy IP)
Port: 80 (Your proxy port)
Note that I find the format matters. I tried adding http:// it doesn't work. It has to be exactly like above.
Then hit the check now button in the bottom right as everyone else suggested. Then you get the list.
My solution is here
If you type in "http://updates.jenkins-ci.org/update-center.json" directory to brower's address bar, (in my case) it actually redirected to "http://ftp.tsukuba.wide.ad.jp/software/jenkins/updates/current/update-center.json."
It worked when I set "http://ftp.tsukuba.wide.ad.jp/software/jenkins/updates/current/update-center.json" to Jenkins' update site, and click "Save" & "Update."
Hope this helps.
Or your plugin can be already installed. Once it's installed it's not in the list of available plugins.
If you're using Chrome
Go to: Manage Jenkins → Manage Plugins → Advanced, then click Check now in the bottom right-hand corner. Then click a shield icon in the address bar, click Load anyway and Jenkins will start to update plugins. In Firefox this icon is situated on the left side of address bar, near back button.
You can install plugins manually, to this this, go to advanced tab in manage plugins, after downloading plugins you need, submit these
I had an issue with NginX proxy requests to Jenkins. I had error:
Nginx 413 Request Entity Too Large
I was able to fix that by adding
client_max_body_size 2M;
to the /etc/nginx/nginx.conf file. After that I went to Jenkins - Plugin Manager - Advanced tab and press Check Now button
I had the same issue and was able to resolve it by enabling the browser metadata download. Please follow the steps below the enable this configuration in Jenkins
Step 01: Select Manage Jenkins and click on Configure Global Security
Step 02: Under the Plugin Manager section tick the "Use browser for metadata download"
Step 03: View Available tab under the Plugin Manager section in Manage Jenkins
If its a fresh installation not behind proxy please follow instruction under available "Use the search field above to search for available plugins".
After trying many things (including all the solutions posted here) and hours of searching... I've ended up with the upgrade of jenkins to version 1.638.
This helps to solve the frustrated problem with empty available plugins in older version of jenkins!
This answer is specific to Windows 10. If you use the installer that Jenkins now comes bundled as, Jenkins will get installed as a service. By default, the service runs under the Local System account. You have to change it to run under the Network Service account in order for Jenkins to be able to connect with the plugin update service. If you have Administrator privileges on the system then these steps should help:
Open Command Prompt.
Type in Services.msc and hit enter.
The Services window should be open now.
Locate the Jenkins instance in the list.
Right click on it and click Properties.
Go to the Log On tab (should be the second one).
There should be 2 radio buttons.
Local System Account (selected)
This Account (unselected)
Select This Account.
Type in Network Service in the text box.
Provide your windows password.
Hit Apply and OK.
Restart the Jenkins service.
Reload Jenkins in browser.
For added measures, you could also add a rule in Windows Firewall (or any other Firewall that you may be using) to allow outbound requests from Jenkins. Point to the jenkins.exe application that should be located in the installation directory of Jenkins for this rule.
For those like me who use Jenkins with Docker with a JDK8u60+ version, you need to remove the MD5 hash in JDK_HOME/jre/lib/security/java.security to make it works:
jdk.certpath.disabledAlgorithms=MD2, MD5, RSA keySize < 1024
To
jdk.certpath.disabledAlgorithms=MD2, RSA keySize < 1024
This should be a temporary workaround
You don't have internet connection on Jenkins Machine.please configure Internet or installed plugin in offline mode.
Go to Jenkins -Plugin Manager-Upload Plugin
My Environment
Windows 7 Enterprise
Jenkins 2.89.2
Direct access to Internet
I tried most of the suggestions provided here but nothing worked until I tried following
First: I needed to run as 'Administrator'
Second: It was using default user home dir at C:\users\yourusername\.jenkins.
What Worked:
I changed default dir above to a different folder by defining JENKINS_HOME environment variable and I was able to get new plugins.
I faced the same issue with the latest Jenkins version, and all solutions didn't work with me so I followed the command line approach to install any plugin
sudo java -jar jenkins-cli.jar -s http://localhost:8080/ -auth USERNAME:PASSWORD -webSocket install-plugin PLUGIN_NAME
You can download the Jenkins-cli.jar from the installed Jenkins page http://localhost:8080/cli
You can search for the plugin name from the Jenkins site
https://plugins.jenkins.io/
If you have the Jenkins CLI installed uou can run this command
directly via terminal
jenkins-plugin-cli --plugins PLUGIN_NAME
I hope this solution helps if others didn't work with you.
I too tried all above,but this worked wonders
steps:
Go to https://plugins.jenkins.io (official page to get all jenkins plugins you are looking to install on jenkins)
Search "github" ( as we need github plugin to install)
You will see the github plugin,check the plugin id...it displays as id:github....so "github" is the exact plugin id
Download the jenkins-cli.jar from http://localhost:8080/cli and copy under /opt/jenkins-cli.jar in jenkins server
On jenkins server ,run the command to install github plugin
java -jar jenkins-cli.jar -s "http://localhost:8080" -auth jenkins-username:jenkins-password install-plugin github
Restart server
Now u will see the github plugin installed under installed section
For those who used Docker with MacOS. When you use Docker, there is no need to configure proxy settings for Jenkins inside Jenkins application, but you can and should do it already when running the container. For the context, I use MacOS and I was working within enterprise domain that had proxy configured.
SOLUTION
Configure proxy settings for Docker. You can do that if you open Preferences in Docker Desktop. The left menu, "Resources"->"Proxies". There you need to add correct proxy settings and then click "Apply & restart"
Add proxy settings to container when running it by giving and env variables HTTP_PROXY and HTTPS_PROXY. Add following flags with correct values to your command:-e HTTP_PROXY=<your_http_proxy:port> -e HTTPS_PROXY=<your_http_proxy:port>. An example with my own proxy configuration:
docker run \
-p 8080:8080 \
-p 50000:50000 \
-e HTTP_PROXY=http://10.65.100.13:8080 \
-e HTTPS_PROXY=http://10.65.100.13:8080 \
-v jenkins_home:/var/jenkins_home \
jenkins/jenkins:lts-jdk11
UNDERLYING ISSUE
The issue was SSL certificates. Jenkins, when downloading plugins, was unable to reach the CA certificates while working inside the container that was no configured to work using proxy. This caused the download to fail. Even if I configured Jenkins proxy settings as suggested in previous answers, it was no good, because the container itself failed to communicate over proxy.
Reading the Docker documentation, I found out that Docker should access CA certs itself from keychain, but it does not add proxy settings automatically to containers. Configuration to the container has to be added manually. Doing so configures the whole container properly in terms of proxy and container is able to reach for CA certs. Once the container works via proxy as expected, Jenkins does not need additional configuration itself.

Unable to find plugins in list of available plugins in jenkins

I have installed Jenkins by deploying its WAR file to Tomcat. On typing
http://localhost:8080/jenkins
In browser, jenkins home page is opening which means jenkins is successfully installed. I configured system settings, gave jdk and maven path and save them. Then to install plugins, I clicked on Jenkins->Manage plugins and clicked on Available tab but could not find any plugins. I tried three solutions:
Configured proxy for Jenkins by going to Jenkins->Manage Plugins->Advanced(did not find plugins)
Restarted server, refreshed browser and went to Jenkins->Manage plugins->Available (still did not find any plugins). So, I read somewhere that we have update plugins forcefully if they are not updated automatically. So, went to Jenkins->Manage Plugins->Advanced and clicked the tab 'Check now' (Still did not find any plugins on clicking on Available tab).
Finally I read somewhere that if we add the pluginGroup 'org.jvnet.hudson.tools' to settings.xml file of maven, problem may be resolved. So, added the corresponding code to settings.xml:
Then I tried again but still could not find any plugins in
Jenkins->Manage plugins->Available
If any other solution is there which can resolve this problem please let me know.
Go to: Manage Jenkins → Manage Plugins → Advanced, then click Check now in the bottom right-hand corner. When you go back to Available tab all plugins should be listed.
At the plugins section of Jenkins open the "Advanced Settings" tab and paste the following URL into the Update Server URL field (at the bottom): https://updates.jenkins.io/update-center.json
For me the following worked:
Go to Manage Jenkins->Configure Global Security
Click the checkbox for "Use browser for metadata download"
I also have security disabled and prevent cross site forgery unchecked.
You can force update the plugin list by hand.
This worked for me:
wget -O default.js http://updates.jenkins-ci.org/update-center.json
sed '1d;$d' default.js > default.json
curl -X POST -H "Accept: application/json" -d #default.json http://localhost:8080/updateCenter/byId/default/postBack --verbose
(I created this in order to be able to deploy Jenkins and install plugins in batch)
The problem may be that your browser proxy settings are not configured properly.
Jenkins doesn't retrieve the plugin list directly from the update center, it tells your browser to retrieve it and post it back to Jenkins. So the HTTP proxy settings within Jenkins are ignored for this step.
So if you are using a browser that is configured to only work within your network, to connect to local servers such as a Jenkins instance, then you won't be able to update the plugin list.
(This just happened to me and took a frustrating hour to work out.)
This was so frustrating... Not because of difficulty but lack of clarity and good documentation, at least for the issues I encountered. I ended up having to set up the Manage Plugins -> Advanced -> HTTP Proxy Configuration in a very specific, picky way. If I didn't do exactly this, minus the last noted thing on the bottom, I could not get this working. Maybe it's my work's firewall, maybe it's jenkins, either way give this a shot if you haven't been able to successfully update your proxy settings. I used the Validate Proxy tool in the menu. I'll very briefly describe the infographic basics below
Don't add http:// or https:// to your Server field
Use your jenkins credentials for Username and Password, not your proxy credentials (if that's even applicable)
Add http:// to your Test URL if you're checking something like Google or Yahoo
Submit your changes
Then run check-now
(Optional?) Change Update site from HTTP to HTTPS
You should be able to now update your plugins fingers-crossed
Change the update site from
https://updates.jenkins.io/update-center.json
to
http://updates.jenkins-ci.org/update-center.json
I had this issue when using nginx as a secure reverse proxy. I needed to update the url from which to download the updates list, as suggested above, only with https to prevent mixed content errors in chrome.
The reason why I could not find a plugin that i searched for in Jenkins->Manage plugins->Available:
It had already been installed and it was in Jenkins->Manage plugins->Installed.
I came across this SO answer while I was experiencing the same issue. When I would click "Check Now" to force Jenkins to download the latest list, my browser would just hang. It wasn't until I tailed the Jenkins log that I found this here:
Mar 10, 2014 1:15:54 PM hudson.security.csrf.CrumbFilter doFilter
WARNING: No valid crumb was included in request for /administrativeMonitor/hudson.diagnosis.ReverseProxySetupMonitor/test. Returning 403.
Looks like the issue has to do with how I've put Jenkins behind a reverse proxy and enabled the option to prevent Cross Site Request Forgery. Once I disabled that, the "Check Now" completed within 30 seconds.
For me, the following works out. I experience this empty available list issue after a fresh install jenkins 1.638 on Ubuntu 1404 in virtual box. We're under an ISA proxy server.
Go to Jenkins->Manage Plugins->Advanced and setup the proxy as below:
Host: 192.168.x.x (your Proxy IP)
Port: 80 (Your proxy port)
Note that I find the format matters. I tried adding http:// it doesn't work. It has to be exactly like above.
Then hit the check now button in the bottom right as everyone else suggested. Then you get the list.
My solution is here
If you type in "http://updates.jenkins-ci.org/update-center.json" directory to brower's address bar, (in my case) it actually redirected to "http://ftp.tsukuba.wide.ad.jp/software/jenkins/updates/current/update-center.json."
It worked when I set "http://ftp.tsukuba.wide.ad.jp/software/jenkins/updates/current/update-center.json" to Jenkins' update site, and click "Save" & "Update."
Hope this helps.
Or your plugin can be already installed. Once it's installed it's not in the list of available plugins.
If you're using Chrome
Go to: Manage Jenkins → Manage Plugins → Advanced, then click Check now in the bottom right-hand corner. Then click a shield icon in the address bar, click Load anyway and Jenkins will start to update plugins. In Firefox this icon is situated on the left side of address bar, near back button.
You can install plugins manually, to this this, go to advanced tab in manage plugins, after downloading plugins you need, submit these
I had an issue with NginX proxy requests to Jenkins. I had error:
Nginx 413 Request Entity Too Large
I was able to fix that by adding
client_max_body_size 2M;
to the /etc/nginx/nginx.conf file. After that I went to Jenkins - Plugin Manager - Advanced tab and press Check Now button
I had the same issue and was able to resolve it by enabling the browser metadata download. Please follow the steps below the enable this configuration in Jenkins
Step 01: Select Manage Jenkins and click on Configure Global Security
Step 02: Under the Plugin Manager section tick the "Use browser for metadata download"
Step 03: View Available tab under the Plugin Manager section in Manage Jenkins
If its a fresh installation not behind proxy please follow instruction under available "Use the search field above to search for available plugins".
After trying many things (including all the solutions posted here) and hours of searching... I've ended up with the upgrade of jenkins to version 1.638.
This helps to solve the frustrated problem with empty available plugins in older version of jenkins!
This answer is specific to Windows 10. If you use the installer that Jenkins now comes bundled as, Jenkins will get installed as a service. By default, the service runs under the Local System account. You have to change it to run under the Network Service account in order for Jenkins to be able to connect with the plugin update service. If you have Administrator privileges on the system then these steps should help:
Open Command Prompt.
Type in Services.msc and hit enter.
The Services window should be open now.
Locate the Jenkins instance in the list.
Right click on it and click Properties.
Go to the Log On tab (should be the second one).
There should be 2 radio buttons.
Local System Account (selected)
This Account (unselected)
Select This Account.
Type in Network Service in the text box.
Provide your windows password.
Hit Apply and OK.
Restart the Jenkins service.
Reload Jenkins in browser.
For added measures, you could also add a rule in Windows Firewall (or any other Firewall that you may be using) to allow outbound requests from Jenkins. Point to the jenkins.exe application that should be located in the installation directory of Jenkins for this rule.
For those like me who use Jenkins with Docker with a JDK8u60+ version, you need to remove the MD5 hash in JDK_HOME/jre/lib/security/java.security to make it works:
jdk.certpath.disabledAlgorithms=MD2, MD5, RSA keySize < 1024
To
jdk.certpath.disabledAlgorithms=MD2, RSA keySize < 1024
This should be a temporary workaround
You don't have internet connection on Jenkins Machine.please configure Internet or installed plugin in offline mode.
Go to Jenkins -Plugin Manager-Upload Plugin
My Environment
Windows 7 Enterprise
Jenkins 2.89.2
Direct access to Internet
I tried most of the suggestions provided here but nothing worked until I tried following
First: I needed to run as 'Administrator'
Second: It was using default user home dir at C:\users\yourusername\.jenkins.
What Worked:
I changed default dir above to a different folder by defining JENKINS_HOME environment variable and I was able to get new plugins.
I faced the same issue with the latest Jenkins version, and all solutions didn't work with me so I followed the command line approach to install any plugin
sudo java -jar jenkins-cli.jar -s http://localhost:8080/ -auth USERNAME:PASSWORD -webSocket install-plugin PLUGIN_NAME
You can download the Jenkins-cli.jar from the installed Jenkins page http://localhost:8080/cli
You can search for the plugin name from the Jenkins site
https://plugins.jenkins.io/
If you have the Jenkins CLI installed uou can run this command
directly via terminal
jenkins-plugin-cli --plugins PLUGIN_NAME
I hope this solution helps if others didn't work with you.
I too tried all above,but this worked wonders
steps:
Go to https://plugins.jenkins.io (official page to get all jenkins plugins you are looking to install on jenkins)
Search "github" ( as we need github plugin to install)
You will see the github plugin,check the plugin id...it displays as id:github....so "github" is the exact plugin id
Download the jenkins-cli.jar from http://localhost:8080/cli and copy under /opt/jenkins-cli.jar in jenkins server
On jenkins server ,run the command to install github plugin
java -jar jenkins-cli.jar -s "http://localhost:8080" -auth jenkins-username:jenkins-password install-plugin github
Restart server
Now u will see the github plugin installed under installed section
For those who used Docker with MacOS. When you use Docker, there is no need to configure proxy settings for Jenkins inside Jenkins application, but you can and should do it already when running the container. For the context, I use MacOS and I was working within enterprise domain that had proxy configured.
SOLUTION
Configure proxy settings for Docker. You can do that if you open Preferences in Docker Desktop. The left menu, "Resources"->"Proxies". There you need to add correct proxy settings and then click "Apply & restart"
Add proxy settings to container when running it by giving and env variables HTTP_PROXY and HTTPS_PROXY. Add following flags with correct values to your command:-e HTTP_PROXY=<your_http_proxy:port> -e HTTPS_PROXY=<your_http_proxy:port>. An example with my own proxy configuration:
docker run \
-p 8080:8080 \
-p 50000:50000 \
-e HTTP_PROXY=http://10.65.100.13:8080 \
-e HTTPS_PROXY=http://10.65.100.13:8080 \
-v jenkins_home:/var/jenkins_home \
jenkins/jenkins:lts-jdk11
UNDERLYING ISSUE
The issue was SSL certificates. Jenkins, when downloading plugins, was unable to reach the CA certificates while working inside the container that was no configured to work using proxy. This caused the download to fail. Even if I configured Jenkins proxy settings as suggested in previous answers, it was no good, because the container itself failed to communicate over proxy.
Reading the Docker documentation, I found out that Docker should access CA certs itself from keychain, but it does not add proxy settings automatically to containers. Configuration to the container has to be added manually. Doing so configures the whole container properly in terms of proxy and container is able to reach for CA certs. Once the container works via proxy as expected, Jenkins does not need additional configuration itself.

Resources