I lost all the jobs folders and configurations on Jenkins dashboard after restarts my Jenkins ubuntu server. But I can see the jobs and all in server at jenkins home path. How can I restore all the jobs on Jenkins dashboard or UI?
If the files are still there, then confirm that the setting of the Jenkins home directory matches what you expect. “Manage Jenkins” → “Setttings” displays it as the first item on the page, under the heading “Home directory”.
You could use the Jenkins script console (“Manage Jenkins” → “Script console”) to show the files in the Jenkins home directory and their permissions with a command like:
When I run that command on my Jenkins controller with my Jenkins home directory, it reports the contents of the directory as expected, with all files and directories owned by the user jenkins with permissions as expected.
Could you please help me with a solution? After restarting the Jenkins server, I’m encountering an issue where all of my pipelines are missing from the UI. However, I can still see my code and job files in the Jenkins home directory. How can I restore my old pipelines to the Jenkins dashboard?
When starting jenkins will read the content of the jobs folder from its home directory. So the first thing you need to do is confirm the the home directory is indeed the same as what you expect.
So go to the /manage/configure url, or Manage/System from the UI, and at the top it should show what it is configured to use as its home directory. In my case /var/jenkins_home.
It that’s the same, then you need to confirm that the user used by the jenkins controller has full read/write access to all the files in that folder.
Note that all the pipelines are configured through config.xml files in subfolders of $HOME/jobs. You can test if the controller can read the files with the command from @MarkEWaite in the controller’s script console. I’ve included a slightly more generic and comprehensive version:
home = System.getenv("JENKINS_HOME")
println("JENKINS_HOME: ${home}")
println "ls -altr ${home}".execute().text
jobs = "${home}/jobs"
println("jobs: ${jobs}")
println "ls -altr ${jobs}".execute().text
Hello, Thanks for the reply.
I’ve tried it, however the dashboard still doesn’t show my old pipelines. Could you please let me know if any solution exsists?
are all jobs lost or just pipeline jobs?
Do you have any plugin loading errors? if the plugins for pipeline are not loaded you will not see the jobs.
Do you see anything in the logs of Jenkins telling it couldn’t load the jobs?
We lost pipeline jobs, in the Manage plugin tab, all installed plugins are failed to load.
In the logs, we are seeing unable to read/var/lib/jenkins/jobs. here is the screenshot for your reference.
Yes, your issue is not that the controller cannot find the configs, but that it cannot load them since they reference plugins that are not being loaded. You need to fix your plugins issue first then your pipelines should be able to load.
I would recommend that you ensure that your controller instance is on the latest LTS release, and then get all your plugins updated. If you are having trouble with plugins conflict you could move your $HOME/plugins folder to the side and use this tool to re-install the latest plugins that are compatible with the installed version.
This tool can be helpful if you end up installing plugins versions that have compatibility issues.