-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Minor
-
Component/s: active-choices-plugin
I have the following function declared in my Jenkinsfile
/** * returns all available bitbucket projects * @return list of projects */ def java.util.List getBitbucketProjects() { echo("[INFO] Get all bitbucket projects") String url = "${bitbucketHost}/projects/" String response = this.queryBitbucket(url) def list = new JsonSlurper().parseText(response) def projects = [] list.values.each { projects.add(it.key) } return projects }
Now I want to use this in the active choice plugin, so I declare this
...
[$class: 'ChoiceParameter',
choiceType: 'PT_SINGLE_SELECT',
description: 'Select Bitbucket project from Dropdown List',
filterLength: 1,
filterable: true,
name: 'project',
script: [
$class: 'GroovyScript',
fallbackScript: [
classpath: [],
sandbox: false,
script:
"""
return [ "Could not get bitbucket projects" ]
"""
],
script: [
classpath: [],
sandbox: false,
script:
"""
return this.getBitbucketProjects()
"""
]
]
],
...
When calling the pipeline, the script always uses the fallback script
So is this even possible what I try to achieve? if yes, what do I miss here?
Â