groovy commands and description.

34 views
Skip to first unread message

Kenneth Johansson

unread,
Apr 27, 2017, 11:16:40 AM4/27/17
to Jenkins Users
How do I find out what functions exist that can be used from a groovy
script and how to use them ??

like how to get the shell script output from a shell command into a
variable.

so the sh command is in basically all examples written as "sh
'command'" but there is another way also so that its possible to get the
output into a a string but where is this documented. I do not need
proper docs I can read the source but I cant even find out where this
code exists. It's very hard to get up to speed with this stuff when the
only way to find out things if is someone has done a blog post and have
some code in it.

Mark Waite

unread,
Apr 27, 2017, 11:22:31 AM4/27/17
to Jenkins Users

The specific question you're asking is answered by an example at https://jenkins.io/doc/pipeline/examples/#gitcommit .  You need "returnStdout: true".

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/422dd162-7ca7-03a7-1dc6-4fddaa83f6dc%40inteno.se.
For more options, visit https://groups.google.com/d/optout.

Kenneth Johansson

unread,
Apr 27, 2017, 11:36:53 AM4/27/17
to jenkins...@googlegroups.com
On 2017-04-27 17:22, Mark Waite wrote:
How did you find that ?

The specific question you're asking is answered by an example at https://jenkins.io/doc/pipeline/examples/#gitcommit .  You need "returnStdout: true".

well in this case I already know the answer the real question is actually how do I find out the answer in the fist place. how can I discover what functions exists ??
Now it feels like it is more a question of luck.

Mark Waite

On Thu, Apr 27, 2017 at 9:16 AM Kenneth Johansson <kenneth....@inteno.se> wrote:
How do I find out what functions exist that can be used from a groovy
script and how to use them ??

like how to get the shell script output from a shell command into a
variable.

so the sh command is in basically all  examples written as "sh
'command'" but there is another way also so that its possible to get the
output into a a string but where is this documented. I do not need
proper docs I can read the source but I cant even find out where this
code exists. It's very hard to get up to speed with this stuff when the
only way to find out things if is someone has done a blog post and have
some code in it.

--
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/422dd162-7ca7-03a7-1dc6-4fddaa83f6dc%40inteno.se.
For more options, visit https://groups.google.com/d/optout.
--
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.

Mark Waite

unread,
Apr 27, 2017, 11:53:21 AM4/27/17
to jenkins...@googlegroups.com
On Thu, Apr 27, 2017 at 9:36 AM Kenneth Johansson <kenneth....@inteno.se> wrote:
On 2017-04-27 17:22, Mark Waite wrote:
How did you find that ?


I used a google search for "Jenkins.io pipeline command reference" followed by a search within the resulting page.  I looked inside the page for "sh" initially, but there were too many matches, so I looked for "sh:".

Kenneth Johansson

unread,
Apr 28, 2017, 4:48:57 AM4/28/17
to jenkins...@googlegroups.com
On 2017-04-27 17:52, Mark Waite wrote:

On Thu, Apr 27, 2017 at 9:36 AM Kenneth Johansson <kenneth....@inteno.se> wrote:
On 2017-04-27 17:22, Mark Waite wrote:
How did you find that ?


I used a google search for "Jenkins.io pipeline command reference" followed by a search within the resulting page.  I looked inside the page for "sh" initially, but there were too many matches, so I looked for "sh:".
 
hmm ok now I think I understand the format of that help page thanks. Did not understand what I was looking at before.

But still it is not very easy. take the ansicolor page https://jenkins.io/doc/pipeline/steps/ansicolor/ I doubt anyone will actually be able to use that documentation to write working code. But at least https://jenkins.io/doc/pipeline/steps/ will point you in the right direction.




Reply all
Reply to author
Forward
0 new messages