We have moved build system from CruiseControl to jenkins for a multi-platform product. This was a single monolithic job:
1. check for changes
2. update product build number in properties file
3. commit file to subversion
4. pass svn revision number to other platforms for local checkout (performance reasons)
5. build (C++, Java)
6. test
In Jenkins, we have split the build and test into 2 jobs, build triggering the tests. All platform builds have to succeed for tests to run. I'd like tests on platform A to run regardless of build failure on platform B, but that's a different issue.
The problem I'm trying to address now is for the build phase. When Jenkins starts, it knows the SVN_REVISION of the repository at start of job. We increment the build number before the compilation during the job and it is this svn revision we need to pass to downstream jobs. We need to ensure the same revision is checked out on all platforms and that the test job also checks out same revision. The compilation takes 2-3 hours and testing about 7 hours, so it is normal enough for some new commits to happen during the build that will be included in test job. We have also had commits during build phase that get included in one platform but not the others due to different speeds of checkout.
We have tried Parameterized Trigger plugin which can pass SVN_REVISION - the revision at time job started, but does not pass the revision of modified file with build number. We use Parameterized Trigger in other cases and it does what we need.
One thing I am thinking of doing to add svn revision number to properties file. I could read the revision from the property file in other jobs, assuming file has not been changed, which could be risky. svn uses ':' to separate property, IIRC, other properties use '=' for key=value as we also read properties to be used in shell scripts. There are other dependent projects, so I'll try this when I get back to office and set up a sandbox (half day's work).
Anyone got any recommendations or comments?
Thanks to this post and the comments below: https://itisatechiesworld.wordpress.com/jenkins-related-articles/jenkins-configuration/jenkins-passing-a-parameter-from-one-job-to-another/
Here is the answer that worked for me:
In short (Parameter must be specified in BOTH jobs) JOB_1 => SVN_REV=${SVN_REVISION}
JOB_2 => Add SVN_REV as a String Parameter, to access type %SVN_REV%
I think the Clone Workspace Plugin would work well for you. It allows you to clone the workspace so another job can use it. Using this, I would configure my jobs something like this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With