Job import Plugin not working

The Jenkins version we use in CentOS 7 is 2.263.4 and the Job Import plugin version we installed is 2.1. We entered the correct Remote Jenkins URL and used the right credentials (also tried other credentials) and when clicked on !Query, the page reloads but the job doesn’t seem to be imported. Hoping for some help on this.

Try taking a look at your browser console, and your Jenkins server log. Maybe either will shed some light. I recommend opening a ticket with your findings.

It hasn’t seen a release in 2 years so it’s possible it’s just broken by changes in Jenkins.

That said, Jenkins jobs are just the filesystem. You can copy the definition (jobs/**/config.xml) or even the entire jobs folder from one server to the other without the plugin

When I first came across the job Import plugin description, I thought it would solve so many of my problems. Unfortunately, the plugin seems to lack much documentation and is quite rough around the edges, especially when interacting with folders and also in terms of providing user feedback.

The page simply reloading w/o providing an error response is a good example of lack of feedback. If you have access to the System logs or can set Log Recorder, you may glean more information (see below).

But, if you figure out how to work around the constraints and input nuances, then you should be OK. Two very helpful pieces of information are these Stack Overflow posts:
[valdeci- How to use job import plugin in jenkins](amazon web services - How to use job import plugin in jenkins - Stack Overflow) covers the basic installation and usage. My post Job Import Plugin doesn’t import folder details how to work around the "Error ‘/’ unsafe character " issue.

Major [a]nu[y]ance still for folders is you must specify source as [job/Folder1/job/Folder2] and the target [Folder1/Folder2] must exist to import the jobs into folder for now. Also, if you specify a source path and query, then it does not show the path in the resulting page, only the jobs. If you get an error, it resets the query dialog options back to the first option.

There is a PR Bugfix/jenkins 64121 #31 that addresses the unsafe character error which I have tested and works, though some of the other issues remain (esp. progress feedback).

Would be nice if the registered maintainer, Cloudbees Emilio Escobar could be persuaded to accept the PR and some of the others and make a new release (or if someone stepped up to adopt? ).

The plugin does not log any progress in the system logs as there are only two logging events in the plugin. An useful improvement would be “Plugin requires Better progress logging”, preferably to the UI, like a regular job does, as well as the System logs.

There is another JENKINS-57991 - Improve the error message when the credentials of the… #27 which could also help.

You can set a Log Recorder with:
org.jenkins.ci.plugins.jobimport.client.RestApiClient or o.j.c.p.j.client.RestApiClient to get the SEVERE connections errors flagged in JENKINS-57991.

System log errors message may include (correct url is http://jenkins1/j-root and folder: job/admin):
(missed /j-root in plugin configuration)

SEVERE  o.j.c.p.j.client.RestApiClient#getRemoteItems: Failed to list job from remote http://jenkins1/admin
java.net.UnknownHostException: jenkins1: Name or service not known

(missed job/ in source folder)

SEVERE  o.j.c.p.j.client.RestApiClient#getRemoteItems: Failed to list job from remote http:/jenkins1/j-root/admin. Response status code received 404. Content: <html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 404 Not Found</title>
</head>
<body><h2>HTTP ERROR 404 Not Found</h2>
<table>
<tr><th>URI:</th><td>/j-root/Folder1/api/xml</td></tr>
<tr><th>STATUS:</th><td>404</td></tr>
<tr><th>MESSAGE:</th><td>Not Found</td></tr>
<tr><th>SERVLET:</th><td>Stapler</td></tr>
</table>
<hr><a href="https://eclipse.org/jetty">Powered by Jetty:// 9.4.33.v20201020</a><hr/>

Hope all that helps some!