Differentiate job history based on parameters in Jenkins - jenkins

I would like to set up a Jenkins based CI system, where the job histories are dynamically managed based on the parameters coming from webhook triggers.
Currently, I can only trigger specific jobs, maybe with applying filters, but it will not handle jobs dynamically.
I aim for a solution, where a parameter (or group of parameters) identifies a job with its own history. If the job history does not exist, it is created automatically.
In the results, I would like to somehow mimic the behavior of the GitHub PullRequest plugin. The problem with it, that it is tightly coupled with GitHub but I need a more generic solution.
I see two marginally different solutions here:
Manage jobs
Jobs can be managed based on the build parameters. The jobs dynamically created and deleted.
Filter builds
The job remains the merged job containing all the Pull request for all the branches, and some UI features able to filter out the different histories from it based on the parameters.
I do not know if any of this is achievable with currently available Jenkins plugins, or if I have to implement something from scratch?
Thank you for any answers!

Actually, I was looking for the Multibranch Pipeline approach, just I didn't know about it yet.
That is actually doing the same that I described for GitHub and BitBucket.
I was lucky as my target was BitBucket.

Related

Show help about comment triggered jenkins jobs in gerrit

I have a gerrit - jenkins setup. Several jenkins jobs are started by a trigger based on a comment inserted to gerrit. The number of comment based triggers increases continuously. The project has a separate document with information what keyword in a comment executes what action.
It would be nice to provide a list of keywords directly in gerrit so developers do not need open documentation when searching for a specific keyword. Is there a way how to customize gerrit to show some hints when a user edits a comment?
Please follow the Checks plugin - currently is active development. It is/will be a complete redesign of how CI will do checks and how users interact with the CI checks being run. I don't think there's Jenkins integration for this already other than (custom) Groovy scripting polling the REST API at the time of writing.
The UI will allow users to trigger, re-run checks without the need for adding some magic comment! :-)
It's currently deployed on the Gerrit of Gerrit for purely optional checks:
So far (Gerrit 3.0.0) there isn't a way to do that.

Complete chronological list of all builds in Jenkins

This sounds like something like Google should answer but I could not get it to:
I want to list all the builds ever invoked in all of Jenkins, ordered chronologically descending. Not just all the builds of a single job, which is available on the job page, but all of Jenkins. How do I do that? How do I know what the last 5 most recently invoked builds were? It is a very basic function but I can't seem to find a way to do it.
The All jobs tab, which lists all the jobs, could not be sorted.
check out this plugin:
https://wiki.jenkins.io/display/JENKINS/Dashboard+View
related thread: Change order of jobs in Jenkins

Summary comment on github pull request from different Jenkins jobs

I have multiple jobs for one Pull requests running on Jenkins.
When a build is done, a comment is posted by a github account to inform it was done, so people get a notification.
It was fine when it was one job per pull request but now it is more spam than anything else.
One simple solution would be to have notifications on build check but it is not provided by github.
Another way would be to get a summary from those jobs when all are done, but I also don't have any idea on how to proceed on this.
Would there be a more cleaner way or a plugin doing this?
You can try using MultiJob plugin.
Create a parent Job and under that add all your jobs. And configure in such a way that, it triggers the parent job which in turn triggers the child job.
This way, it will notify the github only when all the child jobs are completed.

Is there a way to configure a view of builds that I started in Jenkins?

We have 'try' build jobs that developers can initiate with parameterized variables to point to a particular branch for pulling the code and trial running the build in jenkins. Is there a way I can customize a custom personal view showing only the builds that I have started?
The custom way
I think there's a way to customize a personal view by coding / modifying your Jenkins installation, jan-molak worked on that feature here.
You can check the commits and maybe implement something by your own, especially this and this.
The plugin
Take a look on View Job Filter If you configure it, there are options which seems to acomplish what you want:
Logged-in User Relevance Filter: This adds/removes jobs based on their
relevance to the logged in user. For example: matching jobs that were
started by the user, or where the user committed changes to the source
code of the job; matching jobs with a name that contains the user’s
name or login id.

Avoid simultaneous job modifications in Jenkins

I am using the Jenkins Job DSL Plugin to create template jobs.
There is a problem when two or more users are modifying the same template job (or any other job) simultaneously. The configuration of the last user to save or apply the modifications are registered and the modifications of the other user are removed because the two users were working on the same configuration version.
For example: Recently, I had to add a user to the global authorization matrix in a template job. I did that and i saved and build it. However, another user was modifying the same template job all day and he saved it at the end of the day and my changes were removed.
Is there a way to avoid this simultaneous job modifications by locking the configuration of a job for other users when that user is currently updating it?
Not currently available in core.
Full Answer

Resources