Jenkins build history issue - jenkins

I am facing a weird issue after upgrading jenkins to 1.632. After upgrade I am not able to see the build history in jenkins and surprise thing is that history is lost for few jobs. I have reverted back the jenkins but still I am not able to see the history. To make this issue more clear I am running Jenkins on tomcat and I just replace the jenkins.war file in webapps directory. I believe it should not have any impact on JENKINS_HOME location. Is there any way to restore the build history? BTW I also tried the option "reload configuration from the disk" but that is also not working. I am running jenkins on Linux box.
Any kind of help is highly appreciated.
Thanks,
Sanjiv

Related

Jenkins Service vs Jenkins Jar File Permission

I have Jenkins 1.6 installed as a service on a CentOS machine.
At some point in the past the service stopped/crashed/? and Jenkins was restarted from the command line, java -jar jenkins.war, as the root user.
While it was running as root some plugins were updates/installed, and jobs created created/ran. Any new files created are now owned by the root user/group and not by the jenkins user/group.
Meaning, when the service was restarted Jenkins could not read these files. Resulting in plugins not running and most jobs not being loaded.
Manually restoring the permissions(chown, chgrp) to the plugins solves the plugin related issues.
For the jobs it's easy to spot new ones and fix them. Any existing ones that were re run and created new files are more difficult to find.
Then there may be other files which the Jenkins server created, not as part of a job or plugin which need to be changed. The errors are not always obvious, and crop up slowly over time.
Am I better adding the jenkins user to the root group? could this cause issues?
Or manually changing the permissions, hope i got them all! And fix others that come up?
Any suggestions appreciated.
In the end we manually changed the file permissions back to Jenkins. There were some immediate jobs that failed in the following days. And a few which only came up a few months later.
For the most part it worked well.

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

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.

Jenkins - Not Showing Build History

I have a multi-module maven project that I'm building with Jenkins called MyApp. I also have another maven project that depends on MyApp, and this project runs integration tests on MyApp.
In Jenkins, when I view the status of the MyApp project it successfully displays a list of previously run builds and I can click on them to find out more information (and view the console output).
However, the integration test project, while it does build properly, it only displays previously run builds for about 5 minutes, at which point something happens and jenkins completely forgets the build ever ran.
On the filesystem, I am able to cd to:
/usr/share/tomcat6/.jenkins/jobs/My App Integration Test/builds
and ls reveals
me#myserver:/usr/share/tomcat6/.jenkins/jobs/My App Integration Test/builds$ ls
1 2 2013-01-24_16-46-59 2013-01-24_16-51-58 2013-01-24_18-05-09 2013-01-24_18-58-46 3 4
that all my previously run builds are right there, where they should be.
Jenkins has a "discard old builds" feature in its project configuration page, but I obviously have it unchecked.
I'm running jenkins in tomcat6 on Ubuntu.
Help please?
Jenkins has resolved this issue as of 1.505 I recommend everyone upgrade who does not wish to switch from Jenkins back to Hudson.
This can be done through the GUI via Manage Jenkins->Upgrade to Latest (Note for this to work you need to have the appropriate permissions for Jenkins)
More information can be found here For linux users aptitude update or yum update jenkins should also work for you.
I have jenkins running with 1.517, still facing the issue if the number of builds goes more than 65 without discard option. Found that reload configuration bring back the build history.
I've seen this issue and have always been able to resolve it by following these steps:
Going to \\[buildmachine]\C$\Jenkins\jobs\[jobname]
Removing the builds folder.
Removing shortcuts to lastStable and lastSuccessful.
Open file nextBuildNumber and change the number to 1.
Then build new jobs and they no longer disappear.
As mentioned by Dave Bacher, this appears to be a bug in Jenkins. I switched over to Hudson and problem fixed!

Resources