Copy generated folder from one job to another in Hudson/Jenkins

16,030

You could try the Copy Artifact Plugin.

Then you could add a build step to "pack-all-together-for-installation-job" that would copy application_home to the packaging directory. There is an option to only include the latest stable build of Project A.


Another alternative is to have a post-build step for a successful Project A build that scripts the copy of the application_home over to where Project B will use it. You can use the WORKSPACE environment variable to get the absolute location. (See here for a list of environmental variables).

Share:
16,030
Caesar Ralf
Author by

Caesar Ralf

Level 13 software developer wizard in eternal quest for the sacred silver bullet. I have been slaying Bad Codes for more than 10 years now, mapping uncharted requirements, and creating service towers by using +5 frameworks to help on my quest.

Updated on June 21, 2022

Comments

  • Caesar Ralf
    Caesar Ralf almost 2 years

    I have two jobs in my Hudson configuration. Let's call them A and B.

    Job A was created specifically to generate a folder application_home. This folder is a ready-to-be-used-in-installations-application-home-folder.

    Job B is the "pack-all-together-for-installation-job". It needs to copy the application_home generated by job A to generate the installer. My problem is that after some investigation, I was not able to do this in a simple way.

    I could use shell script, but then I would need to know job A path plus where its workspace is to get application_ home folder.

    Is there a simpler way to do this?

    EDIT

    I know Copy Artifact Plugin. The problem is that it only copies artifacts. I need to copy the folder application_ home as it is, because it's already in the structure to be used in the installer. If there's a way to use this plugin to copy only the folder, I haven't found it.

    EDIT 2. Answer:

    Ok, you can do it using Copy Artifact Plugin. You need to

    • Set its configuration to "copy from WORKSPACE of latest completed build".
    • Set Artifacts to copy option the folder like this: target/application_home/**
    • Set Target directory to where you want to somethine like: installation_bundle_folder/application_home.

    and it's done :)

  • Caesar Ralf
    Caesar Ralf over 11 years
    I actually tryied Copy Artifact Plugin, but it seems to be able to copy only maven artifacts. jars per say. My application_home is inside the "target" folder of one of the submodules of the project of job A. Do you have any idea how to do this?
  • joachim stephen
    joachim stephen over 11 years
    @RalfHoppen another idea is to script it, though I'd suggest a "push" workflow over a "pull".
  • Caesar Ralf
    Caesar Ralf over 11 years
    Found a way using Copy Artifact. I needed to check "copy from WORKSPACE from latest succesful build" and set the path to the application_home. :)