Changing Jenkins build number












99














Is there a way to change the build number that is sent via email after a job completes? The problem is that are product builds are NOT being done by Jenkins, so we want to be able to get the build number(ie. from a text file) and update the build number in Jenkins to match it. I have tried to set the build number:



set BUILD_NUMBER=45


But the email is still showing the build number that Jenkins originally set.










share|improve this question





























    99














    Is there a way to change the build number that is sent via email after a job completes? The problem is that are product builds are NOT being done by Jenkins, so we want to be able to get the build number(ie. from a text file) and update the build number in Jenkins to match it. I have tried to set the build number:



    set BUILD_NUMBER=45


    But the email is still showing the build number that Jenkins originally set.










    share|improve this question



























      99












      99








      99


      21





      Is there a way to change the build number that is sent via email after a job completes? The problem is that are product builds are NOT being done by Jenkins, so we want to be able to get the build number(ie. from a text file) and update the build number in Jenkins to match it. I have tried to set the build number:



      set BUILD_NUMBER=45


      But the email is still showing the build number that Jenkins originally set.










      share|improve this question















      Is there a way to change the build number that is sent via email after a job completes? The problem is that are product builds are NOT being done by Jenkins, so we want to be able to get the build number(ie. from a text file) and update the build number in Jenkins to match it. I have tried to set the build number:



      set BUILD_NUMBER=45


      But the email is still showing the build number that Jenkins originally set.







      jenkins






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Oct 28 '13 at 21:49









      Frederic Close

      7,21424257




      7,21424257










      asked Oct 28 '13 at 21:30









      erman8

      5812716




      5812716
























          6 Answers
          6






          active

          oldest

          votes


















          169














          If you have access to the script console (Manage Jenkins -> Script Console), then you can do this following:



          Jenkins.instance.getItemByFullName("YourJobName").updateNextBuildNumber(45)





          share|improve this answer

















          • 7




            I can verify this works perfectly to solve the problem. I manually copied build history between two jenkins servers, and on the new server nextBuildNumber was wrong. Running this allowed me to set a correct new nextBuildNumber, no jenkins config reload required.
            – Phil Hollenback
            May 24 '16 at 16:59






          • 4




            If you are using the GitHub plugin, "YourJobName" is "organization/repository/branchname".
            – Ruud
            Sep 20 '16 at 15:50






          • 3




            Works. The value can be verified without building using: Jenkins.instance.getItemByFullName("YourJobName").getNextBuildNumber()
            – Daniel Alder
            Mar 15 '17 at 14:51






          • 3




            I can confirm this is also working for MultiBranch-Pipelines. The "JobName" is listed on the top of the branch page: Full project name: PipelineName/BranchName so it would be Jenkins.instance.getItemByFullName("YourPipelineName/YourBranchName").updateNextBuildNumber(45)
            – Markus
            Aug 1 '17 at 14:54






          • 1




            @Quantic meta.stackoverflow.com/questions/356435/…
            – Daniel Alder
            Sep 12 '17 at 13:04



















          34














          can be done with the plugin:
          https://wiki.jenkins-ci.org/display/JENKINS/Next+Build+Number+Plugin



          more info:
          http://www.alexlea.me/2010/10/howto-set-hudson-next-build-number.html



          if you don't like the plugin:




          If you want to change build number via nextBuildNumber file you should
          "Reload Configuration from Disk" from "Manage Jenkins" page.







          share|improve this answer

















          • 2




            No need to use plugin.
            – david.perez
            Oct 7 '14 at 14:19






          • 1




            Thanks, you save my day.
            – カオナシ
            Nov 3 '14 at 20:58






          • 1




            This plugin is good. It's great.
            – AechoLiu
            Jun 28 '17 at 8:29



















          24














          Under the job workspace folder, like:



          C:Program Files (x86)Jenkinsjobsjob_name


          there is a file named nextBuildNumber.



          Setting the build number in the file and reloading the configuration from disk (Manage Jenkins menu) will force the next build you start to have the value from the file as BUILD_NUMBER.






          share|improve this answer



















          • 1




            Didn't work for me
            – hfossli
            Sep 17 '15 at 13:19






          • 7




            Did you reload the configuration from disk (Manage Jenkins menu) after changing the nextBuildNumber file?
            – vezenkov
            Sep 17 '15 at 18:59










          • Nope! I thought it happened automatically.
            – hfossli
            Sep 18 '15 at 8:13










          • This worked perfectly for me. You have to reboot the server before it takes affect.
            – Hawkeye64
            Nov 20 at 17:46



















          4














          Perhaps a combination of these plugins may come in handy:





          • Parametrized build plugin - define some variable which holds your build number


          • Version number plugin - use the variable to change the build number


          • Build name setter plugin - use the variable to change the build number






          share|improve this answer





















          • Thanks a lot - I was able to use one of the plugins.
            – erman8
            Nov 1 '13 at 21:55






          • 6




            @erman8 - Which plugin did you use?
            – randominstanceOfLivingThing
            Jun 18 '14 at 16:26



















          0














          If you have branch name including Forward Slash (using git flow for example), you will need to replace the Forward Slash with its Unicode character %2F within the branch name.



          Here is an example for the pipeline My-Pipeline-Name and the branch release/my-release-branch-name



          Jenkins.instance.getItemByFullName("My-Pipeline-Name/release%2Fmy-release-branch-name").updateNextBuildNumber(BUILD_NUMBER)


          I was able to find out about this by running the following command which will list the different jobs (branches) for your pipeline



          Jenkins.instance.getItem("My-Pipeline-Name").getAllJobs()


          Hope it helps.






          share|improve this answer





























            -1














            By USING ENVIRONMENTAL VARIABLES
            $BUILD_NUMBER =4






            share|improve this answer





















              Your Answer






              StackExchange.ifUsing("editor", function () {
              StackExchange.using("externalEditor", function () {
              StackExchange.using("snippets", function () {
              StackExchange.snippets.init();
              });
              });
              }, "code-snippets");

              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "1"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f19645430%2fchanging-jenkins-build-number%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              6 Answers
              6






              active

              oldest

              votes








              6 Answers
              6






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              169














              If you have access to the script console (Manage Jenkins -> Script Console), then you can do this following:



              Jenkins.instance.getItemByFullName("YourJobName").updateNextBuildNumber(45)





              share|improve this answer

















              • 7




                I can verify this works perfectly to solve the problem. I manually copied build history between two jenkins servers, and on the new server nextBuildNumber was wrong. Running this allowed me to set a correct new nextBuildNumber, no jenkins config reload required.
                – Phil Hollenback
                May 24 '16 at 16:59






              • 4




                If you are using the GitHub plugin, "YourJobName" is "organization/repository/branchname".
                – Ruud
                Sep 20 '16 at 15:50






              • 3




                Works. The value can be verified without building using: Jenkins.instance.getItemByFullName("YourJobName").getNextBuildNumber()
                – Daniel Alder
                Mar 15 '17 at 14:51






              • 3




                I can confirm this is also working for MultiBranch-Pipelines. The "JobName" is listed on the top of the branch page: Full project name: PipelineName/BranchName so it would be Jenkins.instance.getItemByFullName("YourPipelineName/YourBranchName").updateNextBuildNumber(45)
                – Markus
                Aug 1 '17 at 14:54






              • 1




                @Quantic meta.stackoverflow.com/questions/356435/…
                – Daniel Alder
                Sep 12 '17 at 13:04
















              169














              If you have access to the script console (Manage Jenkins -> Script Console), then you can do this following:



              Jenkins.instance.getItemByFullName("YourJobName").updateNextBuildNumber(45)





              share|improve this answer

















              • 7




                I can verify this works perfectly to solve the problem. I manually copied build history between two jenkins servers, and on the new server nextBuildNumber was wrong. Running this allowed me to set a correct new nextBuildNumber, no jenkins config reload required.
                – Phil Hollenback
                May 24 '16 at 16:59






              • 4




                If you are using the GitHub plugin, "YourJobName" is "organization/repository/branchname".
                – Ruud
                Sep 20 '16 at 15:50






              • 3




                Works. The value can be verified without building using: Jenkins.instance.getItemByFullName("YourJobName").getNextBuildNumber()
                – Daniel Alder
                Mar 15 '17 at 14:51






              • 3




                I can confirm this is also working for MultiBranch-Pipelines. The "JobName" is listed on the top of the branch page: Full project name: PipelineName/BranchName so it would be Jenkins.instance.getItemByFullName("YourPipelineName/YourBranchName").updateNextBuildNumber(45)
                – Markus
                Aug 1 '17 at 14:54






              • 1




                @Quantic meta.stackoverflow.com/questions/356435/…
                – Daniel Alder
                Sep 12 '17 at 13:04














              169












              169








              169






              If you have access to the script console (Manage Jenkins -> Script Console), then you can do this following:



              Jenkins.instance.getItemByFullName("YourJobName").updateNextBuildNumber(45)





              share|improve this answer












              If you have access to the script console (Manage Jenkins -> Script Console), then you can do this following:



              Jenkins.instance.getItemByFullName("YourJobName").updateNextBuildNumber(45)






              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Apr 27 '16 at 22:03









              l8nite

              2,56511419




              2,56511419








              • 7




                I can verify this works perfectly to solve the problem. I manually copied build history between two jenkins servers, and on the new server nextBuildNumber was wrong. Running this allowed me to set a correct new nextBuildNumber, no jenkins config reload required.
                – Phil Hollenback
                May 24 '16 at 16:59






              • 4




                If you are using the GitHub plugin, "YourJobName" is "organization/repository/branchname".
                – Ruud
                Sep 20 '16 at 15:50






              • 3




                Works. The value can be verified without building using: Jenkins.instance.getItemByFullName("YourJobName").getNextBuildNumber()
                – Daniel Alder
                Mar 15 '17 at 14:51






              • 3




                I can confirm this is also working for MultiBranch-Pipelines. The "JobName" is listed on the top of the branch page: Full project name: PipelineName/BranchName so it would be Jenkins.instance.getItemByFullName("YourPipelineName/YourBranchName").updateNextBuildNumber(45)
                – Markus
                Aug 1 '17 at 14:54






              • 1




                @Quantic meta.stackoverflow.com/questions/356435/…
                – Daniel Alder
                Sep 12 '17 at 13:04














              • 7




                I can verify this works perfectly to solve the problem. I manually copied build history between two jenkins servers, and on the new server nextBuildNumber was wrong. Running this allowed me to set a correct new nextBuildNumber, no jenkins config reload required.
                – Phil Hollenback
                May 24 '16 at 16:59






              • 4




                If you are using the GitHub plugin, "YourJobName" is "organization/repository/branchname".
                – Ruud
                Sep 20 '16 at 15:50






              • 3




                Works. The value can be verified without building using: Jenkins.instance.getItemByFullName("YourJobName").getNextBuildNumber()
                – Daniel Alder
                Mar 15 '17 at 14:51






              • 3




                I can confirm this is also working for MultiBranch-Pipelines. The "JobName" is listed on the top of the branch page: Full project name: PipelineName/BranchName so it would be Jenkins.instance.getItemByFullName("YourPipelineName/YourBranchName").updateNextBuildNumber(45)
                – Markus
                Aug 1 '17 at 14:54






              • 1




                @Quantic meta.stackoverflow.com/questions/356435/…
                – Daniel Alder
                Sep 12 '17 at 13:04








              7




              7




              I can verify this works perfectly to solve the problem. I manually copied build history between two jenkins servers, and on the new server nextBuildNumber was wrong. Running this allowed me to set a correct new nextBuildNumber, no jenkins config reload required.
              – Phil Hollenback
              May 24 '16 at 16:59




              I can verify this works perfectly to solve the problem. I manually copied build history between two jenkins servers, and on the new server nextBuildNumber was wrong. Running this allowed me to set a correct new nextBuildNumber, no jenkins config reload required.
              – Phil Hollenback
              May 24 '16 at 16:59




              4




              4




              If you are using the GitHub plugin, "YourJobName" is "organization/repository/branchname".
              – Ruud
              Sep 20 '16 at 15:50




              If you are using the GitHub plugin, "YourJobName" is "organization/repository/branchname".
              – Ruud
              Sep 20 '16 at 15:50




              3




              3




              Works. The value can be verified without building using: Jenkins.instance.getItemByFullName("YourJobName").getNextBuildNumber()
              – Daniel Alder
              Mar 15 '17 at 14:51




              Works. The value can be verified without building using: Jenkins.instance.getItemByFullName("YourJobName").getNextBuildNumber()
              – Daniel Alder
              Mar 15 '17 at 14:51




              3




              3




              I can confirm this is also working for MultiBranch-Pipelines. The "JobName" is listed on the top of the branch page: Full project name: PipelineName/BranchName so it would be Jenkins.instance.getItemByFullName("YourPipelineName/YourBranchName").updateNextBuildNumber(45)
              – Markus
              Aug 1 '17 at 14:54




              I can confirm this is also working for MultiBranch-Pipelines. The "JobName" is listed on the top of the branch page: Full project name: PipelineName/BranchName so it would be Jenkins.instance.getItemByFullName("YourPipelineName/YourBranchName").updateNextBuildNumber(45)
              – Markus
              Aug 1 '17 at 14:54




              1




              1




              @Quantic meta.stackoverflow.com/questions/356435/…
              – Daniel Alder
              Sep 12 '17 at 13:04




              @Quantic meta.stackoverflow.com/questions/356435/…
              – Daniel Alder
              Sep 12 '17 at 13:04













              34














              can be done with the plugin:
              https://wiki.jenkins-ci.org/display/JENKINS/Next+Build+Number+Plugin



              more info:
              http://www.alexlea.me/2010/10/howto-set-hudson-next-build-number.html



              if you don't like the plugin:




              If you want to change build number via nextBuildNumber file you should
              "Reload Configuration from Disk" from "Manage Jenkins" page.







              share|improve this answer

















              • 2




                No need to use plugin.
                – david.perez
                Oct 7 '14 at 14:19






              • 1




                Thanks, you save my day.
                – カオナシ
                Nov 3 '14 at 20:58






              • 1




                This plugin is good. It's great.
                – AechoLiu
                Jun 28 '17 at 8:29
















              34














              can be done with the plugin:
              https://wiki.jenkins-ci.org/display/JENKINS/Next+Build+Number+Plugin



              more info:
              http://www.alexlea.me/2010/10/howto-set-hudson-next-build-number.html



              if you don't like the plugin:




              If you want to change build number via nextBuildNumber file you should
              "Reload Configuration from Disk" from "Manage Jenkins" page.







              share|improve this answer

















              • 2




                No need to use plugin.
                – david.perez
                Oct 7 '14 at 14:19






              • 1




                Thanks, you save my day.
                – カオナシ
                Nov 3 '14 at 20:58






              • 1




                This plugin is good. It's great.
                – AechoLiu
                Jun 28 '17 at 8:29














              34












              34








              34






              can be done with the plugin:
              https://wiki.jenkins-ci.org/display/JENKINS/Next+Build+Number+Plugin



              more info:
              http://www.alexlea.me/2010/10/howto-set-hudson-next-build-number.html



              if you don't like the plugin:




              If you want to change build number via nextBuildNumber file you should
              "Reload Configuration from Disk" from "Manage Jenkins" page.







              share|improve this answer












              can be done with the plugin:
              https://wiki.jenkins-ci.org/display/JENKINS/Next+Build+Number+Plugin



              more info:
              http://www.alexlea.me/2010/10/howto-set-hudson-next-build-number.html



              if you don't like the plugin:




              If you want to change build number via nextBuildNumber file you should
              "Reload Configuration from Disk" from "Manage Jenkins" page.








              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Apr 22 '14 at 13:40









              mighq

              8041012




              8041012








              • 2




                No need to use plugin.
                – david.perez
                Oct 7 '14 at 14:19






              • 1




                Thanks, you save my day.
                – カオナシ
                Nov 3 '14 at 20:58






              • 1




                This plugin is good. It's great.
                – AechoLiu
                Jun 28 '17 at 8:29














              • 2




                No need to use plugin.
                – david.perez
                Oct 7 '14 at 14:19






              • 1




                Thanks, you save my day.
                – カオナシ
                Nov 3 '14 at 20:58






              • 1




                This plugin is good. It's great.
                – AechoLiu
                Jun 28 '17 at 8:29








              2




              2




              No need to use plugin.
              – david.perez
              Oct 7 '14 at 14:19




              No need to use plugin.
              – david.perez
              Oct 7 '14 at 14:19




              1




              1




              Thanks, you save my day.
              – カオナシ
              Nov 3 '14 at 20:58




              Thanks, you save my day.
              – カオナシ
              Nov 3 '14 at 20:58




              1




              1




              This plugin is good. It's great.
              – AechoLiu
              Jun 28 '17 at 8:29




              This plugin is good. It's great.
              – AechoLiu
              Jun 28 '17 at 8:29











              24














              Under the job workspace folder, like:



              C:Program Files (x86)Jenkinsjobsjob_name


              there is a file named nextBuildNumber.



              Setting the build number in the file and reloading the configuration from disk (Manage Jenkins menu) will force the next build you start to have the value from the file as BUILD_NUMBER.






              share|improve this answer



















              • 1




                Didn't work for me
                – hfossli
                Sep 17 '15 at 13:19






              • 7




                Did you reload the configuration from disk (Manage Jenkins menu) after changing the nextBuildNumber file?
                – vezenkov
                Sep 17 '15 at 18:59










              • Nope! I thought it happened automatically.
                – hfossli
                Sep 18 '15 at 8:13










              • This worked perfectly for me. You have to reboot the server before it takes affect.
                – Hawkeye64
                Nov 20 at 17:46
















              24














              Under the job workspace folder, like:



              C:Program Files (x86)Jenkinsjobsjob_name


              there is a file named nextBuildNumber.



              Setting the build number in the file and reloading the configuration from disk (Manage Jenkins menu) will force the next build you start to have the value from the file as BUILD_NUMBER.






              share|improve this answer



















              • 1




                Didn't work for me
                – hfossli
                Sep 17 '15 at 13:19






              • 7




                Did you reload the configuration from disk (Manage Jenkins menu) after changing the nextBuildNumber file?
                – vezenkov
                Sep 17 '15 at 18:59










              • Nope! I thought it happened automatically.
                – hfossli
                Sep 18 '15 at 8:13










              • This worked perfectly for me. You have to reboot the server before it takes affect.
                – Hawkeye64
                Nov 20 at 17:46














              24












              24








              24






              Under the job workspace folder, like:



              C:Program Files (x86)Jenkinsjobsjob_name


              there is a file named nextBuildNumber.



              Setting the build number in the file and reloading the configuration from disk (Manage Jenkins menu) will force the next build you start to have the value from the file as BUILD_NUMBER.






              share|improve this answer














              Under the job workspace folder, like:



              C:Program Files (x86)Jenkinsjobsjob_name


              there is a file named nextBuildNumber.



              Setting the build number in the file and reloading the configuration from disk (Manage Jenkins menu) will force the next build you start to have the value from the file as BUILD_NUMBER.







              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited Sep 18 '15 at 8:14









              hfossli

              17.8k898119




              17.8k898119










              answered Aug 6 '15 at 6:10









              vezenkov

              2,2522024




              2,2522024








              • 1




                Didn't work for me
                – hfossli
                Sep 17 '15 at 13:19






              • 7




                Did you reload the configuration from disk (Manage Jenkins menu) after changing the nextBuildNumber file?
                – vezenkov
                Sep 17 '15 at 18:59










              • Nope! I thought it happened automatically.
                – hfossli
                Sep 18 '15 at 8:13










              • This worked perfectly for me. You have to reboot the server before it takes affect.
                – Hawkeye64
                Nov 20 at 17:46














              • 1




                Didn't work for me
                – hfossli
                Sep 17 '15 at 13:19






              • 7




                Did you reload the configuration from disk (Manage Jenkins menu) after changing the nextBuildNumber file?
                – vezenkov
                Sep 17 '15 at 18:59










              • Nope! I thought it happened automatically.
                – hfossli
                Sep 18 '15 at 8:13










              • This worked perfectly for me. You have to reboot the server before it takes affect.
                – Hawkeye64
                Nov 20 at 17:46








              1




              1




              Didn't work for me
              – hfossli
              Sep 17 '15 at 13:19




              Didn't work for me
              – hfossli
              Sep 17 '15 at 13:19




              7




              7




              Did you reload the configuration from disk (Manage Jenkins menu) after changing the nextBuildNumber file?
              – vezenkov
              Sep 17 '15 at 18:59




              Did you reload the configuration from disk (Manage Jenkins menu) after changing the nextBuildNumber file?
              – vezenkov
              Sep 17 '15 at 18:59












              Nope! I thought it happened automatically.
              – hfossli
              Sep 18 '15 at 8:13




              Nope! I thought it happened automatically.
              – hfossli
              Sep 18 '15 at 8:13












              This worked perfectly for me. You have to reboot the server before it takes affect.
              – Hawkeye64
              Nov 20 at 17:46




              This worked perfectly for me. You have to reboot the server before it takes affect.
              – Hawkeye64
              Nov 20 at 17:46











              4














              Perhaps a combination of these plugins may come in handy:





              • Parametrized build plugin - define some variable which holds your build number


              • Version number plugin - use the variable to change the build number


              • Build name setter plugin - use the variable to change the build number






              share|improve this answer





















              • Thanks a lot - I was able to use one of the plugins.
                – erman8
                Nov 1 '13 at 21:55






              • 6




                @erman8 - Which plugin did you use?
                – randominstanceOfLivingThing
                Jun 18 '14 at 16:26
















              4














              Perhaps a combination of these plugins may come in handy:





              • Parametrized build plugin - define some variable which holds your build number


              • Version number plugin - use the variable to change the build number


              • Build name setter plugin - use the variable to change the build number






              share|improve this answer





















              • Thanks a lot - I was able to use one of the plugins.
                – erman8
                Nov 1 '13 at 21:55






              • 6




                @erman8 - Which plugin did you use?
                – randominstanceOfLivingThing
                Jun 18 '14 at 16:26














              4












              4








              4






              Perhaps a combination of these plugins may come in handy:





              • Parametrized build plugin - define some variable which holds your build number


              • Version number plugin - use the variable to change the build number


              • Build name setter plugin - use the variable to change the build number






              share|improve this answer












              Perhaps a combination of these plugins may come in handy:





              • Parametrized build plugin - define some variable which holds your build number


              • Version number plugin - use the variable to change the build number


              • Build name setter plugin - use the variable to change the build number







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Oct 28 '13 at 22:41









              Morfic

              11.6k32645




              11.6k32645












              • Thanks a lot - I was able to use one of the plugins.
                – erman8
                Nov 1 '13 at 21:55






              • 6




                @erman8 - Which plugin did you use?
                – randominstanceOfLivingThing
                Jun 18 '14 at 16:26


















              • Thanks a lot - I was able to use one of the plugins.
                – erman8
                Nov 1 '13 at 21:55






              • 6




                @erman8 - Which plugin did you use?
                – randominstanceOfLivingThing
                Jun 18 '14 at 16:26
















              Thanks a lot - I was able to use one of the plugins.
              – erman8
              Nov 1 '13 at 21:55




              Thanks a lot - I was able to use one of the plugins.
              – erman8
              Nov 1 '13 at 21:55




              6




              6




              @erman8 - Which plugin did you use?
              – randominstanceOfLivingThing
              Jun 18 '14 at 16:26




              @erman8 - Which plugin did you use?
              – randominstanceOfLivingThing
              Jun 18 '14 at 16:26











              0














              If you have branch name including Forward Slash (using git flow for example), you will need to replace the Forward Slash with its Unicode character %2F within the branch name.



              Here is an example for the pipeline My-Pipeline-Name and the branch release/my-release-branch-name



              Jenkins.instance.getItemByFullName("My-Pipeline-Name/release%2Fmy-release-branch-name").updateNextBuildNumber(BUILD_NUMBER)


              I was able to find out about this by running the following command which will list the different jobs (branches) for your pipeline



              Jenkins.instance.getItem("My-Pipeline-Name").getAllJobs()


              Hope it helps.






              share|improve this answer


























                0














                If you have branch name including Forward Slash (using git flow for example), you will need to replace the Forward Slash with its Unicode character %2F within the branch name.



                Here is an example for the pipeline My-Pipeline-Name and the branch release/my-release-branch-name



                Jenkins.instance.getItemByFullName("My-Pipeline-Name/release%2Fmy-release-branch-name").updateNextBuildNumber(BUILD_NUMBER)


                I was able to find out about this by running the following command which will list the different jobs (branches) for your pipeline



                Jenkins.instance.getItem("My-Pipeline-Name").getAllJobs()


                Hope it helps.






                share|improve this answer
























                  0












                  0








                  0






                  If you have branch name including Forward Slash (using git flow for example), you will need to replace the Forward Slash with its Unicode character %2F within the branch name.



                  Here is an example for the pipeline My-Pipeline-Name and the branch release/my-release-branch-name



                  Jenkins.instance.getItemByFullName("My-Pipeline-Name/release%2Fmy-release-branch-name").updateNextBuildNumber(BUILD_NUMBER)


                  I was able to find out about this by running the following command which will list the different jobs (branches) for your pipeline



                  Jenkins.instance.getItem("My-Pipeline-Name").getAllJobs()


                  Hope it helps.






                  share|improve this answer












                  If you have branch name including Forward Slash (using git flow for example), you will need to replace the Forward Slash with its Unicode character %2F within the branch name.



                  Here is an example for the pipeline My-Pipeline-Name and the branch release/my-release-branch-name



                  Jenkins.instance.getItemByFullName("My-Pipeline-Name/release%2Fmy-release-branch-name").updateNextBuildNumber(BUILD_NUMBER)


                  I was able to find out about this by running the following command which will list the different jobs (branches) for your pipeline



                  Jenkins.instance.getItem("My-Pipeline-Name").getAllJobs()


                  Hope it helps.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 20 at 17:54









                  DaWyz

                  313




                  313























                      -1














                      By USING ENVIRONMENTAL VARIABLES
                      $BUILD_NUMBER =4






                      share|improve this answer


























                        -1














                        By USING ENVIRONMENTAL VARIABLES
                        $BUILD_NUMBER =4






                        share|improve this answer
























                          -1












                          -1








                          -1






                          By USING ENVIRONMENTAL VARIABLES
                          $BUILD_NUMBER =4






                          share|improve this answer












                          By USING ENVIRONMENTAL VARIABLES
                          $BUILD_NUMBER =4







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Jul 29 at 21:56









                          ksr

                          443




                          443






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Stack Overflow!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.





                              Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                              Please pay close attention to the following guidance:


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f19645430%2fchanging-jenkins-build-number%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Tonle Sap (See)

                              I get strange results when I access the Sqlitedatabase with Unity C# via XAMPP

                              Guatemaltekische Davis-Cup-Mannschaft