Skip to main content

How to set current build result in Pipeline?

Comments

5 comments

  • Kenneth Lamb

    Where can I find a list of valid values for currentBuild.result? I thought it was just a string, but it appears to only allow certain values.

    For example, this code:
       echo "currentBuild.result1: '${currentBuild.result}'"
       currentBuild.result = 'FAILEDZZZZ'
       echo "currentBuild.result1: '${currentBuild.result}'"

    Will yield this:   

    currentBuild.result1: 'null'
    [Pipeline] echo
    currentBuild.result1: 'FAILURE'

     

    0
  • Allan Burdajewicz

    Hi Kenneth,

    You are right. currentBuild.result is not a simple String. It is a String representation of hudson.model.Result

    The reason why you see FAILURE when the String does not match a known value is because of this method.

    Regards,

    3
  • Kenneth Lamb

    Just what I was looking for. Thank you very much!

    0
  • Lee Meador

    Just for making it easy there are two other interesting statuses ABORTED and UNSTABLE

    0
  • Luis a. Del Pozo G.

    Hello everyone :) !!

    I am new to jenkins and groovy and I'm trying to print out using this same example other values such as

    currentBuild.durationString and others, I have followed this example 
    and the one from
    https://plugins.jenkins.io/logstash/, trying to print out the currentBuild.durationString
    like result in data, it that possible to do, any suggestions of how can I
    accomplish it?, Any help is really appreciated.

    Thank you very much and good day!
    0

Please sign in to leave a comment.

About CloudBees Support

Our Support Engineers are available to help with any questions or problems you may have with any of our products.