Return value from step (pipeline)

41 views
Skip to first unread message

sreeram yerrapragada

unread,
Nov 30, 2017, 4:04:11 AM11/30/17
to Jenkins Users
Hello Jenkins Users,

Is it possible to capture the return value from pipeline step?

ex:
def result = findbugs(pattern: '**/target/**/findbugsXml.xml')
echo result


Thanks
Sreeram

Ramanathan Muthaiah

unread,
Nov 30, 2017, 7:02:32 AM11/30/17
to Jenkins Users
Is it possible to capture the return value from pipeline step?

ex:
def result = findbugs(pattern: '**/target/**/findbugsXml.xml')
echo result

To store cmd status or output, you should use sh(). You will find code snippets in this link, https://jenkins.io/doc/pipeline/examples/

BTW, Jenkins Pipeline doc has step called, "findFiles" but there is nothing like, findbugs. Is that your custom function?

/Ram
 

Mark Waite

unread,
Nov 30, 2017, 8:09:26 AM11/30/17
to jenkins...@googlegroups.com
Pipeline step return values can be captured.

Refer to "https://github.com/MarkEWaite/jenkins-bugs/blob/e47d74ea8185c24d9c9531b7a126ae4a8fadef56/Jenkinsfile#L39" for an example of the return value of "checkout" being assigned and used.

Ramanathan, "findbugs" is a step added by the findbugs plugin.  It was added in findbugs plugin version 4.70.

I don't know if the findbugs step returns a value you could use.  I thought it had settings which would mark the build as stable or unstable depending on the detection of findbugs warnings.  The Jenkins plugin development infrastructure can run findbugs as part of plugin continuous integration, and marks the build unstable when a findbugs warning is detected.

Mark Waite

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/fc1b0b4e-bb5b-4f23-b408-ab9965d8692b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ullrich Hafner

unread,
Nov 30, 2017, 11:20:53 AM11/30/17
to jenkins...@googlegroups.com
This is not yet possible. The findbugs step does not return anything currently. This will change in a future version of findbugs. 

 
If you have any requirements that are not yet considered please update the wiki page.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages