Skip to end of metadata
Go to start of metadata

Job Import Plugin

Plugin Information

View Job Import on the plugin site for more information.

Import jobs from another Jenkins instance. 


 

Changelog

3.0 (May 30 2018)

  • Requires 2.107.3 Jenkins
  • Replaces URL by Apache Http Client
  • JENKINS-48174 Request scope instead of global
  • JENKINS-48173 Overall/write or write access at the top folder level is not required anymore
  • JENKINS-20877 Automatically install necessary plugins when importing jobs
  • JENKINS-51119 Permit updating of existing jobs on target server
  • JENKINS-10964 Allow picking the Jenkins instance from which jobs have to be imported from a drop-down list (configured at global configuration)

2.1 (Oct 26 2017)

  • JENKINS-35540 Upgrade to Credentials 2.1.0+ API for populating credentials drop-down

2.0 (Oct 10 2017)

  • JENKINS-23809 Allow selection of a destination folder
  • Import folders and jobs inside
  • Improved performance after saving remote jobs
  • Minor fixes

1.8 (Jul 11 2017)

  • JENKINS-45195 Import job fails when user lacks overall / administer.

1.7 (Jun 09 2017)

  • JENKINS-40577 Error on Import - java.lang.NoClassDefFoundError: com/google/inject/internal/guava/base/$Preconditions. Credentials.

1.6 (Dic 01 2016)

  • JENKINS-35983 Add support to job import jobs in folders.
  • Better testing utilities.

1.5 (Sep 13 2016)

  • JENKINS-38084 Add support to mark jobs as disabled on import.
  • PR7 Credentials.
  • PR14 Parent pom upgraded

1.3.1 (Apr 01 2016)

1.3 (Feb 25 2016)

1.2 (Dec 04 2013)

1.1 (botched)

1.0 (released 2011-07-20)

  • fully I18N
  • initial implementation

