Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to share the BUILD_NUMBER between jobs with Hudson

I have separated a big Hudson job into smaller jobs. Job A does the main build and Job B does another build with a different configuration. I have configured Hudson, so that the A triggers B and that works fine, the problem is that Job A has the original build number and B has started from 1.

My question is: Is it possible to pass the BUILD_NUMBER environment variable somehow from Job A to Job B? The build number is used in the build artifact names, hence it would be nice to have the numbers match between artifacts.

Thanks.

like image 402
kaskelotti Avatar asked Jul 14 '10 04:07

kaskelotti


1 Answers

Use the parametrized Parameterized Trigger Plugin, which will allow you to pass the build number from A to B. You will not be able to actually set the build number in job B, but you will have the build number from A to generate your version number.

If you want to synchronize the build number, you can edit the file nextBuildNumber in the job directory to match the number from job A. Be aware that these numbers will drift apart over the time since when A fails B will not be started.

EDIT I just stumbled across the Next Build Number Plugin. Have a look, If this one helps you.

like image 79
Peter Schuetze Avatar answered Oct 26 '22 17:10

Peter Schuetze