Display the active selected parameters as comma separated values with in a box in Jenkins - jenkins

I have certain build parameters followed by active choices(radio button, drop-down etc)
Once after selecting each option I want to display all the selected items as comma-separated value with a box (It's just a confirmation box having all the selected values after which I must proceed to build)
[Build parameters]
https://i.stack.imgur.com/vJjCz.png
[Expected]
https://i.stack.imgur.com/gkJXd.png

You can use the Active Choices Reactive Reference Parameter to active this.
Add Reactive Reference Parameter to you job, call it Test Data, in the Referenced parameters section reference your existing parameters OperatingSystem,OSVersion,TestSuites,ProbeDeploymentType, in the Choice Type choose Formatted Html so you can customise you display box, and in the script section just create the format you want to print and design the HTML for it.
Here is an example with a textarea:
summeryList =TestSuites.split(',').collect { suite ->
"${OperatingSystem}, ${OSVersion}, ${suite}, ${ProbeDeploymentType}"
}
return "<textarea cols='50' readonly name='value' >${summeryList.join('\n')}</textarea>"
You can of course customize the html layout however you want.
Here is a screenshot of the parameter config:
and the result build page:

Related

How to enable a parameter when a choice is choose in Jenkins Build with parameters option

I have a pipeline with parameters where I want to enable certain parameter only when the option is chose from the previous parameter.
Say for ex: In the choice parameter, I have a choice called "India" when I choose, I want a text box to be displayed with the Label Value called "Enter your State". I tried with Active Choice Reactive Parameter and Extended Choice parameter.
Could someone help me with the solution/code for the above mentioned situation.

How to define dynamically the label of a 'text field' control in Orbeon Forms?

I wish to ask you if it is possible to define dynamically the label of a 'text field' control when a form is loaded. Actually, I need to pass the label value through a URL parameter and use this value to define the label. Is that possible? I've made a research for a similar case but I cannot find a way to get the value of a url parameter and set it as a control's label before the form is displayed in the user.
Regards,
George
In the Control Settings for your control, in the Label tab, do something as follows. Here I'm getting the value of the foo request parameter, but you'll most likely want to use a more meaningful name.
That's it, really: with this, when you load your form, say with the URL http://localhost:8080/orbeon/fr/a/a/new?foo=bar, the control will get "bar" as its label. Also see Template syntax.

TFS 2015 Copy Template URL dropping value

Using TFS 2015 we have several custom fields on a PBI work item.
These fields are type Int and have ALLOWEDVALUES rule of zero (0) to five (5).
When I try to create a template by creating a new template by clicking on the Copy Template URL and the value of the custom field is zero the resulting url contains:
&%5BMyCompany.MinorRelease%5D=
If I set it to any other allowed value I get:
&%5BMycompany.MinorRelease%5D=2
Is there a way to make the valid value of Zero appear?
I can reproduce the behavior too and have helped you submit a feedback on Microsoft Connect. You can track it here:
https://connect.microsoft.com/VisualStudio/feedback/details/1957055
And following are the workaround to this:
a). Since only the value "0" cannot appear in the URL, you can define a DEFAULT value "0" for the field, then the field value will be filled with "0" by default when you create the work item (The parameter will not appear in the URL when the field value matches default value.). And when you create a template URL with other values specified, the URL can show these values correctly.
b). The created URL is editable, you can add the value "0" behind "&%5BMyCompany.MinorRelease%5D=" manually and then share the updated URL to your team.

Dynamic or Conditional display of Jenkins job's parameters (rather than their value population)

