How to set the BuildNumber of a jenkins descriptive pipeline from a service?How to restart Jenkins manually?Jenkins multibranch pipeline with multiple starting pointsJenkins Pipeline sh bad substitutionJenkins Pipeline conditional stage succeeds but Jenkins shows build as failedJenkins Multibranch Pipeline: clean workspace / delete directory when build endsGit LFS pull after checkout results in no step in jenkins pipelineJenkins pipeline library calls inside closures cause security exceptionsJenkins Multibranch Pipeline Scan infinite re-buildJenkins Declarative sequential pipelinesJenkins Multibranch Pipeline: How to checkout only once?

Is this cheap "air conditioner" able to cool a room?

How do we avoid CI-driven development...?

Finish the Mastermind

Can I call myself an assistant professor without a PhD

Secure my password from unsafe servers

In a topological space if there exists a loop that cannot be contracted to a point does there exist a simple loop that cannot be contracted also?

How to realistically deal with a shield user?

How do I calculate the difference in lens reach between a superzoom compact and a DSLR zoom lens?

Shabbat clothing on shabbat chazon

Why should public servants be apolitical?

Why was CPU32 core created, and how is it different from 680x0 CPU cores?

Colleagues speaking another language and it impacts work

Did WWII Japanese soldiers engage in cannibalism of their enemies?

Plausibility of Ice Eaters in the Arctic

Can you use the Fly spell to move underwater at a speed of 60 feet?

Why does Intel's Haswell chip allow multiplication to be twice as fast as addition?

Traveling from Germany to other countries by train?

Should I self-publish my novella on Amazon or try my luck getting publishers?

Will a paper be retracted if a flaw in released software code invalidates its central idea?

Are there any financial disadvantages to living significantly "below your means"?

Why is it 'in the saddle' rather than 'on the saddle'?

Acceptable to cut steak before searing?

What is a "Genuine Geraldo interviewee"?

Decode a variable-length quantity



How to set the BuildNumber of a jenkins descriptive pipeline from a service?


How to restart Jenkins manually?Jenkins multibranch pipeline with multiple starting pointsJenkins Pipeline sh bad substitutionJenkins Pipeline conditional stage succeeds but Jenkins shows build as failedJenkins Multibranch Pipeline: clean workspace / delete directory when build endsGit LFS pull after checkout results in no step in jenkins pipelineJenkins pipeline library calls inside closures cause security exceptionsJenkins Multibranch Pipeline Scan infinite re-buildJenkins Declarative sequential pipelinesJenkins Multibranch Pipeline: How to checkout only once?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















I've tried to accomplish this: https://www.quernus.co.uk/2016/08/12/global-build-numbers-in-jenkins-multibranch-pipeline-builds/ in order to have a unique build number accross all the branches.



//...
stages
stage('Initialization started')
steps
env.BUILD_ID = 'http://Energy-JobSrv2.vm.dom/api/buildnumber'.ToURL().text
currentBuild.displayName = "#" + env.BUILD_ID
echo "Job parameters:nt- ROOT_FOLDER: $params.ROOT_FOLDERnt- Build X86: $params.buildX86nt- Build X64: $params.buildX64nt- Commit Version changes: $params.commitVersionChangesnt- Setup Version: $params.version.$env.BUILD_NUMBERnt- Setup Configuration: $params.setupConfigurationnCurrent repository: $workspace"


//...

//...


But I think it's not done for Jenkins Descriptive pipeline files, because when I try to run it, I get this:



[Bitbucket] Build result notified
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: 17: Expected a step @ line 17, column 5.
env.BUILD_ID = 'http://Energy-JobSrv2.vm.dom/api/buildnumber'.ToURL().text
^

WorkflowScript: 18: Expected a step @ line 18, column 5.
currentBuild.displayName = "#" + env.BUILD_ID


What is the equivalent with Jenkins descriptive pipeline files?










