Need to include pipeline job inside jenkins "build metrics" plugin - jenkins

I am using "Build Metrics" plugin in jenkins. It is showing free style jobs details only not including pipeline jobs.
(https://i.stack.imgur.com/53te9.png)
I need to include pipeline job inside this plugin or do you know any other plugin to get pipeline report.

1.Go to the Jenkins configuration page for the Build Metrics plugin.
2.Scroll down to the "Job Type Filter" section and select the "Pipeline" option.
3.Save the changes and restart Jenkins.
4.Go back to the Build Metrics dashboard and you should now see the pipeline jobs included in the report.
Alternatively, you can use the Jenkins Performance Plugin to get a report on pipeline jobs. This plugin provides detailed performance reports for both freestyle and pipeline jobs, and it also includes graphs and charts to help you visualize the performance data. You can find more information and installation instructions for the Jenkins Performance Plugin on the official Jenkins website.

Related

Jenkins build history for all jobs

I'am using Jenkins and I would like to have statistics of all builds executions.
I'am already using the plugin "build-metric" but pipeline jobs are not included in the statistics.
How to include pipeline jobs in the result of this plugin ? Or do you know an another plugin which include pipeline job ?

What is the difference between Build pipeline and Delivery pipeline in Jenkins?

I would appreciate if anyone could briefly point out what the difference between Build and Delivery pipelines in Jenkins? Are they the same with different producers?
I don't have a depth knowledge of both plugin but from my experience, the subtle difference between the Delivery Pipeline Plugin and Build Pipeline Plugin is that the first one allows you to use Freestyle Jobs and Pipeline Jobs while the second one only allows Freestyle Jobs.
So if you're using Shared Libs for your pipelines and want to use any of this plugins to have an overview of downstream and upstream Jobs you should definitely go for Delivery pipeline plugin
Build Pipeline Plugin:
https://plugins.jenkins.io/build-pipeline-plugin/
Delivery Pipeline Plugin:
https://plugins.jenkins.io/delivery-pipeline-plugin/

Are there any ways to improve the developer experience of writing a Jenkinsfile?

I've been following a few tutorials to get started with Jenkins, and they all describe the same workflow:
Write a Jenkinsfile
Add it to SCM
Add the project to Jenkins via the Web UI
Trigger a build in Jenkins
Modify the Jenkinsfile
Commit changes
goto 4
Is this really the only way to develop a Jenkinsfile? It's a terrible developer experience.
Does Jenkins include any developer conveniences, like the ability to watch a Jenkinsfile and trigger builds automatically, without using SCM?
Are there any other tools out there to improve the developer experience of writing Jenkinsfiles?
With jenkins you can automate the execution of a job or Pipeline with:
jenkins-cli.jar command line tool
REST API
You can also install plugins to configure hooks on your SCM server and automate the Pipeline or Jenkins job execution on every commit event.
If using github you can use the GitHub plugin
If you want to skip the adding project via the web UI, you can consider to automate the project creation by using:
multibranch pipelines that way every branch of a repo will be scanned in order to find a Jenkinsfile and if it is found it will be parsed and the project will be created
Use job dsl to automate the Pipeline project creation.

Can I store Jenkins configuration in the project repo (like Travis CI)?

How do you maintain the Jenkins job configuration in SCM along side the source code?
As source code evolves, so does the job configuration. It would be ideal to be able to keep the job configuration in SCM, for the following benefits:
easy to see who a history of the changes, including the author and the description
able to rebuild old branch/tag by checking out the revision and build just work
not having to scroll through the UI to find the appropriate section and make change
I see there is a Jenkins Job Builder plugin. I prefer a solution along the lines of Travis CI, where the job configuration is maintained in a YAML file (.travis.yml). Any good suggestions?
Note: Most of our projects are using Java & Maven.
Update 2016: Jenkins now provides a Jenkinsfile which provides exactly this. This is supported by the core Jenkins developers and actively developed.
Benefits:
Creating a Jenkinsfile, which is checked into source control, provides a number of immediate benefits:
Code review/iteration on the Pipeline
Audit trail for the Pipeline
Single source of truth for the Pipeline, which can be viewed and edited by multiple members of the project.
I've written a plugin that does this!
Other than my plugin, you have some (limited) options with existing Jenkins plugins:
Use a single test script
If you configure your Jenkins to simply run:
$ bash run_tests.sh
You can then check in a run_tests.sh file into your SCM repo and you're now tracking changes for how you run tests. However, this won't track configuration of any plugins.
Similarly, if you're using Maven, the Maven Project Plugin simply runs a specified goal for your repo.
The Literate Plugin does allow Jenkins to run the commands in your README.md, but it hasn't yet been released.
Track changes to Jenkins configuration
You can use the SCM Sync configuration plugin to write configuration changes to SCM, so you at least have a persistent record. This is global, across all projects on your Jenkins instance.
There's also the job config history plugin, which stores config history on the filesystem.
Write Jenkins configuration from SCM
The Jenkins job builder project you mentioned lets you check config changes into SCM and have them applied to your Jenkins instance. Again, this is across all projects on your Jenkins instance.
Write Jenkins configuration from another job
You can use the Job DSL Plugin with a repo of groovy scripts. Jenkins then polls that repo, executes the groovy scripts, which create job configurations.
Discussions
Issue 996 (now closed) discusses this, and it has also been discussed on the mailing list: 'Keeping track of Hudson's configuration changes', and 'save hudson config in svn'.
you can do this all with the workflow plugin and a lot more. Workflow is one of the most advanced technics to use jenkins and it has a very strong support.
It is based on a groovy DSL and allows you to keep the whole configuration in the SCM of your choise (e.g. GIT, SVN...).

What is the advantage of the Jenkins SonarQube plugin over adding sonar:sonar to maven build step

I am using Maven as a build tool and Jenkins as a CI tool. Currently I have a Jenkins job configured with a Maven build step.
I started using SonarQube and was wondering what is the advantage of using the Jenkins SonarQube plugin and configuring the SonarQube analysis as a post-build-action over simply adding sonar:sonar to the goals of my existing Maven build step.
Thanks and best regards,
Ronald
You can save a lot of configuration. So, if you use jenkins sonar plugin you can centralize database credentials and sonar credentials but if you make a decision about execute sonar:sonar in each jenkins job you will configure each with the same credentials.
I just found: Why use sonar plugin for Jenkins rather than simply use maven goal "sonar:sonar"?
And to add one reason: Using the Jenkins SonarQube plugins one can specify "Skip if triggered by SCM Changes". This is nice if you trigger your Jenkins job for each commit but only want to do a SonarQube analysis at a scheduled time, e.g. one per night.
And here is a summary of the the points made by "emelendez":
Centralize database credentials and sonar credentials Use jenkins
Use jenkins sonar plugin configuring SonarRunner for non Java projects
I've just changed to maven-sonar-plugin from the Jenkins SonarQube plugin to avoid divergence of information between the pom.xml and sonar-project.properties.
For example, developers elsewhere had bumped the project version number in the pom.xml, but they don't use the Jenkins builds and didn't care about the sonar-project.properties (or probably understand it). By switching to the maven plugin instead, the project version is defined once and referenced in the sonar property set within the pom.
The downside is that I no longer have the SonarQube link from the project's Jenkins page.
I'm not sure where the responsibility might be for adding this link back for projects using maven-sonar-plugin... The link is "owned" by the Jenkins SonarQube Plugin, but this is not being used here. Meanwhile the maven-sonar-plugin component is integrating with maven not Jenkins.
Something would need to observe the build and extract the SonarQube link which is emitted as a [INFO] ANALYSIS SUCCESSFUL, you can browse http://... line in the log.

Resources