How to expand parameters?

Hello.
I would like to know what is the best way to expand parameters in some string?
I got an issue, where I need this feature to be implemented.

I've found class jetbrains.buildServer.parameters.ReferencesResolverUtil,but there is no straight way to expand a string with parameters to plain string.
Also I've tried to play with jetbrains.buildServer.parameters.ParameterBasedValueResolver, but couldn't figure out how to resolve parameters either.
Could you please give me a hint how to do it the right way?

Thank you.

5 comments
Comment actions Permalink
Hi Grigory,
At some point you might need no additional efforts to get the parameter specification resolved.

 
Until that is implemneted, you can explicitly call SBuildType.getValueResolver().resolve(text) to get a resolved value in the context of a build configuration.
0
Comment actions Permalink

Hello, Yegor,
Thanks for making it clear.
Now I can't find out how to get SBuild from my component.
So, I got class that extends ParameterControlProviderAdapter. Is it possible at runtime in renderControl or some other method to find out to which build this parameter is linked?

0
Comment actions Permalink
Hi Grigory,
  
Why do you need SBUild? It seems that typed parameter definition should not link itself to any build.
0
Comment actions Permalink

Egor,
The original problem is in expanding parameters in custom parameter control (derived from ParameterControlProviderAdapter) -- that's why I need SBuild. If there is another way to do it - let me know.
Thank you.

0
Comment actions Permalink

Hi guys!

I would like to ask again my question, hope you could help me.

So the user of my plugin "web-parameters" would like to use custom parameters in the url for web service, so it would look like "http://webservice/%PROJECT_ID%". In order to get parameters values from web service first I need to parse the url. And that's why I need SBuild in parameter definition.

The only parameter that I have access to is

ParameterRenderContext context

 from renderControl method. But looks like all SBuild information is hidden somewhere in private inner class. Could you please help me with this issue? Maybe I can do something with id of context or somehow get the current build?

Thank you.

0

Please sign in to leave a comment.