Is any Jenkins plugin which could check jobs configuration against recommandation ? - jenkins

We manage a large Jenkins instance(< 1000 jobs). We made some recommendations about job configuration like number of artifacts to keep, number of jobs to keep etc.
Is there a plugin which could check for jobs that do not respect this recommendation, and report them?

I've used the Groovy Script Console or the Configuration Slicing Plugin to accomplish these tasks.

Related

Jenkins: Automated job configuration using Seed Jobs and Jenkinsfile

I am trying to understand how to best deploy an instance of Jenkins, complete with plugins, users and jobs using Chef. I am currently using the Chef Jenkins Supermarket cookbook.
I am attempting to achieve automated deployment of our Pipelines as part of the project. From what I have gathered, the best way to go about this is to have Chef configure a seed job in Jenkins initial setup and configuration.
The seed job should specify, among other things, the git repository from which to find and use a Jenkinsfile for a given job. I've found this resource by Daniel Spilker to be helpful in explaining seed jobs.
So the seed Jenkins job would be run, which would then generate the Jenkins job we have just scripted with it (in this case the seed job would be to pull the Jenkinsfile from source control and configure a new Jenkins job (our pipeline), with the details of the Jenkinsfile).
Am I understanding this correctly as the proper way to not only automate Jenkins job configuration, but also as the proper way to always have an up to date job configuration for any given job in the event the job configuration were to change?
If we used a seed job to setup our pipeline, what are some possible solutions to having the initial seed job run automatically once Jenkins is fully configured by Chef?
As for job configuration changes that may occur over time, would we need to setup the seed job to poll source control for any changes in the Jenkinsfile periodically in the event the Jenkinsfile has been modified? (It may be helpful to note that we are currently using BitBucket for source control).
Just getting started with pipeline as code. Thanks to everybody in advance for their patience and guidance.
I've mentioned this a bit in your other questions, but the least painful approach is to treat Jenkins as a database, not a web service. Have Chef do the basic install, but then configure the initial bits by hand. For DR, rely on your backups rather than Chef.

How to set a different reference build or set dynamic thresholds to Jenkins plugin?

We have a master job that builds the master branch and various plugins ex.warnings plugin tracks the counts of warnings detected in master.
Then we have a gerrit job that build the gerrit patches.The warnings plugin and other plugins by default compare delta against previous successful gerrit build. But we want to make compare warnings counts against the master build instead. Is there some known way to specify to use a different job as reference?
I can think of following roundabout ways.
Execute post-build script in master job that will update the
thresholds in the gerrit job config.xml and reload.
Set dynamic thresholds with job parameters..but will not work if plugin will not accept parameter variables as thresholds.
Does someone know other or better solutions to this?
There is a way how to use a different job as a reference in warnings-ng-plugin.
It can be done like this in the declarative pipeline syntax:
recordIssues tool: java(), referenceJobName: 'my-project/master'
More information in the documentation: https://github.com/jenkinsci/warnings-ng-plugin/blob/master/doc/Documentation.md#control-the-selection-of-the-reference-build-baseline

Save all Jenkins jobs to a repository

I have 15 Jenkins jobs configured in order to implement a specific flow. I am improving and editing these jobs as time goes by.
Is there a way to save all these jobs and its configurations to a repository or at least in the form of export jobs, save it and import when needed?
There are two plugins that will help you save Jenkins jobs, "SCM Sync configuration" and "JobConfigHistory" defined at the wiki.jenkins-ci.org website.
SCM Sync Configuration Plugin (which keeps the config in a SCM repository)
or
Job Config History Plugin (Saves copies of all job and system configurations)
The Job DSL Plugin allows to define the jobs in a DSL and store the DSL scripts in a SCM repo. The DSL increases the readability of the config files in contrast to the XML format.
For an intro, see the slides and video from the Configuration as Code: The Job DSL Plugin talk at the Jenkins User Conference 2015 in London.
You can move/copy jobs to another destination simply by copying directory with job (default path for jobs directories is /var/lib/jenkins/jobs).
You can get more info here - https://wiki.jenkins-ci.org/display/JENKINS/Administering+Jenkins
The Workflow feature may let you write your entire process as one (Groovy) script, which you can then maintain in your version control system alongside other sources.

Decentralised execution of jobs in jenkins

I came across multi job plugin which helps in executing jobs parallelly but I want to reduce the load on server.So I want to decentralised the execution of jobs.
Is it possible in jenkins to achieve this.If yes then how to achieve it.
Here you have a comprehensive description how setup distributed builds in Jenkins.
You can also try to create build pipelines.
Try Build Flow Plugin
You can run both sequential and parallel by using this plugin.

Jenkins Build Stability/Statisitics Report plugin

I have a jenkins instance running around 200 jobs. What I need is a plugin to show the build statistics for all the jobs.
Total Builds for each project
Failures
Success
Average time per build.
Searched a lot, but couldn't find a proper report plugin. Please help
These are few which you can look depending on how much customization/features you want to do/display:
https://wiki.jenkins-ci.org/display/JENKINS/Global+Build+Stats+Plugin
https://wiki.jenkins-ci.org/display/JENKINS/build-metrics-plugin
https://wiki.jenkins-ci.org/display/JENKINS/Project+Statistics+Plugin
https://wiki.jenkins-ci.org/display/JENKINS/eXtreme+Feedback+Panel+Plugin
https://wiki.jenkins-ci.org/display/JENKINS/InfluxDB+Plugin
https://wiki.jenkins-ci.org/display/JENKINS/CouchDB+Statistics+Plugin
And there is Dashboard-View too.
For collecting nodes machine metrics (CPU Time/ Used Memory / Build Time per node etc.), I found the monitoring plugin to be the best.
https://wiki.jenkins.io/display/JENKINS/Monitoring
When it comes to aggregates build times group by job, I couldn't find anything good within Jenkins UI, but if you have a datadog license, you can just enable the datadog Jenkins plugin, configure the datadog api key and hostname in Jenkins Config, and you are good to go.
https://www.datadoghq.com/blog/monitor-jenkins-datadog/

Resources