What you ask for (i.e. keep the build number the same between multiple jobs) is simply not possible in Jenkins. This is done by design (as the creator of Jenkins himself noted): "[JENKINS] assumes that the build number is unique and monotonic." . You can change it to a higher value, but changing it to the same number will lead to a simple Jenkins break and therefore impossible.
The run number line is simple: run number.
It must be consistent.
This is not a version number.
There are several ways to get version information in the build history.
Description of Setter Plugin
This is what I use. It does not change the build number, but rather a description that runs automatically. In addition, since this is a description, it can also be changed manually at any time.
Here's what it looks like:

Note that builds #50 and #51 actually have the same version 1.3.0.394376 .
On this line, version 1.3.0 is the current release number, as determined by the project properties, and 394376 is actually the SVN revision number obtained from the $SVN_REVISION_1 build variable. Therefore, every time a new commit appears in SVN, I get a new revision number. But if there are no commits, and the work is reconstructed for some reason (for example, in #50 and #51 ), my version number remains the same as there was no code change.
Setting method:
- Download Description Setter Plugin
- Somewhere in the Steps to create, print your version *
- I just have:
echo Version is: ${internalVersionNumberFromWherever}.${SVN_REVISION_1} - Next Setting Post-Build Action with Build Description
- Setting Regular expression to retrieve the version number from the console:
Version is: (.*) - Leave everything else empty and everything RegEx picks up in
(.*) Will be used as a description. - Alternatively, you can optionally set the Description text as
Build - \1 . Where \1 is a reference to the first group (.*) From RegEx. - At any time, you can manually change the description of the run by selecting the assembly run from the assembly history and clicking the "edit description" link on the right (provided that the user has configured the "Update" permissions).
* Please note that if your assembly failed with an error before the stage that displays the version text, the description installation plugin will not be able to raise it. If you always want to see the version, set the version number as the very first step.
Script Name Installation Plugin
This plugin will actually change the build number

Nevertheless, remember the restriction that each assembly number must be unique .
The best way to ensure that you add ${BUILD_NUMBER} to any arbitrary number you want (for example, in the image above). Thus, you can create numbers like 50.123 , and then 50.124 , where 50 is your version, and 123 and 124 are serial numbers of the serial assembly, and Jenkins is sure that supports ${BUILD_NUMBER} unique.
Finally, there is a Version Number plugin that I have not personally tried, but this may help you.