Jenkins choice parameter with different display - maven

I want to add a choice parameter to a Jenkins job. The list is fixed, but I want the dropbox to display custom value, and not the actual ones (analogous to name of a web page and not its URL).
In the certain case this is the path of the pom.xml file, however, I want to display the module name instead of the full path. An example:
Actual value | What I want to be displayed
-------------------------------------|----------------------------
full/path/to/my/modules/pom.xml | All modules
full/path/to/my/modules/util/pom.xml | Utilities
full/path/to/my/modules/data/pom.xml | Data handling
Thanks for the help in advance!

You can do this with the Extended Choice Parameter plugin.
To set it the way you want, under "This build is parameterized", choose Extended Choice Parameter, and set it up like this:
Note it may look a little different depending on what version of Jenkins you have but it shouldn't be too different (this screenshot was on 2.0-beta-2).

With the Active Choices plugin, you can set this up with a groovy map:
Set a "Active Choices Parameter" with the following groovy script:
return['full/path/to/my/modules/pom.xml' : 'All modules',
'full/path/to/my/modules/util/pom.xml' : 'Utilities',
'full/path/to/my/modules/data/pom.xml' : 'Data handling']
The "value" of the map will be displayed in the build parameters choices:
And "key" of the map will be set in the variable:
> echo "$URL"
full/path/to/my/modules/pom.xml

I found it painful that there were no easy solution to this problem for so many years, like writing a display|value line with the choice plugin, so I finally wrote my own plugin: https://github.com/Avalancs/ChoiceWithDisplay
You can get the .hpi file from the release tab, and if you don't know how to install .hpi files check this SO post: https://stackoverflow.com/a/19588907/7216760

Related

How do I set a secret value with build script interaction on team city?

I know I can define a secret value like this in kotlin DSL on teamcity:
params {
password(
"env.MY_SECRET_VALUE",
"credentialsJSON:faf2d7c8-3565-452a-8cfe-a7a55a4f0f4c",
display = ParameterDisplay.HIDDEN
)
}
How do I achieve the same with build script interaction? I mean a command of the kind
##teamcity[setParameter name='env.MY_SECRET_VALUE' value='1234']
Is it possible at all? I was unable to find this use-case in this documentation, which is the most complete I've found until now on the topic.
The way I understand it, making this happen with build script interaction makes no sense, because I'd need to write a command like
echo "##teamcity[setParameter password='env.MY_SECRET_VALUE' value='1234']"
assuming such a command existed. That means TeamCity will display that line in the logs with the value not hidden, making it therefore pointless.

TeamCity parameter specification referring to another parameter?

I am using the latest version of TeamCity and I am trying to make a parameter specification that refers to parameters.
I tried making a select (combobox), where the options of the checkbox are referring to variables. This should be possible, as there is a "parameter" icon to the right of the box suggesting me that I can use parameters here.
The full setup is shown below.
However, when I want to run the build, the only options are literally %foo% and %bar% as if the parameters have not even been evaluated.
Instead I had expected the options to contain the values of the variables that they are pointing to.
What am I doing wrong here?
Might be a bit late, but this is how I did it:
I have a few parameters for holding passwords, e.g. 'mfgpwd'
And I refer to these in another parameter using the syntax:
mfgpwd=%system.mfgpwd%
(I'm using TeamCity 8.1.5)

Robot Framework Properties File

I am using robot framework for web automation and I am wondering how to set up a properties files such as config.properties in Java in order to set different assertions for example depending on the language used.
For example :
Let's say I would like to assert a title of a page.
Location Should be Title in English
Location Should be Title in French
Location Should be Title in Italian
Is there a way to use only one assertion in my test case and use a different file that will do the corresponding assertion depending on the language of the website : website.com, website.fr, website.it ?
Thanks
After some research I have found out that robot framework offers the possibility of doing this through variables files.
Variable files are python module where I can simply set variables for each website version : EN,FR,IT
Example of varfilefr :
TITLE = "title in french"
In my tests case I would use
${TITLE}
Then in command line I enter the variable files as parameter, all variables set in variable file will be taken in account when running the test.
pybot -vbrowser:firefox -vbaseurl:FRURL --variablefile frvariablefile.py test.robot

What else can be learned from the Installer.ProductInfo property?

Installer.ProductInfo is this.
I take this script, and I want to get various information (ex: UpgradeCode), where I can see all parameters, witch I cat set instead of "Version" (here installer.ProductInfo(product, "Version")). Yes, I see For Each property In Array..., but it is not enough for me (where "UpgreadeCode"?)). And where did this Array?
For a full list of supported properties check the description of the szProperty parameter of the MsiGetProductInfo function.
Most properties in this article are specified using predefined constants (e.g. INSTALLPROPERTY_HELPLINK instead of "HelpLink"); the actual string names of these properties are defined in the msi.h header file that is part of Windows SDK. A copy of msi.h v.4.0 can also be found online here.

Rename dash in JasperServer List Filter control to something meaningful

The list filter control in JasperServer shows "---" as the default options.
What's the procedure to rename it to something meaningful, such as "ALL"?
It doesn't seem to be in jasperserver_message.properties. Is there any other location, where we need to make the change? Or, does it require rewriting of filter control itself?
Thanks in advance.
I have not tested... but I searched like this: grep -rn "\-\-\-" ./webapps/jrs-pro-5.0.1/WEB-INF/bundles
/usr/local/apache-tomcat-6.0.32/webapps/jrs-pro-5.0.2/WEB-INF/bundles/querybuilder_messages.properties
Line 65: page.filters.filter.empty.string=---
"ALL" would be more obviously meaningful... but in many cases the meaning would be wrong. But if your reports are defined so that not selecting a value results in all results being returned, then it could be a good customization in your deployment.

Resources