I'm developing a new Jenkins plugin that will be executed during the build
phase of a Jenkins job and have a requirement to allow the user to specify
a variable name (as opposed to a literal value) in the job configuration
for the plugin. The intention is that when the job executes the variable
name specified by the user will then be substituted with the real value
associated with the variable and that the plugin will then use this real
value when running the perform method.
For example if the variable MY_VARIABLE with the value myValue was injected
into the build environment by another part of job and the value
${MY_VARIABLE} was specified in the job configuration for my plugin, then I
would like the plugin to substitute ${MY_VARIABLE} with the real value for
the variable which is myValue.
[image: enter image description here]
Having done some research I understand that Jenkins does not automatically
substitute variable in the job configuration for their respective values
and this must be handled by the plugin. What I haven't been able to work
out is the best way to perform the substitution in my plugin. The only
solution I've found so far is the parse the string passed from the job
configuration to see whether it matches the correct pattern for a variable
and then lookup the value in my code.
Does the Jenkins API provide a better solution that would allow my plugin
to substitute a variable with a real value when the build job is executed?
--
You received this message because you are subscribed to the Google Groups
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-dev/5a55cc4f-d0c4-45b6-8603-04648e2e0240%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.