Let's say I have two(or more) types of projects: app(Application) and svc (Service) and I have created a Jenkins job (common job) which have bunch of parameters. This common job might call another downstream/individual project type jobs (Trigger other project builds etc and pass respective parameters) but it's out of scope of this question.
For ex:
PROJ_TYPE (a choice parameter type with values: app, svc)
Param2 (of some type)
Param3 (of Cascading type i.e. it depends upon the value of parent parameter PROJ_TYPE).
Param4 (Lets say I want to show this parameter only when PROJ_TYPE is selected as "app")
Param5 (of some type)
Param6 (Lets say I want to show this parameter only when PROJ_TYPE is selected as "svc". This parameter can be of any type i.e. choice, dynamic, extended choice, etc )
If I have the above parameters in a Jenkins job, then Jenkins job will show / prompt all of the parameters when a user will try to build (i.e. Build with Parameters).
Is it possible in Jenkins to show parameter (Param4) only if PROJ_TYPE parameter was selected as app otherwise, I don't want to show this parameter at all -or somehow if it's possible to grey it out? i.e. in this case, the job will show only PROJ_TYPE, Param2, Param3, Param4 and Param5 (and will not show Param6 or it's disabled/greyed out).
Similarly, I want to show parameter (Param6) only if PROJ_TYPE parameter was selected as svc otherwise, I don't want to show this parameter at all -or somehow if it's possible to grey it out? i.e. in this case, the job will show only PROJ_TYPE, Param2, Param3, Param5 and Param6 (and will not show Param4 or it's disabled/greyed out).
I know this is an oldie, but I had been searching for something similar until I found Active Choices Plugin. It doesn't hide the parameters, but it's possible to write a Groovy script (either directly in the Active Choices Parameter or in Scriptler) to return different values. For example:
Groovy
if (MY_PARAM.equals("Foo")) {return ['NOT APPLICABLE']}
else if (MY_PARAM.equals("Bar")) {return ['This is the only choice']}
else if (MY_PARAM.equals("Baz")) {return ['Bazoo', 'Bazar', 'Bazinga']}
/Groovy
In this example MY_PARAM is a parameter in the Jenkins job. As long as you put 'MY_PARAM' in the Active Choices 'Referenced Parameters' field the script will re-evaluate the parameter any time it is changed and display the return value (or list of values) which match.
In this way, you can return a different list of choices (including a list of one or even zero choices) depending on the previous selections, but I haven't found a way to prevent the Parameter from appearing on the parameters page. It's possible for multiple Active Choice Parameters to reference the same Parameter, so the instant someone selects "App" or "Svc" all the irrelevant parameters will switch to 'Not Applicable' or whatever suits you. I have played with some HTML text color as well, but don't have code samples at hand to share.
Dirk
According to the description you may do this with Dynamic-Jenkins-Parameter plugin:
A Jenkins parameter plugin that allows for two select elements. The second select populates values depending upon the selection made for the first select.
Example provided on the wiki does exactly what you need (at least for one conditional case). I didn't try it by myself.
#derik It worked! for me
the second list is populating based on the choice of the first element.
I used Active Choice reactive parameter plugin,
the requirement was the first param will list my servers,
based on the fist selection, the second parm is to connect to selected server and list the backup.
so the list of available backup will the shown here to restore.
enabled parameterized.
Select Choice Parameter
Name: Server
Choices : Choose..
qa
staging
master
Description : Select the server from the list
Add new parameter "Active Choice Reactive Parameter"
Name: Backup
Script: Groovy Script
def getbackupsqa = ("sshpass -f /opt/installer/pass.txt /usr/bin/ssh -p 22 -o StrictHostKeyChecking=no myuser#111.22.33.44 ls /opt/jenkins/backup").execute()
if (Server.equals("Choose..")) {return ['Choose..'] }
else if (Server.equals("qa")) {return getbackupsqa.text.readLines()}
else if (Server.equals("staging")) {return ['Staging server not yet configured']}
else if (Server.equals("master")) {return ['Master server not yet configured']}
Description : Select the backup from the list
Referenced parameters : Server
The result as here

SSRS Render Report through URL

I have a report that is being passed parameters through the URL, but would like to have the report load by default before the user has to click the 'View Report' button. I have rs:Command=Render in the URL but this doesn't seem to be doing it. Is there another tag that I am missing here? The URL is currently as follows:
https://server/subfolder/viewreport.aspx?Report%Name&rs:Command=Render&Parameter1=Value1&Parameter2=Value2
The report comes up with the appropriate values selected by default, as passed above, but it does not run until I hit View Report. Do I need to specify all the other parameters in the report through the URL in order for it to run by default, even though those parameters already have default values?
Found it, the report renders automatically as long as all parameters have a 'Default' value specified. Two text parameters in the report needed to have their default expressions set to =""

Resources