Jenkins: pipeline always returns “SUCCESS” even though build fails Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) The Ask Question Wizard is Live! Data science time! April 2019 and salary with experience Should we burninate the [wrap] tag?Running stages in parallel with Jenkins workflow / pipelineJenkins Pipeline always failsJenkins continue pipeline on failed stageJenkins Pipeline, getting runWrapper references even on failed runsJenkins declarative pipeline conditional post actionBuild number using wget in a Jenkins pipelineJenkins promote build in Jenkins delivery pipeline viewJenkins pipeline post always step doesn't execute on failing buildRun stage only if previous stage was successful in Jenkins Scripted PipelineHow does Jenkins determine if a stage in the pipeline is a build step or a test step?

Why is black pepper both grey and black?

If Jon Snow became King of the Seven Kingdoms what would his regnal number be?

Is 1 ppb equal to 1 μg/kg?

Single word antonym of "flightless"

Why is "Captain Marvel" translated as male in Portugal?

How to draw this diagram using TikZ package?

Is a manifold-with-boundary with given interior and non-empty boundary essentially unique?

How to motivate offshore teams and trust them to deliver?

Is there a way in Ruby to make just any one out of many keyword arguments required?

How do I keep my slimes from escaping their pens?

Should gear shift center itself while in neutral?

Examples of mediopassive verb constructions

Does surprise arrest existing movement?

When -s is used with third person singular. What's its use in this context?

Should I call the interviewer directly, if HR aren't responding?

Is there a service that would inform me whenever a new direct route is scheduled from a given airport?

Stars Make Stars

What are the motives behind Cersei's orders given to Bronn?

Gastric acid as a weapon

What does the "x" in "x86" represent?

How to deal with a team lead who never gives me credit?

Does accepting a pardon have any bearing on trying that person for the same crime in a sovereign jurisdiction?

How can I make names more distinctive without making them longer?

How do I mention the quality of my school without bragging



Jenkins: pipeline always returns “SUCCESS” even though build fails



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
The Ask Question Wizard is Live!
Data science time! April 2019 and salary with experience
Should we burninate the [wrap] tag?Running stages in parallel with Jenkins workflow / pipelineJenkins Pipeline always failsJenkins continue pipeline on failed stageJenkins Pipeline, getting runWrapper references even on failed runsJenkins declarative pipeline conditional post actionBuild number using wget in a Jenkins pipelineJenkins promote build in Jenkins delivery pipeline viewJenkins pipeline post always step doesn't execute on failing buildRun stage only if previous stage was successful in Jenkins Scripted PipelineHow does Jenkins determine if a stage in the pipeline is a build step or a test step?



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








1















UPDATE: This appears to have been a bug introduced in Pipeline: Declarative plugin version 1.3.5 - downgrading to 1.3.4.1 resolves this issue. Ticket was created at:



  • https://issues.jenkins-ci.org/browse/JENKINS-56402


How do I get the real status of a build when using on a remote executor?



Dilemma:



  • Using a declarative pipeline

  • Builds are ran on a remote executor

  • Build fails

  • Hits post failure


  • currentBuild.result is NULL and currentBuild.currentResult is SUCCESS

How do I access the actual failure when builds are executed on a remote executioner?



Code view:




pipeline
agent any
stages
stage("test run")
steps
sh "exit 1"




post
always
echo "I always run: $currentBuild.result <> $currentBuild.currentResult"

success
echo "I'm successful: $currentBuild.result <> $currentBuild.currentResult"

failure
echo "I failed: $currentBuild.result <> $currentBuild.currentResult"

fixed
echo "I'm fixed!: $currentBuild.result <> $currentBuild.currentResult"





And the output:



[Pipeline] Start of Pipeline
[Pipeline] node
Running on build-096575a3-e6af-4fff-9ca1-84cc46ba4b86-f9b8d29c in /var/vcap/data/jenkins-slave/workspace/test-job
[Pipeline]
[Pipeline] stage
[Pipeline] (test run)
[Pipeline] sh
+ exit 1
[Pipeline]
[Pipeline] // stage
[Pipeline] stage
[Pipeline] (Declarative: Post Actions)
[Pipeline] echo
I always run: null <> SUCCESS
[Pipeline] echo
I failed: null <> SUCCESS
[Pipeline]
[Pipeline] // stage
[Pipeline]
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code 1
Finished: FAILURE









