Gerrit - Reload Plugins to incorporate changes - gerrit

I am developing some plugins for Gerrit 2.9 and usually copy the jar file into the Gerrit site's plugin folder.
However, I notice that it usually takes a while for Gerrit to pick up the changes made in the plugin jar file. One thing that automatically forces Gerrit to reload the plugins is to restart the server itself.
Next, I tried ssh -p 29418 localhost gerrit plugin reload <plugin-name>, however I get an error saying that "Fatal: Remote plugin administration is disabled".
To solve the above message, I was able to find this post where the suggestion is to add missing configuration option: "plugins.allowRemoteAdmin = true". However I am not sure where to add this configuration option.
So any ideas on how to do a force reload of Plugins without having to restart the Gerrit server itself ?

Open YOUR_GERRIT_DIR/etc/gerrit.config file and add the following entry:
[plugins]
allowRemoteAdmin = true
Save changes and restart your Gerrit instance. You will be able to reload / install plugins from remote host.

Related

Recover previous Jenkins build configuration

Is there a way to recover a Jenkins build configuration from a previous build?
In order to access the Jenkins server I use I need to open an SOCKS proxy. I went to submit a modification to the configuration but the SOCKS tunnel had closed so I reconnected it. Jenkins/my browser displayed an error saying the reload failed and do I want to resubmit the POST request. I said yes and instead of submitting the changes to the configuration I wanted it submitted a blank body.
So now the configuration for my build is completely empty and I'm annoyed.
I tried checking online for solutions and didn't see any way to extract the configuration from a previous build
The only thing that might have saved you is a backup ( or OS backup ?). There are various - Backup, ThinBackup, Periodic Backup, SCM Sync Configuration and others, but no Time Machine or D'oh! plugin that I know of.
Install the Job Configuration History and at least you'll quickly protected for the next time.
You should try using rebuild plugin.
1. Install rebuild plugin.
2. select the build that you want to rebuild and press rebuild.

How to automatically login to Jenkins on Active Directory?

I have an Active Directory plugin installed that allows logging in to Jenkins portal with my directory credentials by typing them in on the Login page.
But is there a way to automatically log in users if they are on a domain-joined machine? (Obviously, given the browser is configured to allow providing credentials to the site.)
There's a thread on Jenkins Dev group in which a guy mentions that he developed an SSO plugin that worked for him on Windows. He posted it on GitHub under name NegotiateSSO.
First you need to build it to get the hpi file. (Clone the project to your machine, cd into the directory and run mvn (Maven) in it).
The problem is that when I tried to install it, it broke my Jenkins configuration section/page. There's an exception happening inside the plugin that breaks the entire page.
So it didn't work for me, but hopefully it will get fixed at some point and we'll be able to use it.

Jenkins Job disappeared after restart

I have this strange problem in Jenkins 1.5.31 .
I had configured Maven jobs which I still see in Jenkins_Home directory. My Jenkins Windows service was not getting started even though I could still access the Jenkins on default port 8080.
When I found in event viewer found that service is trying for 8080 which it found to be in use, so I did taskkilPID using the 8080 port process and it successfully restarted the Windows Jenkins service.
However, when I opened the Jenkins URL, I saw only two of my jobs were there and rest disappeared.
Has any one faced this issue?
I checked plugins and found that Maven project plugin installed is 1.5.3.1 and 2.1 is available but it has message -Warning: This plugin is built for Jenkins 1.538 or newer. It may or may not work in your Jenkins.
I don't see those jobs in config.xml and nor in its old copy backup.
After Jenkins restarts, there is the case when some jobs are missing if the syntax in their config.xml contains errors.
Check Jenkins logs for errors (Manage Jenkins/System Log)
Fix the errors in config.xml of each job. ( path: JENKINS_HOME/jobs//config.xml)
Restart jenkins or choose option reload configurations from disk (Manage Jenkins/Reload Configuration from Disk).
When all errors are fixed the job should appear. You can validate your configurations against some online tool, f.e.: https://www.xmlvalidation.com/
Another case is when all Jenkins jobs are missing and an empty dashboard is loaded. This indicates that Jenkins home directory is wrong, so make sure to specify JENKINS_HOME correctly and restart Jenkins.
This happened to me too after a restart. But it was not because of errors in the config.xml, but because another containing folder with the same name but in different case existed on the server.
I don't know how this happened, but after copying over the jobs from the second folder and reloading the folder the job came back up again.
For e.g: the job that went missing was FOLDER-NAME/jobs/job-name
On the Jenkins server, on disk, there was both
FOLDER-NAME/jobs/job-name
folder-name/jobs/job-name
After copying the folder FOLDER-NAME/jobs/job-name to folder-name/jobs/
and reloading the folder (https://<jenkins-host>/jobs/FOLDER-NAME/reload) the job came back up.
Upgrade Jenkins to the latest version.This will fix the problem

Does uninstall a plugin causes in Jenkins/Hudson job config file to lose its plugin changes?

We are trying to troubleshoot why our job config page is not loading.
If we uninstall each plugin as we troubleshoot, would Hudson or Jenkins modify the job config files that had previously used those installed plugins
and remove those plugins tags just because we uninstalled them temporarily ?
We ask because we like to know if we need to make job config backups as we do not want to lose the old installed plugin tags used in our jobs.
Thank you
Sincerely
Yes, you should be doing job config backups! Yes, you probably should rsync your job config data and jenkins directories sans workspaces to a different system for debugging.
No, when you uninstall a plugin, the data that is associated with that plugin is generally left behind, unless you modify a job afterwards.

Jenkins Crashes after installing GitHub Plugin

I have a question about updating GitHub plugin.
Everytime I do an update plugin such as GitHub and restart the jenkins, Jenkins start crashing. when I try to access jenkins through URL in my browser, the error page shows up with some exception "class not found jenkins/model jenkins" . and then in order to make jenkins working again , I have to delete the plugin entirely from the plugins directory. I wish someone has an answer for this because I really need to make my github projects available to jenkins for build. Thanks
It is a very usual problem with Jenkins. My workaround was to either update the jenkins (where ever it is installed) and restarting the hudson service.
sometimes even restarting the service works.
often you might need to remove those plugins from within (/var/lib/hudson/plugins/) and restart the service.

Resources