Re: how to reset build number

179 views
Skip to first unread message

Derrik Ammons

unread,
Jun 7, 2017, 5:58:48 PM6/7/17
to jenkins...@googlegroups.com
pchitale, did you get an answer? I am wondering the same thing. I need to
reset the build number back to 1 if the release version has been
incremented. I have a multibranch pipeline jenkinsfile that kicks off a
build upon commits. When product marketing wants to publish a new release,
the merged code would have gradle file updated for android, and plist files
for iOS with a new version. I read these files after checking out the
source code to see if the build number needs to be reset back to 1. I can't
figure out how to actually set the build number back to 1 from the Mac OS X
agent node building our iOS app.



--
View this message in context: http://jenkins-ci.361315.n4.nabble.com/how-to-reset-build-number-tp1289785p4898876.html
Sent from the Jenkins users mailing list archive at Nabble.com.

Daniel Becroft

unread,
Jun 7, 2017, 7:30:42 PM6/7/17
to jenkins...@googlegroups.com
Would the Next Build Number plugin provide any benefit?


It looks like it allows you to control the build number, but it might need two builds to take effect.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/1496868418893-4898876.post%40n4.nabble.com.
For more options, visit https://groups.google.com/d/optout.

Richard Ginga

unread,
Jun 8, 2017, 8:03:17 AM6/8/17
to jenkins...@googlegroups.com
The Next Build Number only lets you increment the build number. you can't set it back to anything because the build number is a very integral part of how Jenkins works. 

On Wed, Jun 7, 2017 at 7:30 PM, Daniel Becroft <djcbe...@gmail.com> wrote:
Would the Next Build Number plugin provide any benefit?


It looks like it allows you to control the build number, but it might need two builds to take effect.
On Thu, Jun 8, 2017 at 7:58 AM Derrik Ammons <derrik...@gmail.com> wrote:
pchitale, did you get an answer?  I am wondering the same thing.  I need to
reset the build number back to 1 if the release version has been
incremented.  I have a multibranch pipeline jenkinsfile that kicks off a
build upon commits.  When product marketing wants to publish a new release,
the merged code would have gradle file updated for android, and plist files
for iOS with a new version.  I read these files after checking out the
source code to see if the build number needs to be reset back to 1.  I can't
figure out how to actually set the build number back to 1 from the Mac OS X
agent node building our iOS app.



--
View this message in context: http://jenkins-ci.361315.n4.nabble.com/how-to-reset-build-number-tp1289785p4898876.html
Sent from the Jenkins users mailing list archive at Nabble.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscribe@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAJM0iSTeApLLDUW44JtnToFLzXb8E7_xc1Un23WXGPsOt3XxdQ%40mail.gmail.com.

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



--
Dick Ginga
Build Engineer

Dirk Heinrichs

unread,
Jun 8, 2017, 8:12:58 AM6/8/17
to jenkins...@googlegroups.com
On 08.06.2017 14:02, Richard Ginga wrote:

The Next Build Number only lets you increment the build number. you can't set it back to anything because the build number is a very integral part of how Jenkins works. 

But the Version Number Plugin can. It uses its own counter.

HTH...

    Dirk
--
Dirk Heinrichs
Senior Systems Engineer, Delivery Pipeline
OpenTextTM Discovery | Recommind
Email: dirk.he...@recommind.com
Website: www.recommind.de

Recommind GmbH, Von-Liebig-Straße 1, 53359 Rheinbach

Vertretungsberechtigte Geschäftsführer John Marshall Doolittle, Gordon Davies, Roger Illing, Registergericht Amtsgericht Bonn, Registernummer HRB 10646

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden

Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail sind nicht gestattet.

Derrik Ammons

unread,
Jun 8, 2017, 10:19:28 AM6/8/17
to jenkins...@googlegroups.com
I actually have bot the Version Number Plugin and Next Build Number Plugin
and used them both before in jobs before Pipelines came around.

Now that I have a Jenkinsfile for the Mutibranch Pipeline, I am not sure how
to set the Version at build time for Jenkins. I retrieve the Release Number
from source code (e.g 5.0.1) and want to reset the build number back to 1,
if it's a new release (e.g. 5.1.0 (1) for iOS and 5.1.0.1 for Android).

Both the iOS ipa and the Android apk gets the correct release version when
installing the app, opening the app, and checking the about dialog.

But, Jenkins thinks the build is located in the last incremented build
directory. For example, if the previous build was 5.0.5 (24), and the
source code has 5.1.0, the iOS app has 5.1.0.1 but it's the link to the
build artifacts points to build 25 folder, not 1.

It sounds like Daniel Becroft may have an idea... that I might need two
builds to take affect. I may need to reset the build number and launch the
build again. Will it reset the build number back to 1 even though I have 24
existing builds for 5.0.5 in my example above, or do I need to delete them?



--
View this message in context: http://jenkins-ci.361315.n4.nabble.com/how-to-reset-build-number-tp1289785p4898934.html

Dirk Heinrichs

unread,
Jun 9, 2017, 1:41:26 AM6/9/17
to jenkins...@googlegroups.com
On 08.06.2017 14:55, Derrik Ammons wrote:

But, Jenkins thinks the build is located in the last incremented build directory. For example, if the previous build was 5.0.5 (24), and the source code has 5.1.0, the iOS app has 5.1.0.1 but it's the link to the build artifacts points to build 25 folder, not 1.

This is absolutely correct. As I wrote: Version Number plugin uses its own, completely independent counter. Jenkins' counter can't be altered. However, the plugin allows you to assign its value to an environment variable which you can then use throughout your job. We also use this for example together with the Description Setter plugin to display the value of this variable in the build history on the (left side of the) job page.

jer...@bodycad.com

unread,
Jun 9, 2017, 2:17:27 PM6/9/17
to Jenkins Users
Just an idea, but if I understand you well, you may want to split the concept of Jenkins build number and the build number for you application. Maybe an SQLite db (or any other database type) where you could read/write with your main version, and make an incremental entry for the version build number and the related jenkins build number. This way you could keep a track of the matching version without altering the Jenkins behaviors and avoiding Jenkins build number clash.

Using either sh/bat and sqlite command line this should be easy to do. You can also put a cgi or wsgi  web page that could display/search into the db if needed. Keep the db on the master and access it with the master node and this should work.

My new thumb rules with pipeline, if you can do it outside of pipeline script itself it's way easier and robust to do so.
Reply all
Reply to author
Forward
0 new messages