[JIRA] (JENKINS-59699) Usage of jenkinsfile functions in ActiveChoicePlugin

0 views
Skip to first unread message

papanito@wyssmann.com (JIRA)

unread,
Oct 8, 2019, 4:55:02 AM10/8/19
to jenkinsc...@googlegroups.com
Adrian Wyssmann created an issue
 
Jenkins / Bug JENKINS-59699
Usage of jenkinsfile functions in ActiveChoicePlugin
Issue Type: Bug Bug
Assignee: Bruno P. Kinoshita
Components: active-choices-plugin
Created: 2019-10-08 08:54
Labels: ActiveChoices jenkinsfile
Priority: Minor Minor
Reporter: Adrian Wyssmann

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?

 

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages