Jenkins view to list jobs matching two conditions - jenkins

Need some help regarding jenkins job view;
I need to have one Jenkins view which matches two conditions
Specific Job name (ex: all the jobs which has trunk as one of the string in job name)
and Job Status;
Basically i need to list all the jobs which has job name containing trunk and which is failed under one view.
I know there is sectioned view and list view where we can list the jobs based any one of the condition above but i need to match both the condition.. is there a way to do this using any of the Jenkins Plugins?
Appreciate your help in this regard.
Regrds,
Raju.

You can use the View Job Filters plugin for this - it lets you build views which chain together filters to create the custom views, and the filter options include:
Job name, including regular expression filters (i.e. you could filter by ^.*trunk.*$)
Job status
I think that should allow you to build the list view you need. The image below shows an example taken from the build system I manage, where we were able to create a view with the same characteristics as you require (naturally exchange labos for trunk).

Related

How can I show all Jenkins jobs in one view, even if they are contained in folders?

I want to see all jobs that are defined on our Jenkins.
We use folders to structure our jobs, yet we also would like to have an overview view of all jobs without this folder structure, i.e., a flattened list of our jobs.
The first step is to create a new view:
This view has to be named and as view type one has to select "List View":
In the configuration view, following points have to be set:
Recurse in subfolders: yes
Use a regular Expression to include jobs into the view: yes
Regular expression: .*
This lists all jobs running on Jenkins in one view.

How to add conditional parameter to jenkins

I want to add a conditional parameter to jenkins job. In other words, I want to add a boolean parameter when checked, another string parameter appears to the user when they build the job. If not checked the string parameter should not appear as a parameter when the user builds the job (Kind of a similar behaviour to the conditional steps of jenkins but on parameters.). Is their a plugin for that?
In the image below, if repo_update is not checked: Clean and Changesets should not be present to the user if they are building the job.
You might want to look at the Multi job plugin
Make the parent and child two separate jobs. This to me makes more sense logically.
In the build part, run the parent job first.
Based on a condition, the child job can run.
You can add the child params in the child job only, so people who configure the parent job will never see the child params
This to me feels like a cleaner implementation.

Dynamically grouping jenkins job results

I've had a dig around but can't find an elegant solution for what I want to do, so I hope some of you may be able to offer some suggestions. I've also asked this question on a jenkins forum, but no takers.
I want to be able to run a jenkins parent job with parameters that will feed down to triggered jobs, and then group all the job run results in a view dynamically.
The use case I'm trying to cover is: We have 10+ different jenkins jobs that run suites of tests, I want to simply manage a run of all those jobs to run against a specific code branch, on a specific test environment, and see the results (in one view) for only that run. The complication is the same Jenkin job may be run against another release or test environment and I don't want to see those results.
We already have the parent job triggering children with parameters, but I can't figure out how best to group the results.
I know I can create filters for views, but the name of jenkins jobs is static, and I want the view created at runtime, without having to build it myself. We do use the 'Set Build description' Plugin, so I could create a view that filters for a unique build descriptor, or something similar. But there doesn't seem to be a way to create views with filter programmatically.
Other considerations would be clean up. I wouldn't want a years worth of views clogging the views, so I need a way to clear out old runs too.
Any ideas to kick me off?
For groupping of reports you can just use a simple logic instead of finding a Jenkins plugin. You can place all the result files (preferably XMLs) in a common folder/ file server and at the end of execution of all the suites (jobs) you can trigger a common job which will process all the XML files and generate a common report. By this you can have " consolidated + individual reports ".
I have done it using Perf Publisher plugin which process XMLs and gives a beautiful aggregated report.
Job1 ----> Report1 ----> Move report of report folder
Job2 ----> Report2 ----> Move report of report folder
Job3 ----> Report3 ----> Move report of report folder
.
.
.
Job n ----> Report n ----> Move report of report folder
So after completion of job n, trigger Report job which will operate on "report" folder containing all the reports!
Hope it helps!
I have a partial solution:
All jobs accept a parameter called VIEW_IDENTIFIER.
Parent job is kicked off with a unique VIEW_IDENTIFIER being set, and all the child jobs have that passed into them when run.
After all jobs are run I edit a Jenkins View that has a 'Job Filter - > Parameterized Jobs Filter - > Name = VIEW_IDENTIFIER, Value = my unique ID set for the run'
This results in all jobs run with that unique ID being grouped in one single view for review.
The shame is I have to do the manual edit of the Job Filter.

based on options selected in first job, how to trigger another job in Jenkins using Dynamic parameter plugin

I have 3 Jenkins jobs 'J1', 'J2', 'J3'. Now I have to create another Job 'Jselect' which takes user inputs or a drop down having values J1, J2, J3. Based on the user selection it should trigger the jobs J1 or J2 or J3.
To achieve this, I installed DynamicParameter plugin and created the job 'JSelect'.
In JSelect job, I selected 'This build is parameterized' option and then added a Dynamic Choice Parameter.
Provided the name as : Choose Target Job:
Choices Script as : def list=['J1','J2','J3']
When I Saved and build the job, a dropdown is coming as expected. But Iam not understanding where to capture this input and how to call other jobs based on this input.
I am on the right approach? Can someone please help on how to achieve this?
you need to trigger J1/J2/J3 based on some condition from Jselect.
I suggest you the below approach.
build step make variable or property file to decide the condition.
eg(when error ~>5=low ,error ~>15=medium, error ~>50 =high)
Use https://wiki.jenkins-ci.org/display/JENKINS/Parameterized+Trigger+Plugin
It helps you to select downstream project based on different condition.
Make sure you uncheecked"trigger build when there is no parameter".
Hope its resolves your issue.

Concern with jenkins multiple poms execution

I want to create only one job of jenkins and trigger the multiple poms with it i have done the same in ant by using the conditional buildstep plugin
My actual design is that i want to use is suppose I create the one job with name ABC and i m maintaining the tar file with this name and in this job i want to maintain the multiple builds
like ABC-type-I, ABC-type-II, ABC-type-III ........ all of them have there pom layering(maven structure) and i want to create the conditional steps like at run time i would be able to decide for which types the build is included in the tar i know that it can be done using conditional steps plugin but want to know the better approach if any in ur mind please share...........................
I find out the solution of my problem what I did is that I have used conditional build step plugin in Jenkins, so I made the one parent pom and then make the respective child pom for each sub module of my parent module and through conditional plugin I was able to give or create the prebuildsteps(go to conditional single step or multiple and then u can give the pom.xml there of your sub module) or you can make your job as dynamic as well that if you want to to include only sub module 1 not sub module 2 in your parent module than you can make the checkbox there by using the boolean parameters and executes the conditional steps only when there value is true(means checked)

Resources