I am trying to get my Active choice parameter drop down options from curl response.
Below is the code i pasted in Active choice parameter
import groovy.json.JsonSlurper
withCredentials([usernamePassword(credentialsId: 'cred-id', usernameVariable: 'username', passwordVariable: 'var')]) {
try {
if (appname == 'app1') {
def process = "curl -u $USERNAME:$PASSWORD -X GET 'https://<app url>/api/v1/repos/<repo path>/tags?pageSize=10&count=false&includeManifests=false' -H 'accept: application/json' -H 'X-Csrf-Token: <token>' -H 'Content-Type: application/json'".execute()
process.waitFor()
def output = process.in.text.trim()
def jsonSlurper = new JsonSlurper()
def object = jsonSlurper.parseText(output)
def option_list = object*.name
return option_list
} else {
return ["aminelse"]
}
} catch (Exception e) {
return[e]
}
}
after saving if i click on build with parameter
the options am getting is like below
[object Object]
Any suggestions were greatly appreciated.
Let us know what we are missing.