Reputation: 3160
we have a series of shell scripts at work that I am trying to improve upon by using Jenkins (in order to have much more control and to allow developers unfamiliar with shell scripts to understand and change the process if needed).
I have had no problems with scripts that involved basically checking out the project with SVN, building it with Maven and deploying the war to our container.
But now I am trying to create a Jenkins job to package Linux, Linux x86_64 and Windows installers for our clients. The script does the following:
This script is way too complicated, and there are many redundancies between the Linux, Linux64 and Windows folders. I've imagined an improved process, where I'd use the following folder structure:
libs
|-- unversioned-folder
|-- linux
| `-- specific linux files
|-- linux64
| `-- specific linux x86_64 files
`-- windows
`-- specific windows files
workspace
|-- main-project
`-- versioned-folder
|-- versioned-subfolder1
|-- versioned-subfolder2
|-- unversioned-folder (copied from libs)
| `-- main-project.war (built with Maven from the main-project)
`-- Linux or Linux64 or Windows specific folder (overwritten after each packaging)
That way, versioned folders are not repeated and I can package the Linux, Linux64 and Windows installers without redundancies and just overwriting the specific files for each.
I've been experimenting with Jenkins, and am using the Publish Over CIFS plugin for the first part of the script. But if I continue using the same job, I've realized it would both be too complicated and that most of the steps would happen in the post-build part.
The ideal way would be to break the job into smaller jobs, much like one would call functions in a shell script. Now I'm studying the Multijob plugin.
I'd like to know if it's possible to have this hierarchy in Jenkins, sharing the parent job's workspace:
In case the parent job's workspace cannot be shared among sub-jobs, how could I achieve the same result as the shell script with Jenkins?
Upvotes: 3
Views: 3216
Reputation: 4267
Use the Clone Workspace plug-in to share your .war / files across jobs:
https://wiki.jenkins-ci.org/display/JENKINS/Clone+Workspace+SCM+Plugin
And use Build Flow to parallelize OS specific sub-jobs:
https://wiki.jenkins-ci.org/display/JENKINS/Build+Flow+Plugin
Upvotes: 1