Hi Kenny,
I think you still need to get the output from shell script to groovy and 
then parse it.
The "sh" command has a parameter to return the stdout of the script.

So, starting from the Groovy script you mentioned ... then I would remove 
all code related to "cmd.execute" and I will change with a line that call 
the sh command:

sout = sh( script: "./script.sh", returnStdout: true )

I would make sure the script.sh returns a JSON ... and then continue from 
line 31 of the example script as it is.

Cheers,
Gianluca.


Il giorno martedì 15 settembre 2020 alle 23:43:00 UTC+1 kenny...@gmail.com 
ha scritto:

> I'm running Jenkins 2.251 on Ubuntu.
> I have a shell script (script.sh) that outputs a list: 
> $ ./script.sh
> [item1,item2,item3]
>
> In my freestyle project I've added a build step that executes script.sh, 
> and I see the output in the build log just like the above example. I don't 
> care if the final project is freestyle, but that worked to get me to this 
> point.
>
> Now, I want to use this list as the input to a Choice parameter so it 
> creates a dropdown chooser with the items in the list. I've marked the 
> project as parameterized and added a Choices parameter but there is no 
> linkage between the list above and the Choices parameter. I would like to 
> know how to use the output from script.sh as the input to the Choices 
> dropdown.
>
> I found a groovy example here that *kinda *does what I want but I don't 
> need to rewrite the groovy code to produce the list, it's all done in 
> script.sh:
> https://ruepprich.com/jenkins-populate-choice-parameter-from-shell-command/
>
> Any help is appreciated!
>
> Thanks,
>
> -Kenny Cason
>

-- 
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-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/08a58a9b-8283-4d01-9402-f81baef34678n%40googlegroups.com.

Reply via email to