Jenkins slave agent service do not work since java update (which removed medium security level) - jenkins

Situation:
Yesterday morning, all of our Slaves had problems (because thanks to Java, which removed the medium security level, the Jenkins slave agent could not be launched anymore). Java then started blocking all Jenkins slave agent.jlnp, we had to add on every slave an exception for our jenkins server, so the slave application can be launched. This was annoying but now they work. (was there an easier solution?)
Few slaves had Jenkins installed as a service (to be launched automatically on startup). However, since yesterday, they do not launch anymore, and we cannot find why. It probably has to do with the security from Java.
Someone has any idea?

You need to update jenkins reference to Java. It is in file C:\Jenkins\jenkins-slave.xml (or whereever is your Jenkins folder). When you updated Java Jenkins no longer knows where to find new version
Mine looks something like this.
<executable>C:\Program Files (x86)\Java\jre1.8.0_91\bin\java.exe</executable>

I made it works with the following steps:
1-) Uninstalling service
2-) Reboot
3-) Installing service
4-) Reboot

Related

Jenkins on Kubernetes node is complaining its plug-ins need newer version of Jenkins, but don't want to lose data

Jenkins (on a Kubernetes node) is complaining it requires a newer version of Jenkins to run some of my plug-ins.
SEVERE: Failed Loading plugin Matrix Authorization Strategy Plugin
v2.4.2 (matrix-auth) java.io.IOException: Matrix Authorization
Strategy Plugin v2.4.2 failed to load.
- You must update Jenkins from v2.121.2 to v2.138.3 or later to run this plugin.
The same log file also complains farther down that it can't read my config file... I'm hoping this is just because of the version issue above, but I'm including it here in case it is a sign of deeper issues:
SEVERE: Failed Loading global config
java.io.IOException: Unable to read /var/jenkins_home/config.xml
I'd either like to disable the plug-ins that are causing the issue so I can see the Jenkins UI and manage the plug-ins from there, or I'd like to update Jenkins in a way that DOES NOT DELETE MY USER DATA AND JOB CONFIG DATA.
So far, I tried disabling ALL the plug-ins by adding .disabled files to the Jenkins plug-ins folder. That got rid of most of the errors, but it still complained about the plug-in above. So I removed the .disabled file for that, and now it's complaining about Jenkins not being a new enough version again (the error above).
Note: this installation of Jenkins is using a persistent storage volume, mounted with EFS. So that will probably help alleviate some of the restrictions around upgrading Jenkins, if that's what we need to do.
Finally, whatever we do with the plug-ins and Jenkins version, I need to make sure the change is going to persist if Kubernetes re-starts the node in the future. Unfortunately, I am pretty unfamiliar with Kubernetes, and I haven't discovered yet where these changes need to be made. I'm guessing the file that controls the Kubernetes deployment configuration?
This project is using Helm, in case that matters. But again, I hardly know anything about Helm, so I don't know what files you might need to see to make this question solvable. Please comment so I know what to include here to help provide the needed information.
We faced the same problem with our cluster, and we have a basic explanation about that, but not sure about it (The following fix works)
That error come with the fact that you have installed Jenkins via Helm, and their plugins through the Jenkins UI. It works if you decide to never reboot the pod, but if one day, jenkins have to make his initialization again, you will face that error.
Jenkins try to load plugins from the JENKINS_PLUGINS_DIR, which is empty, so the pod die.
To fix the current error, you should specify your plugin in the master.installPLugins parameter.
If you followed a normal install, just go on your cluster and
helm get values jenkins_release_name
So you may have something like that:
master:
enableRawHtmlMarkupFormatter: true
installPlugins:
- kubernetes:1.16.0
- workflow-job:2.32
By default, some values are "embedded" by helm to be sure that jenkins works, see here for more details: Github Helm Charts Jenkins
So, just copy it in a file with the same syntax and add your plugins with their versions. After, you have just to use the helm upgrade command with your file on your release:
helm upgrade [RELEASE] [CHART] -f your_file.yaml
Good luck !

