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

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 :)

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).

Related

Jenkins - how to add additional folder with subfolders, e.g. Images

I have a web project that Jenkins is building perfectly and pushing to Octopus Deploy.
I now have an additional folder, with subfolders, e.g. Images, which I need to include.
This is not directly part of the .net build and we used to copy it manually afterward.
Do I need a specific plugin which I can use to select the folder to include?
Which plugin?
Where in the build process does this plugin run?
The build and deploy to octopus is done in one step -
where do I fit in this additional folder to be included in the push to the octopus?
This is not directly part of the .net build and we used to copy it manually afterward.
If your Jenkins server can access that addition folder in a shared path, add a pre-build step which, as an "Executable Windows batch command" step, would copy that folder into the Jenkins workspace.
No plugin needed here.
Once that is done, you would still need to modify Octopus accordingly, to take into account that new copied folder.
See:
"How to add a folder to a nuspec file"
"How to include directories recursively in NuSpec file"

Download full workspace from Jenkins build

I am new to jenkins and I have tried downloading a zip archive of this workspace in jenkins, but I only get a part of it. Source folders like tensorflow or tools are not present inside the archive. Is this normal ?
If so, how do I get all of them inside a zip file ?
Use Archive Artifact plugin, to add your workspace into archive folder which will make it easily down-loadable.
But be aware that, an artifact in the Jenkins sense is the result of a build - the intended output of the build process.
A common convention is to put the result of a build into a build, target or bin directory.
The Jenkins archiver can use globs (target/*.jar) to easily pick up the right file even if you have a unique name per build.
putting a complete workspace into it will take lot of time.

Can JENKINS create build by excluding particular files?

I am actually trying to ignore a particular file to be included in the build. Actually it is a thumb.db file which is automatically created whenever images are encountered in a folder. My solution contains the image folder. So basically, whenever the build is triggered from JENKINS, it will create the thumb.db file.
Is there any way, I can ignore the Thumb.db file from getting created via JENKINS?
I can switch off the thumb.db file from creation by switching it off from my windows, but I have to do it every time a build is created from JENKINS. So I want to ignore the thumb.db file from creation.
Below is the Job creation flow in my JENKINS from my current project:
SCM
I have used the Team Foundation Server Plugin and have mentioned my SERVER URL and PROJECT PATH
POST BUILD steps simply create the build to the staging location(folder Location)
Any help is appreciated.
Thanks,
AFAIK, on windows you can turn it off or on for the whole system and not for particular folders.
So you have to choose. On or off.
If you still want to keep it on, you'l have to handle this in your Jenkins build scripts. Remove any thumbs.db files after build is done.
If your output is an archive, make sure to exclude thumbs.db from it. All archives support an exclude flag.
I hope this helps.

Jenkins: Copying Artifact (directory) from one Job to another

in Jenkins, I have a job downloadAgents that is responsible of creating a folder and populating it with some files. Then the folder is saved as an artifact with the following folder structure
dev\downloadAgents\target\dependency\ios
Then I need to copy the contents of the ios folder into the workspace of another job (into a specific folder).
I have added the Copy artifacts from another project step. And it does copy the artifacts, but it copies the full path
\dev\downloadIosAgents\target\dependency\ios
How can I tell jenkins to copy only one folder ios and everything that is inside it and, do not copy all folders that are before ios.
Also if there are already files in the destination folder, will it merge the 2 folders?
You can use regex for your copy (under "Artifacts to copy")-
dev\downloadAgents\target\dependency\ios***.*
** - all folders under ios
*.* - all file types
You can also specify the target directory, and you also have a flag for "Flatten directories". This will move all the files without the hierarchy of the folders (flat to your target directory)
Feel free to look at the plugin's home page:
https://wiki.jenkins-ci.org/display/JENKINS/Copy+Artifact+Plugin
In CopyArtifacts plugin specify the pattern: \dev\downloadIosAgents\target\dependency\ios\*.* or \dev\downloadIosAgents\target\dependency\ios\** - I don't remember exactly.
That should do the job.

How to set ANT_PATH in Jenkins from outside of the workspace?

My file structure contains src/ folder with the project's source code, and this folder is the one I want to have in the jenkins' workspace.
However, I also have build folder which is needed for apache ant, and it is changing with every single "ant" command executed. The problem is this folder weights over 200mb. I don't want to end up pushing it to the repo everytime I run the "ant" command.
If someone who reads it has some experience with this - what's the best way to do it? Is it possible to pull src/ folder from the repo, and build/ folder from the system? But I guess it will be wrong because this way only I will be able to execute ant command...
What's the best way to set this?
Huh? You put build in your .hgignore file and then you'll not commit that directory or what's in it. That's the usual setup, but maybe I'm missing some nuance of your question.

Resources