share|improve this question
































    1















    I've tried to accomplish this: https://www.quernus.co.uk/2016/08/12/global-build-numbers-in-jenkins-multibranch-pipeline-builds/ in order to have a unique build number accross all the branches.



    //...
    stages
    stage('Initialization started')
    steps
    env.BUILD_ID = 'http://Energy-JobSrv2.vm.dom/api/buildnumber'.ToURL().text
    currentBuild.displayName = "#" + env.BUILD_ID
    echo "Job parameters:nt- ROOT_FOLDER: $params.ROOT_FOLDERnt- Build X86: $params.buildX86nt- Build X64: $params.buildX64nt- Commit Version changes: $params.commitVersionChangesnt- Setup Version: $params.version.$env.BUILD_NUMBERnt- Setup Configuration: $params.setupConfigurationnCurrent repository: $workspace"


    //...

    //...


    But I think it's not done for Jenkins Descriptive pipeline files, because when I try to run it, I get this:



    [Bitbucket] Build result notified
    org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
    WorkflowScript: 17: Expected a step @ line 17, column 5.
    env.BUILD_ID = 'http://Energy-JobSrv2.vm.dom/api/buildnumber'.ToURL().text
    ^

    WorkflowScript: 18: Expected a step @ line 18, column 5.
    currentBuild.displayName = "#" + env.BUILD_ID


    What is the equivalent with Jenkins descriptive pipeline files?










    share|improve this question




























      1












      1








      1








      I've tried to accomplish this: https://www.quernus.co.uk/2016/08/12/global-build-numbers-in-jenkins-multibranch-pipeline-builds/ in order to have a unique build number accross all the branches.



      //...
      stages
      stage('Initialization started')
      steps
      env.BUILD_ID = 'http://Energy-JobSrv2.vm.dom/api/buildnumber'.ToURL().text
      currentBuild.displayName = "#" + env.BUILD_ID
      echo "Job parameters:nt- ROOT_FOLDER: $params.ROOT_FOLDERnt- Build X86: $params.buildX86nt- Build X64: $params.buildX64nt- Commit Version changes: $params.commitVersionChangesnt- Setup Version: $params.version.$env.BUILD_NUMBERnt- Setup Configuration: $params.setupConfigurationnCurrent repository: $workspace"


      //...

      //...


      But I think it's not done for Jenkins Descriptive pipeline files, because when I try to run it, I get this:



      [Bitbucket] Build result notified
      org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
      WorkflowScript: 17: Expected a step @ line 17, column 5.
      env.BUILD_ID = 'http://Energy-JobSrv2.vm.dom/api/buildnumber'.ToURL().text
      ^

      WorkflowScript: 18: Expected a step @ line 18, column 5.
      currentBuild.displayName = "#" + env.BUILD_ID


      What is the equivalent with Jenkins descriptive pipeline files?










      share|improve this question
















      I've tried to accomplish this: https://www.quernus.co.uk/2016/08/12/global-build-numbers-in-jenkins-multibranch-pipeline-builds/ in order to have a unique build number accross all the branches.



      //...
      stages
      stage('Initialization started')
      steps
      env.BUILD_ID = 'http://Energy-JobSrv2.vm.dom/api/buildnumber'.ToURL().text
      currentBuild.displayName = "#" + env.BUILD_ID
      echo "Job parameters:nt- ROOT_FOLDER: $params.ROOT_FOLDERnt- Build X86: $params.buildX86nt- Build X64: $params.buildX64nt- Commit Version changes: $params.commitVersionChangesnt- Setup Version: $params.version.$env.BUILD_NUMBERnt- Setup Configuration: $params.setupConfigurationnCurrent repository: $workspace"


      //...

      //...


      But I think it's not done for Jenkins Descriptive pipeline files, because when I try to run it, I get this:



      [Bitbucket] Build result notified
      org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
      WorkflowScript: 17: Expected a step @ line 17, column 5.
      env.BUILD_ID = 'http://Energy-JobSrv2.vm.dom/api/buildnumber'.ToURL().text
      ^

      WorkflowScript: 18: Expected a step @ line 18, column 5.
      currentBuild.displayName = "#" + env.BUILD_ID


      What is the equivalent with Jenkins descriptive pipeline files?







      jenkins jenkins-pipeline pipeline multibranch-pipeline






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 27 at 7:55









      daspilker

      6,45819 silver badges40 bronze badges




      6,45819 silver badges40 bronze badges










      asked Mar 27 at 6:56









      J4NJ4N

      6,46225 gold badges117 silver badges221 bronze badges




      6,46225 gold badges117 silver badges221 bronze badges

























          1 Answer
          1






          active

          oldest

          votes


















          2














          You have to encapsulate your commands with script :



          //...
          stages
          stage('Initialization started')
          steps
          script
          env.BUILD_ID = 'http://Energy-JobSrv2.vm.dom/api/buildnumber'.ToURL().text
          currentBuild.displayName = "#" + env.BUILD_ID

          echo "Job parameters:nt- ROOT_FOLDER: $params.ROOT_FOLDERnt- Build X86: $params.buildX86nt- Build X64: $params.buildX64nt- Commit Version changes: $params.commitVersionChangesnt- Setup Version: $params.version.$env.BUILD_NUMBERnt- Setup Configuration: $params.setupConfigurationnCurrent repository: $workspace"


          //...

          //...





          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%2f55371413%2fhow-to-set-the-buildnumber-of-a-jenkins-descriptive-pipeline-from-a-service%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            2














            You have to encapsulate your commands with script :



            //...
            stages
            stage('Initialization started')
            steps
            script
            env.BUILD_ID = 'http://Energy-JobSrv2.vm.dom/api/buildnumber'.ToURL().text
            currentBuild.displayName = "#" + env.BUILD_ID

            echo "Job parameters:nt- ROOT_FOLDER: $params.ROOT_FOLDERnt- Build X86: $params.buildX86nt- Build X64: $params.buildX64nt- Commit Version changes: $params.commitVersionChangesnt- Setup Version: $params.version.$env.BUILD_NUMBERnt- Setup Configuration: $params.setupConfigurationnCurrent repository: $workspace"


            //...

            //...





            share|improve this answer





























              2














              You have to encapsulate your commands with script :



              //...
              stages
              stage('Initialization started')
              steps
              script
              env.BUILD_ID = 'http://Energy-JobSrv2.vm.dom/api/buildnumber'.ToURL().text
              currentBuild.displayName = "#" + env.BUILD_ID

              echo "Job parameters:nt- ROOT_FOLDER: $params.ROOT_FOLDERnt- Build X86: $params.buildX86nt- Build X64: $params.buildX64nt- Commit Version changes: $params.commitVersionChangesnt- Setup Version: $params.version.$env.BUILD_NUMBERnt- Setup Configuration: $params.setupConfigurationnCurrent repository: $workspace"


              //...

              //...





              share|improve this answer



























                2












                2








                2







                You have to encapsulate your commands with script :



                //...
                stages
                stage('Initialization started')
                steps
                script
                env.BUILD_ID = 'http://Energy-JobSrv2.vm.dom/api/buildnumber'.ToURL().text
                currentBuild.displayName = "#" + env.BUILD_ID

                echo "Job parameters:nt- ROOT_FOLDER: $params.ROOT_FOLDERnt- Build X86: $params.buildX86nt- Build X64: $params.buildX64nt- Commit Version changes: $params.commitVersionChangesnt- Setup Version: $params.version.$env.BUILD_NUMBERnt- Setup Configuration: $params.setupConfigurationnCurrent repository: $workspace"


                //...

                //...





                share|improve this answer













                You have to encapsulate your commands with script :



                //...
                stages
                stage('Initialization started')
                steps
                script
                env.BUILD_ID = 'http://Energy-JobSrv2.vm.dom/api/buildnumber'.ToURL().text
                currentBuild.displayName = "#" + env.BUILD_ID

                echo "Job parameters:nt- ROOT_FOLDER: $params.ROOT_FOLDERnt- Build X86: $params.buildX86nt- Build X64: $params.buildX64nt- Commit Version changes: $params.commitVersionChangesnt- Setup Version: $params.version.$env.BUILD_NUMBERnt- Setup Configuration: $params.setupConfigurationnCurrent repository: $workspace"


                //...

                //...






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 27 at 9:41









                SmartTomSmartTom

                2497 bronze badges




                2497 bronze badges





















                    Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







                    Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















                    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.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55371413%2fhow-to-set-the-buildnumber-of-a-jenkins-descriptive-pipeline-from-a-service%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

                    SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                    용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

                    155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해