35 Comments

  1. Hey Man, it's great plugin! Thanks

    Just a suggestion: add support to import jobs from no-anonymous access remote Jenkins instance.

    Many thanks for your work.

    1. You're welcome, and thanks! Yes, this is on my TODO list for when I get some more time to work on the plugin.

      1. Hi Jesse,

        We've implemented it (as part of the changes we discussed on the ML in July). Let me just a week to review and test everything, and I'll send a pull request.

  2. Really interesting plugin.
    But... I can suggest a use case which could be covered by this plugin

    • Job renaming
      When a global build chain with a lot of jobs is duplicated either onto the same instance, or onto another one.
      For example, this can occur when several releases are developped in parallel.
      The GUI could ask for
      1. the string to replace
      2. the new string

    And the job selection should also offer the possibility to select jobs via a pattern.

    1. Thanks!

      Job rename is something I'd like to support, both globally and also per-job (ideally the user would click in the name box and could overtype the job name to perform an import-with-rename type of action).

      Feel free to create a new JIRA issue to track progress of this.

      1. We've also implemented that. As said in my comment above, just give me a week (I will create ERs in JIRA in the meantime).

  3. I input 

    http://<site>

    or

    http://<site>/view/Gerrit/view/edream4.0/job/Gerrit_edream4.0-Nfc-Handover/

    cannot work 

    1. Please create a new JIRA against job-import component. You will also need to provide what http://<site>/api/xml gives as well what http://<site>/view/Gerrit/view/edream4.0/job/Gerrit_edream4.0-Nfc-Handover/api/xml gives.

      Thanks!

  4. I hope this is the right place - what do I do if the source Jenkins requires user/password to read the config XML? currently it returns a 403 access denied to the import plugin, who in turn falls on NullPointerException.

    Thanks

    David

    1. There's a planned item to allow [x] Use existing browser session (via AJAX) so if you're logged into the remote Hudson/Jenkins already then you can use that link instead of server-side java.net.URL request. Feel free to create a new JIRA issue to track the progress of this..

  5. This would be an awesome plugin.  I appreciate your work on it, but it doesn't work.  It just gives me a null pointer exception.

    1. Can you open a new jira against job-import component? Thank you!

    2. same issue:

      java.lang.NullPointerException
        at org.jenkins.ci.plugins.jobimport.JobImportAction.doImport(JobImportAction.java:126)

      1. I'll repeat this once more, if you're having a problem with the plugin then open a new JIRA issue. Do not bother with reporting this on a wiki page, it will be ignored.

  6. Hi,

    can anyboduy explain what dose Tokan API mean to be inputed for this plugin ?

    1. Applicable where required to be authenticated, instead of using password ... while logged in, click your username (top right), then click "Configure", you should see box labelled "Show API Token".

      The value displayed there is the one that would apply.

  7. Really helpful plug-in for job migration. But, the perforce configurations are not getting imported. Anyway to get that done ?

  8. Just curious, but why is the password field visible?

  9. Do we have any API for this ?

    I don't want to do it via jenkins UI since we have a requirement to automate the import/export in multiple jenkins instances . So that i can do the import export via CLI . 

  10. The idea behind the plugin is very useful. However, I have a question.
    Does the plugin only imports the job config.xml? What about other dependencies such as plugins, scriptler scripts and other. Is this left up to the user?

    Thank you
    Ioannis

    1. I too have this question - it this plugin just importing config.xml or is it doing additional configuration?

      1. Just config.xml currently

  11. Wondering if anyone has ran into the issue where import plugin stops working after using the URL a certain number of times for the Jenkins instance we're trying to import from. We have to use the IP address instead to get the plugin to work. Unsure if this is a firewall issue on our end or something else. 

  12. The plugin was useful for me today, but on importing the job,  maybe there should be a note on why we would want to "diable" before migrating as once it's migrated, the jobs will kick off, not handy when you're importing more than one job.   SO note: If you dont click on disable, the job will automatically run when imported. 

  13. Hi All,

    by using this plugin, I am able to move jobs successfully. But I need to move the particular jobs config,plugin and others which are related to the Job. How to do that.. please help me on this.

  14. Hi there,

    Just upgraded to v3.0 and it's a pain:

    [Fatal Error] :10:3: The element type "hr" must be terminated by the matching end-tag "</hr>".
    Aug 08, 2018 8:47:06 AM org.jenkins.ci.plugins.jobimport.client.RestApiClient getRemoteItems
    SEVERE: Failed to list job from remote http://whatever:8080/
    org.xml.sax.SAXParseException; lineNumber: 10; columnNumber: 3; The element type "hr" must be terminated by the matching end-tag "</hr>".
        at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown Source)
        at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown Source)

    What is supposed to be the URL? Should it include the / or not ?

    1. I installed the plugin today & seeing same error the "/" makes no difference, did you ever resolve the issue?

  15. Just installed today. Can't find anything in the docs about how to add "Jenkins Server" so that the dropdown shows something (right now it's empty). 

    Please update the docs about it.

    1. One can add Jenkins servers in Jenkins → Configure System (http://localhost:8080/configure)

  16. Just installed the plugin today, getting an error I cant explain:

    Failed to list job from remote https://xxx.xxx.xxx.com/MOAB_Support_Tools
    org.xml.sax.SAXParseException; lineNumber: 10; columnNumber: 3; The element type "hr" must be terminated by the matching end-tag "</hr>".

    I've logged into the remote box and inspected the config.xml for the folder and all the jobs within it, no <hr> tag anywhere. 

    I entered  https://xxx.xxx.xxx.com on the config page as the remote instance, anybody got any ideas on where I should look next?

  17. Hi, got a similar Problem

    [Fatal Error] :11:28: The entity name must immediately follow the '&' in the entity reference.
    ERROR: 'The entity name must immediately follow the '&' in the entity reference.'
    Aug 21, 2018 11:24:42 AM org.jenkins.ci.plugins.jobimport.JobImportAction doImportInternal
    WARNING: Job Import Failed: Failed to persist config.xml
    Aug 21, 2018 11:24:42 AM org.jenkins.ci.plugins.jobimport.JobImportAction doImportInternal
    INFO: Failed to persist config.xml

     

    There is no '&' in the config.xml of the Job. Could you help me to fix this.

  18. Has anyone been able to get this to work with a Jenkins instance with SSL enabled (https)?  It doesn't appear to be supported.

  19. why i cant't chose or input ?  how to immigrate the job ? 

    1. esqer yasen ,you need to configure remote Jenkins instance under Job Import Plugin in configure system. This should be done on the instance, you are looking to import the jobs.

  20. Hi while using the plugin between Jenkins Version 1.642.4.2 and Jenkins Enterprise 2.138.2.2 I am getting error "FAILED - Unable to read /var/lib/jenkins/jobs" both instances have version 1.3.1 installed.

    does anyone knows what could be wrong