Skip to main content

How can I copy jobs from one folder to another?

Comments

13 comments

  • Bleacher Report

    No Screenshot found.....

    0
  • Michael New

    It would be good if this were answered.  I see other questions on the internet but the version of jenkins is different and the options available are different.

    0
  • Arnaud Héritier

    Michael I fixed the screenshot. Does it helps more ? What would we improve ?

    0
  • Michael New

    It helps, but the move functionality did not work in my case...

    0
  • James Brown

    Hi Michael, I've just created a ticket for us to follow up with our engineers. You should be receiving an email momentarily. 

    0
  • Steven Christenson

    The question was how to "copy" not "move". So unless "move" is really a copy... then this doesn't answer the question.  However. the missing bit of information is that the pulldown is "Move/Copy/Promote" and once you get the target named, you have three options "Move", "Copy" and "Promote".  I tried this using Jenkins operation center and it ... Worked though it took a long time.  Apparently it first analyzes the job to see if the plugins on the from are compatible with the "To". Then it took a very long time to transfer.  Perhaps because it also copies all the build results.
    Above is the set up to copy from one of our Jenkins to another in the Jenkins Operation Center.




    0
  • Satender Ruhil

    Hi Steven Christenson,

        I am facing issues in copying a job from 1 Jenkins instance(1.64) to another Jenkins instance(2.4). The Job is copied but some of the configurations like SCM configuration, gerrit event configuration are not present. Even shell commands are missing. Is it Jenkins Version which is preventing it from reading job of older Jenkins ??

    0
  • Denys Digtiar

    Hi, Satender,

    The first thing to check is that target master has all the plugins that are required for the project or simply all the same plugins that source master has.

    If you are a CloudBees customer, feel free to raise a support ticket.

    0
  • Thomas kaj Bonfils

    Create a new item and select "Copy From".

     

    In the input field, you have to provide the full path, stating with a slash, e..g

    /SourceFolder/MyJob

    0
  • Allan Burdajewicz

    That's right Thomas. One difference though is that the Copy From feature only copy the job configuration.

    0
  • Kim Cook

    Which plugin provides the 'Move/Copy/Promote' option?  I don't have that option in my Jenkins UI anywhere that I have searched.

    0
  • Rameshmari Please Update

    How will do this programmatically? groovy script

    0
  • Steven Christenson

    @Kim Cook:
    At the top of this article the requirements are listed. You'll also have to have administrative privilege.

    What is really missing, IMHO, is a way to copy multiple jobs at once. We are migrating jobs from one location to another and we have a folder full of jobs to move to a DIFFERENT folder on the destination. There isn't really an efficient way to do this. You can copy the SOURCE folder as a subfolder on the DESTINATION, but you still then have to move each job from the subfolder up to the DESTINATION folder. Either way, you end up doing one copy for EACH job.

    The other way to COPY (or move) jobs from one master to another is using the cjp-copy-item cli command. It's a little tedious, but it would look something like this:

    `ssh -port 2022 MYJenkins1 cjp-copy-item FOLDER/JOB jenkins://GUID_FOR_TARGET_JENKINS/DESTINATIONFOLDER -e IGNORE_WARNINGS -v`

    Consult the help `ssh -port 2022 MYJenkins1 help cjp-copy-item` for information. The --skip-builds option will make it just copy the job, not the builds which saves a LOT of time in cases where you don't need the build history.

     

    0

Please sign in to leave a comment.

About CloudBees Support

Our Support Engineers are available to help with any questions or problems you may have with any of our products.