Active Choices plugin - not found referenced parameter

509 views
Skip to first unread message

kevm...@gmail.com

unread,
Mar 13, 2017, 7:59:21 PM3/13/17
to Jenkins Users
Hi,

I'm trying to use Active Choices plugin to get branch list by repo using github api, but it gives me an error that there is no repo - which is a referenced parameter, which is already defined.

In case, I'm using Ubuntu 16.0.4, Jenkins 2.32.2 and Active choices plugin 1.5.3.

if (REPO.equals("REPOA")){
   
def proc = "curl https://api.github.com/repos/jenkinsci/active-choices-plugin/branches | jq -r '[.[] | .name ]'".execute()
   
return proc.text
}
else if (REPO.equals("REPOB")){
   
def proc = "curl https://api.github.com/repos/jenkinsci/active-choices-plugin/branches | jq -r '[.[] | .name ]' ".execute()
   
return proc.text
}




Am I doing something wrong?

(I also tried to use buffer/stream way since I found some answers about not using 'text' from stackoverflow, but same result. the code part to get branch name is working fine on scriptler edit mode.)

def proc ="curl...."
def outputStream = new StringBuffer()
proc
.waitForProcessOutput(outputStream, System.err)
return outputStream.toString())
referenced parameter reactive part



The error is as follow:

Fallback to default script...
groovy
.lang.MissingPropertyException: No such property: REPO for class:  Script1
at org
.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:53)
at org
.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:52)
at org
.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:307)
at
Script1.run(Script1.groovy:1)



Auto Generated Inline Image 1
Auto Generated Inline Image 2

Ioannis Moutsatsos

unread,
Apr 18, 2017, 7:47:47 AM4/18/17
to Jenkins Users
The error message is unfortunately irrelevant here. It is part of the logger info that fires at some point before the parameter is defined.
The real issue is that you are expected to return a list or map from the groovy script of an Actice Choice Reactive parameter, and not text as you are currently doing. 

Other than that it looks good
Reply all
Reply to author
Forward
0 new messages