11

I don't have access to both servers so cli is not an option only jenkins ui is available. I need to import jobs using job import plugin but i am unable to figure how to configure the plugin so as to import jobs. Could anyone please help me with this.

0

3 Answers 3

24

To configure the Jenkins Remote Plugin, you need to add a Jenkins Server to import your jobs.

Setting up a Jenkins Server

To add a Jenkins Server, you need to go to your Jenkins configuration: Manage Jenkins > Configure System > Job Import Plugin or http://jenkins-host:port/configure and add the URL and credentials to the host from which you will import the jobs.

Jenkins Server Configuration

If you don't have credentials, you'll need to add them to this server. To do this, click on the Add option below the URL settings.

Adding Credentials

Using the Jenkins Import Plugin

After setting up a Jenkins server, you will be able to use the Jenkins Import plugin by going to the Job Import Plugin option on the Jenkins home page or by navigating to the URL: http://jenkins-host:port/Job-import/ or http://jenkins-host:port/job-import/ in newer versions.

If you added only one Jenkins Server, it will be selected by default. Otherwise, you'll need to select the correct Jenkins server:

Selecting Jenkins Server

Normally, you don't need to set the Remote folder or Search into folders options, so if you use the default Jenkins settings, leave these fields blank.

Then, click on the Query! button to start your import. A page with all jobs available for import will be shown.

You'll need to select all the jobs you want to import one by one. If you have many jobs (like in my case), this can be a bit tedious. It's a good idea to select the Install required plugins option as well.

Selecting Jobs to Import

After selecting everything, you can click on the Import! button to finally start your import.

Sign up to request clarification or add additional context in comments.

7 Comments

I have this all set up but it's not pulling any folders, whether I select "search into subfolders", enter a folder name, or any combination of those. Where should I check for an error?
@MaxCascone you should take a look on Jenkins' error log file. Normally on /var/log/jenkins/jenkins.log. For more information about the Jenkins logging take a look on wiki.jenkins.io/plugins/servlet/…
What about credentials and other plugin configurations (if we choose to install plugin)?
This is cool, I am able to import all my jobs. Thanks for detailed steps.
@valdeci Done !
|
1

In my case, I was getting below error (401 Unauthorized) the username:password configuration worked only after setting a new API token on a the source jenkins instance and using it as 'password' in the target instance credentials. Pretty much all other answers cover the configuration of the plugin.

Failed to list job from remote http://{remoteIP}:8080/. Response status code received 401. Content: <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/> <title>Error 401 Unauthorized</title> </head> <body><h2>HTTP ERROR 401 Unauthorized</h2> <table> <tr><th>URI:</th><td>/api/xml</td></tr> <tr><th>STATUS:</th><td>401</td></tr> <tr><th>MESSAGE:</th><td>Unauthorized</td></tr> <tr><th>SERVLET:</th><td>Stapler</td></tr> </table> <hr/><a href="https://eclipse.org/jetty">Powered by Jetty:// 9.4.45.v20220203</a><hr/> </body> </html> 

Also if wondering where to check logs, it's http://<your_jenkins_ip/domain>:8080/logs/all

1 Comment

I have the same issue. Gave user as admin but still get 401.
0

Follow below steps to import jobs using UI -

  1. You need to install job import plugin on the server where you need to import jobs to.

  2. Then go to the plugin displayed on left side of jenkins.

  3. Enter url and authentication and jobs will be listed of remote server.

  4. Select the jobs to be copied and done. Jenkins will copy the jobs to your server.

Refer this link

2 Comments

Since version 3.0 of the plugin, the URL and the authentication details need to be configured in the Manage Jenkins -> Configure System -> Remote Jenkins server configurations.
Thanks @coz . I couldn't figure out what I was missing. That's just what I needed.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.