Jenkins detecting more than one instance

I realize that this question has been asked before but I feel like my case is different.
About five hours after I launch jenkins I sometimes see this message appear when loading the jenkins administrator panel:
Jenkins detected that you appear to be running more than one instance of Jenkins that share the same home directory '’. This greatly confuses Jenkins and you will likely experience strange behaviors, so please correct the situation."
This is strange, it happens every time I launch it, eventually making Jenkins unusable. I installed Jenkins via homebrew and launch is via the jenkins CLI. I manually do this so I don't see how it's possible that Jenkins launches twice.
I reinstalled Jenkins after completely removing it. Still no luck.
Anyone have any issues like this before?
I also had a similar problem and solved it with following checks:
Check if another java process is running which runs jenkins e.g. in unix using top
If you're using tomcat, search for a second instance of tomcat having the jenkins.war exploded somewhere
Could be helpful to just have one version of java installed

Jenkins stuck at editing/creating nodes

I created a slave node and ran a pipeline successfully but after that unable to configure the node. I've tried restarting Jenkins using the weburl as well as the shell. At this point, its stuck at creating a new Node or even when configure is clicked. The page just never opens. Deleting an existing node worked however.
Even the Mutli-Slave config plugin runs into the same problem. I'm guessing some data corruption? It would be a shame to reinstall Jenkins and redo the awful amount of configuration. Any ideas?
I was just beginning to like Jenkins.
PS: Editing the master node works. Using Jenkins 2.5.
EDIT:
I manually created a folder for a node under JENKINS_HOME/nodes and copied a config.xml for the node from some other server. The node appears in the list after server restart but still the option to Configure it hangs forever.
After wasting a lot of time I finally fixed the issue by downgrading Credentials plugin to the previous version: 1.28. Earlier today I had upgraded to the available latest 2.0.
Looks like others also hit the same problem today: https://github.com/jenkinsci/credentials-plugin/issues/49

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.

Jenkins Update Loses Old Jobs

I am on a redhat linux box. I recently updated Jenkins to version 1.509 only to find that after doing so it has "forgotten" two of my jobs/projects. The jobs can still be found on my Jenkins machine under /var/lib/jenkins/jobs, but they no longer show up in the Jenkins GUI. I attempted to re-create them based off the configuration file I have, but I am not confident I have totally re-created the functionality they had.
I also tried to copy the job and or rename it hoping that would get jenkins to see it, but no luck. I had tried cp -r /var/lib/jenkins/jobs/JOB1 /var/lib/jenkins/jobs/JOB2. I also restarted the service a number of times. Finally I updated all of my plugins on the off chance that was somehow related.
So my question is "How can I get Jenkins to notice these jobs?" or failing that "can I run these jobs from in the terminal?"
NOTE: I am not discouraging others from upgrading Jenkins. After I upgraded Jenkins did complain about a number of things which I didn't pay enough attention to which I believe got me into this mess in the first place.
If I were you, I would try the Jenkins CLI (from $JENKINS_URL/cli) and use the create-job command and feed the job configuration file to the cli's stdin.
If that does not help, I would inspect Jenkins log files (you are saving stdout and stderr of Jenkins somewhere, right?) for any errors or clues. If the job failed to load because of some tag that you can guess is provided by a plugin, try to remove that part from the config file.
If that does not help, I would upgrade Jenkins. I think there might be some fixes related to this in the LTS version changelog since 1.509.
And above all... if I were you, I would start making backups of the job configuration files.
I regularly back up the global config.xml, all the job config.xml files and all the plugins. Using these I can set up my Jenkins from scratch. And I do that to set up a test instance where I try any plugin or Jenkins core upgrade. If I see no problems after running a few of the trickiest builds, I know I can upgrade the production instance with much more confidence.

Resources