Same Build number series for multiple projects

54 views
Skip to first unread message

Amit Bhardwaj

unread,
Feb 26, 2016, 8:27:10 AM2/26/16
to Jenkins Users
Hi Group!

I have a requirement where I have 2-3 branches from a common master (say A-dev, B-dev2.0, C-Qa) and I want to run Jenkins for each branch and check stability of my code and binaries. 

Currently I run Jenkins Project for 'master' branch only and with each build I get a iterative next number as my build number (which is default behavior). But now that I have multiple branches to build, I have to use Jenkins for all branches. 

I think I will need to create Jenkins Project for all branches but don't know 'HOW CAN I KEEP BUILD NUMBER SEQUENCE" as same.

Please let me know how can I achieve this. 

Regards
AB

Victor Martinez

unread,
Feb 26, 2016, 10:04:14 AM2/26/16
to Jenkins Users
Hi,

 You don't need to use Capital Cases at all, lower cases are in good shape and easy to read.

 Coming back to your questions:

 - https://wiki.jenkins-ci.org/display/JENKINS/Build+Name+Setter+Plugin might help you to set those numbers based on token/attributes

I hope it helps

Amit Bhardwaj

unread,
Mar 1, 2016, 2:25:22 AM3/1/16
to Jenkins Users
Hi, 
Thanks for the reply. I went through those links. I believe my requirement is a bit different from those. 

I would need a universal sequence/build number which can be used by multiple projects in Jenkins. 

Regards
AB 

Michael Giroux

unread,
Mar 1, 2016, 10:33:07 PM3/1/16
to Jenkins Users
If you want to share a single build number over all branch builds, you will want to configure your job to accept a branch name to be built.  Then run as a parameterized build and specify the branch to build.  This will give you build numbers like this:

master: 1
master: 2
branch-a: 3
branch-b: 4
master: 5
branch-b: 6
...

Is this what you want?

Amit Bhardwaj

unread,
Mar 2, 2016, 1:07:18 AM3/2/16
to Jenkins Users
Hello Michael, 

I really appreciate that you found time to answer my query. 

But, my requirement is to have separate projects in jenkins. I run various integration tests after building binary. Idea is to do the same for all new branches. I have setup cron to run these builds. 
If I keep it parameterized, I believe I will have to run the builds manually with new branch name everytime which is not intended. 

Regards
Amit 

Michael Giroux

unread,
Mar 2, 2016, 8:30:27 AM3/2/16
to Jenkins Users
Perhaps you could:
1. setup separate build for each branch, each job has a parameter to specify the build number
2. setup master job that has parameter to specify which branch to build.  This job will have a build number that increments. This job starts the desired branch build passing the current build number in as a parameter.

Amit Bhardwaj

unread,
Mar 3, 2016, 4:47:25 AM3/3/16
to jenkins...@googlegroups.com
I am thinking of trying an unconventional way. I can put current build # in a file. Read that file on next build # and +1 it. All the projects can use this file for their build # and this approach wont need any manual intervention to supply build # as parameter. 

Not sure but worth a try as I feel. will share if that works. 

This email has been sent from a virus-free computer protected by Avast.
www.avast.com

--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-users/3_eFjRFdpsk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/ceffca55-aae6-4a51-80b1-2d36ffea7d8e%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Regards
Amit Bhardwaj

Amit Bhardwaj

unread,
Mar 11, 2016, 1:15:27 AM3/11/16
to Jenkins Users
Hello all, 

I ultimately figured out a way.. Infact, I change the approach from having multiple projects and kept it to a single project at Jenkins level. 
I declared few params in project as BUILD_BRANCH and PUSH_BRANCH. 
Next, I setup a cron job which passes these params in a CURL based query with credentials, job_name and token. 

Thanks for all the support anyways. Helped me figured out a much scalable approach.  

Regards
Amit 
To unsubscribe from this group and all its topics, send an email to jenkinsci-users+unsubscribe@googlegroups.com.



--
Regards
Amit Bhardwaj
Reply all
Reply to author
Forward
0 new messages