0

I try to collect data for an Extended Choice Paramater. I use the code:

def ingo = sh(script: 'mktemp', returnStdout: true)
return ingo

inside the groovy script part, but it seem that this is not allowed or well formated. The choice is always empty. Anybody has some experience with shell command inside this part of the pipeline?

Sense is, I want to collect data with curl here. But simple shell query is not working.

Please see imageenter image description here

IFThenElse
  • 131
  • 1
  • 10

1 Answers1

0

You can't execute Jenkins steps within the Extended Choice Parameter. You have to use pure Groovy within the Parameter. For example, if you want to do an HTTP call you can use a Groovy script like below. Here I'm fetching content from a GitHub file. A Full example can be found here.

def content = new URL ("https://raw.githubusercontent.com/xxx/sample/main/testdir/hosts").getText()
ycr
  • 12,828
  • 2
  • 25
  • 45