share|improve this question






























    1















    UPDATE: This appears to have been a bug introduced in Pipeline: Declarative plugin version 1.3.5 - downgrading to 1.3.4.1 resolves this issue. Ticket was created at:



    • https://issues.jenkins-ci.org/browse/JENKINS-56402


    How do I get the real status of a build when using on a remote executor?



    Dilemma:



    • Using a declarative pipeline

    • Builds are ran on a remote executor

    • Build fails

    • Hits post failure


    • currentBuild.result is NULL and currentBuild.currentResult is SUCCESS

    How do I access the actual failure when builds are executed on a remote executioner?



    Code view:




    pipeline
    agent any
    stages
    stage("test run")
    steps
    sh "exit 1"




    post
    always
    echo "I always run: $currentBuild.result <> $currentBuild.currentResult"

    success
    echo "I'm successful: $currentBuild.result <> $currentBuild.currentResult"

    failure
    echo "I failed: $currentBuild.result <> $currentBuild.currentResult"

    fixed
    echo "I'm fixed!: $currentBuild.result <> $currentBuild.currentResult"





    And the output:



    [Pipeline] Start of Pipeline
    [Pipeline] node
    Running on build-096575a3-e6af-4fff-9ca1-84cc46ba4b86-f9b8d29c in /var/vcap/data/jenkins-slave/workspace/test-job
    [Pipeline]
    [Pipeline] stage
    [Pipeline] (test run)
    [Pipeline] sh
    + exit 1
    [Pipeline]
    [Pipeline] // stage
    [Pipeline] stage
    [Pipeline] (Declarative: Post Actions)
    [Pipeline] echo
    I always run: null <> SUCCESS
    [Pipeline] echo
    I failed: null <> SUCCESS
    [Pipeline]
    [Pipeline] // stage
    [Pipeline]
    [Pipeline] // node
    [Pipeline] End of Pipeline
    ERROR: script returned exit code 1
    Finished: FAILURE









    share|improve this question


























      1












      1








      1








      UPDATE: This appears to have been a bug introduced in Pipeline: Declarative plugin version 1.3.5 - downgrading to 1.3.4.1 resolves this issue. Ticket was created at:



      • https://issues.jenkins-ci.org/browse/JENKINS-56402


      How do I get the real status of a build when using on a remote executor?



      Dilemma:



      • Using a declarative pipeline

      • Builds are ran on a remote executor

      • Build fails

      • Hits post failure


      • currentBuild.result is NULL and currentBuild.currentResult is SUCCESS

      How do I access the actual failure when builds are executed on a remote executioner?



      Code view:




      pipeline
      agent any
      stages
      stage("test run")
      steps
      sh "exit 1"




      post
      always
      echo "I always run: $currentBuild.result <> $currentBuild.currentResult"

      success
      echo "I'm successful: $currentBuild.result <> $currentBuild.currentResult"

      failure
      echo "I failed: $currentBuild.result <> $currentBuild.currentResult"

      fixed
      echo "I'm fixed!: $currentBuild.result <> $currentBuild.currentResult"





      And the output:



      [Pipeline] Start of Pipeline
      [Pipeline] node
      Running on build-096575a3-e6af-4fff-9ca1-84cc46ba4b86-f9b8d29c in /var/vcap/data/jenkins-slave/workspace/test-job
      [Pipeline]
      [Pipeline] stage
      [Pipeline] (test run)
      [Pipeline] sh
      + exit 1
      [Pipeline]
      [Pipeline] // stage
      [Pipeline] stage
      [Pipeline] (Declarative: Post Actions)
      [Pipeline] echo
      I always run: null <> SUCCESS
      [Pipeline] echo
      I failed: null <> SUCCESS
      [Pipeline]
      [Pipeline] // stage
      [Pipeline]
      [Pipeline] // node
      [Pipeline] End of Pipeline
      ERROR: script returned exit code 1
      Finished: FAILURE









      share|improve this question
















      UPDATE: This appears to have been a bug introduced in Pipeline: Declarative plugin version 1.3.5 - downgrading to 1.3.4.1 resolves this issue. Ticket was created at:



      • https://issues.jenkins-ci.org/browse/JENKINS-56402


      How do I get the real status of a build when using on a remote executor?



      Dilemma:



      • Using a declarative pipeline

      • Builds are ran on a remote executor

      • Build fails

      • Hits post failure


      • currentBuild.result is NULL and currentBuild.currentResult is SUCCESS

      How do I access the actual failure when builds are executed on a remote executioner?



      Code view:




      pipeline
      agent any
      stages
      stage("test run")
      steps
      sh "exit 1"




      post
      always
      echo "I always run: $currentBuild.result <> $currentBuild.currentResult"

      success
      echo "I'm successful: $currentBuild.result <> $currentBuild.currentResult"

      failure
      echo "I failed: $currentBuild.result <> $currentBuild.currentResult"

      fixed
      echo "I'm fixed!: $currentBuild.result <> $currentBuild.currentResult"





      And the output:



      [Pipeline] Start of Pipeline
      [Pipeline] node
      Running on build-096575a3-e6af-4fff-9ca1-84cc46ba4b86-f9b8d29c in /var/vcap/data/jenkins-slave/workspace/test-job
      [Pipeline]
      [Pipeline] stage
      [Pipeline] (test run)
      [Pipeline] sh
      + exit 1
      [Pipeline]
      [Pipeline] // stage
      [Pipeline] stage
      [Pipeline] (Declarative: Post Actions)
      [Pipeline] echo
      I always run: null <> SUCCESS
      [Pipeline] echo
      I failed: null <> SUCCESS
      [Pipeline]
      [Pipeline] // stage
      [Pipeline]
      [Pipeline] // node
      [Pipeline] End of Pipeline
      ERROR: script returned exit code 1
      Finished: FAILURE






      jenkins jenkins-pipeline






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 8 at 16:20







      guice

















      asked Mar 4 at 22:12









      guiceguice

      374416




      374416






















          1 Answer
          1






          active

          oldest

          votes


















          1














          (Posting an "official answer" to my issue):



          This is a "bug" introduced in Pipeline: Declarative plugin version 1.3.5 - downgrading to 1.3.4.1 resolves this issue. Ticket was created at:



          • https://issues.jenkins-ci.org/browse/JENKINS-56402

          There are back and forths between users and the devs about whether this is really a bug or not. The devs are recommending NOT to use currentBuild.result (anymore) but many are pointing out this is a BC break and causing a lot of issues.



          Issue has been marked Critical - may get rolled back or redeveloped to be better implemented.



          If you relied on this feature, either currentBuild.result or currentBuild.currentResult, I recommend posting your comments on this bug.






          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%2f54992368%2fjenkins-pipeline-always-returns-success-even-though-build-fails%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









            1














            (Posting an "official answer" to my issue):



            This is a "bug" introduced in Pipeline: Declarative plugin version 1.3.5 - downgrading to 1.3.4.1 resolves this issue. Ticket was created at:



            • https://issues.jenkins-ci.org/browse/JENKINS-56402

            There are back and forths between users and the devs about whether this is really a bug or not. The devs are recommending NOT to use currentBuild.result (anymore) but many are pointing out this is a BC break and causing a lot of issues.



            Issue has been marked Critical - may get rolled back or redeveloped to be better implemented.



            If you relied on this feature, either currentBuild.result or currentBuild.currentResult, I recommend posting your comments on this bug.






            share|improve this answer



























              1














              (Posting an "official answer" to my issue):



              This is a "bug" introduced in Pipeline: Declarative plugin version 1.3.5 - downgrading to 1.3.4.1 resolves this issue. Ticket was created at:



              • https://issues.jenkins-ci.org/browse/JENKINS-56402

              There are back and forths between users and the devs about whether this is really a bug or not. The devs are recommending NOT to use currentBuild.result (anymore) but many are pointing out this is a BC break and causing a lot of issues.



              Issue has been marked Critical - may get rolled back or redeveloped to be better implemented.



              If you relied on this feature, either currentBuild.result or currentBuild.currentResult, I recommend posting your comments on this bug.






              share|improve this answer

























                1












                1








                1







                (Posting an "official answer" to my issue):



                This is a "bug" introduced in Pipeline: Declarative plugin version 1.3.5 - downgrading to 1.3.4.1 resolves this issue. Ticket was created at:



                • https://issues.jenkins-ci.org/browse/JENKINS-56402

                There are back and forths between users and the devs about whether this is really a bug or not. The devs are recommending NOT to use currentBuild.result (anymore) but many are pointing out this is a BC break and causing a lot of issues.



                Issue has been marked Critical - may get rolled back or redeveloped to be better implemented.



                If you relied on this feature, either currentBuild.result or currentBuild.currentResult, I recommend posting your comments on this bug.






                share|improve this answer













                (Posting an "official answer" to my issue):



                This is a "bug" introduced in Pipeline: Declarative plugin version 1.3.5 - downgrading to 1.3.4.1 resolves this issue. Ticket was created at:



                • https://issues.jenkins-ci.org/browse/JENKINS-56402

                There are back and forths between users and the devs about whether this is really a bug or not. The devs are recommending NOT to use currentBuild.result (anymore) but many are pointing out this is a BC break and causing a lot of issues.



                Issue has been marked Critical - may get rolled back or redeveloped to be better implemented.



                If you relied on this feature, either currentBuild.result or currentBuild.currentResult, I recommend posting your comments on this bug.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 8 at 16:18









                guiceguice

                374416




                374416





























                    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%2f54992368%2fjenkins-pipeline-always-returns-success-even-though-build-fails%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

                    AWS Lex not identifying response if by a variable The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) The Ask Question Wizard is Live! Data science time! April 2019 and salary with experienceEnforcing custom enumeration in AWS LEX for slot valuesHow to give response based on user response in Amazon Lex?Intercepting AWS Lambda Response to a AWS Lex QueryLex chat bot error: Reached second execution of fulfillment lambda on the same utteranceamazon lex showing invalid responseLambda response send back to Lex slot?Response card in Amazon lexAmazon Lex - Lambda response return HTML to botHow can I solve 424 (Failed Dependency) (python) obtained from Amazon lex?

                    Алба-Юлія

                    Захаров Федір Захарович