Swapnil Ghule
Swapnil Ghule

Reputation: 1

How to run Shell script in active choice parameter?

I am partly new the Jenkins, I want to run a shell script in active choice parameter where I am curling the nexus URL to fetch current images which has been pushed in nexus repository. and those images will given as dynamic parameter to Jenkins job.

right now I have the script to get those into array but for some reason that groovy script isn't working with the active choice parameter block? how can I ran the shell script within active choice parameter within Jenkins

Explanation on how we can use active choice parameter with shell script.

Upvotes: 0

Views: 226

Answers (1)

Iterokun
Iterokun

Reputation: 2550

It's no different than executing any other shell command in groovy:

def host = 'hostname'.execute().text

This doesn't invoke shell, so all the shell stuff, like IO redirects and parameter expansion doesn't work.

I would encourage you to figure out why requesting a url in groovy doesn't work - groovy can do everything that curl does. Ask another question if you get stuck.

Upvotes: 0

Related Questions