Extends Choice Parameter: how to use bindings ?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Extends Choice Parameter: how to use bindings ?

Yannick Lacaute
I don''t understand how to use the bindings field in extendedChoice, I tried the code below but it does not work. Any idea ?

Binding binding = new Binding()
binding["foo"] = "foo"
binding["bar"] = "bar"

extendedChoice(
  name: 'wtf',
  bindings: new Binding(vars).toString(),
  description: '',
  groovyClasspath: '',
  multiSelectDelimiter: ',',
  quoteValue: false,
  saveJSONParameterToFile: false,
  type: 'PT_JSON',
  visibleItemCount: 5,
  javascript: jsScript,
  groovyScript: groovyScript)

Inside the groovyScript :
  String a = binding.getProperty("foo") 
  String b = binding.getProperty"bar") 


--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/bb8ad7ed-0937-4b97-9be5-781f2d5837a2n%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Extends Choice Parameter: how to use bindings ?

Yannick Lacaute
Oops : you must read "binding.toString()" in the previous code of course.
But it does not work...



Le mardi 29 décembre 2020 à 10:14:32 UTC+1, Yannick Lacaute a écrit :
I don''t understand how to use the bindings field in extendedChoice, I tried the code below but it does not work. Any idea ?

Binding binding = new Binding()
binding["foo"] = "foo"
binding["bar"] = "bar"

extendedChoice(
  name: 'wtf',
  bindings: new Binding(vars).toString(),
  description: '',
  groovyClasspath: '',
  multiSelectDelimiter: ',',
  quoteValue: false,
  saveJSONParameterToFile: false,
  type: 'PT_JSON',
  visibleItemCount: 5,
  javascript: jsScript,
  groovyScript: groovyScript)

Inside the groovyScript :
  String a = binding.getProperty("foo") 
  String b = binding.getProperty"bar") 


--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/4a079f43-fdf4-465d-bc99-c2ca58be23f2n%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Extends Choice Parameter: how to use bindings ?

Yannick Lacaute
In reply to this post by Yannick Lacaute
SO post : https://stackoverflow.com/questions/65500284/jenkins-how-to-use-bindings-field-of-extended-choice-parameters-plugin



Le mardi 29 décembre 2020 à 10:14:32 UTC+1, Yannick Lacaute a écrit :
I don''t understand how to use the bindings field in extendedChoice, I tried the code below but it does not work. Any idea ?

Binding binding = new Binding()
binding["foo"] = "foo"
binding["bar"] = "bar"

extendedChoice(
  name: 'wtf',
  bindings: new Binding(vars).toString(),
  description: '',
  groovyClasspath: '',
  multiSelectDelimiter: ',',
  quoteValue: false,
  saveJSONParameterToFile: false,
  type: 'PT_JSON',
  visibleItemCount: 5,
  javascript: jsScript,
  groovyScript: groovyScript)

Inside the groovyScript :
  String a = binding.getProperty("foo") 
  String b = binding.getProperty"bar") 


--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/4fe271ef-23b0-474b-91fe-e92a71979303n%40googlegroups.com.