Discussion:
Jenkins dashboard report with customization
trupti bhatt
2018-11-06 09:35:44 UTC
Permalink
I want to get the jenkins report as in this template:

[image: enter image description here] <Loading Image...>

so which plugin will help me to get such kind of report?

I have tried multiple plugins, but no luck. I have tried test analyzer
report, dashboard view and jenkins matrix and trends plugin.


I think Groovy scripts may help. can anyone help me on it?




Thank you,

Trupti Bhatt
--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/291de8a3-6bf5-4d5e-ae15-625044d11aaa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
RAJENDRA PRASAD
2018-11-08 10:18:49 UTC
Permalink
Hi Tripti,
You are correct there is no plugin that can help you to create a custom
dashboard specified by you.

All you need to write a groovy script to access Jenkins job history and
prepare report according to your need


First get list of jobs via groovy script:

Jenkins.instance.getAllItems(Job.class).each{
println it.name + " - " + it.class
}


Next get each job and get build status :
Following link has script that can help you in that:

https://github.com/cloudbees/jenkins-scripts/blob/master/get-build-information.groovy

You need to use groovy plugin and it looks like below link.

https://www.google.com/search?safe=active&q=jenkins+groovy+script+examples&sa=X&ved=2ahUKEwj-weOYx8TeAhXEtI8KHbCMABQQ1QIoA3oECAoQBA&biw=412&bih=660&dpr=2.63#imgrc=qnNClrZNVTUKnM
:

I know I didn't have you full solution but I hope this will give some
direction for to implement your requirement.

Thanks
Rajendra
Post by trupti bhatt
[image: enter image description here]
<https://i.stack.imgur.com/JLX16.png>
so which plugin will help me to get such kind of report?
I have tried multiple plugins, but no luck. I have tried test analyzer
report, dashboard view and jenkins matrix and trends plugin.
I think Groovy scripts may help. can anyone help me on it?
Thank you,
Trupti Bhatt
--
You received this message because you are subscribed to the Google Groups
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/291de8a3-6bf5-4d5e-ae15-625044d11aaa%40googlegroups.com
<https://groups.google.com/d/msgid/jenkinsci-users/291de8a3-6bf5-4d5e-ae15-625044d11aaa%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAMrg02RhWnOG3Pc2MoYuzpdTdSkQtd4Km6i90r1aOs85i%2BFurg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
trupti bhatt
2018-11-12 11:46:24 UTC
Permalink
Thanks Rajendra.

I have tried following code: but throwing me compilation error:

Jenkins.instance.getAllItems(Job.class).each{
Post by RAJENDRA PRASAD
println it.name + " - " + it.class
def jobBuilds=it.getBuilds()
//for each of such jobs we can get all the builds (or you can limit the
number at your convenience)
jobBuilds.each { build ->
def runningSince = groovy.time.TimeCategory.minus( new Date(),
build.getTime() )
def currentStatus = build.buildStatusSummary.message
def cause = build.getCauses()[0]
${currentStatus} | Cause: ${cause}"
// You can get all the information available for build parameters.
def parameters = build.getAction(ParametersAction)?.parameters
parameters.each {
println "Type: ${it.class} Name: ${it.name}, Value: ${it.dump()}"
}
}
}
ERROR: Build step failed with exception
Script1
at
org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:53)
at
org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:52)
at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:307)
at Script1.run(Script1.groovy:1)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:585)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:623)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:594)
at
org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SecureGroovyScript.evaluate(SecureGroovyScript.java:343)
at hudson.plugins.groovy.SystemGroovy.run(SystemGroovy.java:95)
at hudson.plugins.groovy.SystemGroovy.perform(SystemGroovy.java:59)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at
hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:744)
at hudson.model.Build$BuildExecution.build(Build.java:206)
at hudson.model.Build$BuildExecution.doRun(Build.java:163)
at
hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
at hudson.model.Run.execute(Run.java:1815)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)
Build step 'Execute system Groovy script' marked build as failure
On Thursday, November 8, 2018 at 3:49:14 PM UTC+5:30, rajendraprasad reddy
Post by RAJENDRA PRASAD
Hi Tripti,
You are correct there is no plugin that can help you to create a custom
dashboard specified by you.
All you need to write a groovy script to access Jenkins job history and
prepare report according to your need
Jenkins.instance.getAllItems(Job.class).each{
println it.name + " - " + it.class
}
https://github.com/cloudbees/jenkins-scripts/blob/master/get-build-information.groovy
You need to use groovy plugin and it looks like below link.
https://www.google.com/search?safe=active&q=jenkins+groovy+script+examples&sa=X&ved=2ahUKEwj-weOYx8TeAhXEtI8KHbCMABQQ1QIoA3oECAoQBA&biw=412&bih=660&dpr=2.63#imgrc=qnNClrZNVTUKnM
I know I didn't have you full solution but I hope this will give some
direction for to implement your requirement.
Thanks
Rajendra
Post by trupti bhatt
[image: enter image description here]
<https://i.stack.imgur.com/JLX16.png>
so which plugin will help me to get such kind of report?
I have tried multiple plugins, but no luck. I have tried test analyzer
report, dashboard view and jenkins matrix and trends plugin.
I think Groovy scripts may help. can anyone help me on it?
Thank you,
Trupti Bhatt
--
You received this message because you are subscribed to the Google Groups
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/291de8a3-6bf5-4d5e-ae15-625044d11aaa%40googlegroups.com
<https://groups.google.com/d/msgid/jenkinsci-users/291de8a3-6bf5-4d5e-ae15-625044d11aaa%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/a10ec883-07bf-4bcd-919c-410bc0abaa00%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
RAJENDRA PRASAD
2018-11-17 01:08:45 UTC
Permalink
Hi Trupti Bhatt,
Was damn busy , not able to respond for you mail.
Please add import statement on top of your script , it must work,



*import jenkins.model.**

Jenkins.instance.getAllItems(Job.class).each{
println it.name + " - " + it.class

def jobBuilds=it.getBuilds()
//for each of such jobs we can get all the builds (or you can limit the
number at your convenience)
jobBuilds.each { build ->
def runningSince = groovy.time.TimeCategory.minus( new Date(),
build.getTime() )
def currentStatus = build.buildStatusSummary.message
def cause = build.getCauses()[0]

println "Build: ${build} | Since: ${runningSince} | Status:
${currentStatus} | Cause: ${cause}"
// You can get all the information available for build parameters.
def parameters = build.getAction(ParametersAction)?.parameters
parameters.each {
println "Type: ${it.class} Name: ${it.name}, Value: ${it.dump()}"
}
}
}

Other Important links that will help you are:
Here is my Script Collection:
https://github.com/rajendrapenumalli/jenkins-scripts

Other Useful links:
https://jenkins.io/doc/book/managing/script-approval/
https://pghalliday.com/jenkins/groovy/sonar/chef/configuration/management/2014/09/21/some-useful-jenkins-groovy-scripts.html


dont forget to send me you solution (after removing any sensitive data ;))

*Thanks and Regards,*



*Rajendra Prasad Reddy PenumalliSr. Engineer in Testing.Mobile:9008566233*
Post by trupti bhatt
Thanks Rajendra.
Jenkins.instance.getAllItems(Job.class).each{
Post by RAJENDRA PRASAD
println it.name + " - " + it.class
def jobBuilds=it.getBuilds()
//for each of such jobs we can get all the builds (or you can limit the
number at your convenience)
jobBuilds.each { build ->
def runningSince = groovy.time.TimeCategory.minus( new Date(),
build.getTime() )
def currentStatus = build.buildStatusSummary.message
def cause = build.getCauses()[0]
${currentStatus} | Cause: ${cause}"
// You can get all the information available for build parameters.
def parameters = build.getAction(ParametersAction)?.parameters
parameters.each {
${it.dump()}"
}
}
}
ERROR: Build step failed with exception
groovy.lang.MissingPropertyException: No such property: Jenkins for
class: Script1
at
org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:53)
at
org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:52)
at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:307)
at Script1.run(Script1.groovy:1)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:585)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:623)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:594)
at
org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SecureGroovyScript.evaluate(SecureGroovyScript.java:343)
at hudson.plugins.groovy.SystemGroovy.run(SystemGroovy.java:95)
at hudson.plugins.groovy.SystemGroovy.perform(SystemGroovy.java:59)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at
hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:744)
at hudson.model.Build$BuildExecution.build(Build.java:206)
at hudson.model.Build$BuildExecution.doRun(Build.java:163)
at
hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
at hudson.model.Run.execute(Run.java:1815)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)
Build step 'Execute system Groovy script' marked build as failure
On Thursday, November 8, 2018 at 3:49:14 PM UTC+5:30, rajendraprasad reddy
Post by RAJENDRA PRASAD
Hi Tripti,
You are correct there is no plugin that can help you to create a custom
dashboard specified by you.
All you need to write a groovy script to access Jenkins job history and
prepare report according to your need
Jenkins.instance.getAllItems(Job.class).each{
println it.name + " - " + it.class
}
https://github.com/cloudbees/jenkins-scripts/blob/master/get-build-information.groovy
You need to use groovy plugin and it looks like below link.
https://www.google.com/search?safe=active&q=jenkins+groovy+script+examples&sa=X&ved=2ahUKEwj-weOYx8TeAhXEtI8KHbCMABQQ1QIoA3oECAoQBA&biw=412&bih=660&dpr=2.63#imgrc=qnNClrZNVTUKnM
I know I didn't have you full solution but I hope this will give some
direction for to implement your requirement.
Thanks
Rajendra
Post by trupti bhatt
[image: enter image description here]
<https://i.stack.imgur.com/JLX16.png>
so which plugin will help me to get such kind of report?
I have tried multiple plugins, but no luck. I have tried test analyzer
report, dashboard view and jenkins matrix and trends plugin.
I think Groovy scripts may help. can anyone help me on it?
Thank you,
Trupti Bhatt
--
You received this message because you are subscribed to the Google
Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/291de8a3-6bf5-4d5e-ae15-625044d11aaa%40googlegroups.com
<https://groups.google.com/d/msgid/jenkinsci-users/291de8a3-6bf5-4d5e-ae15-625044d11aaa%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/a10ec883-07bf-4bcd-919c-410bc0abaa00%40googlegroups.com
<https://groups.google.com/d/msgid/jenkinsci-users/a10ec883-07bf-4bcd-919c-410bc0abaa00%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAMrg02RQ%3DszhQXU4XneX9h5%3DiijYFnkr53d9fnoZuGwFxpnQsw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
RAJENDRA PRASAD
2018-11-22 07:26:50 UTC
Permalink
Few more info i would like to add:

Unlike the Jenkins Script Console, Jenkins-related libraries are not
auto-imported, so make sure you import the following into your scripts:

import jenkins.*
import jenkins.model.*
import hudson.*
import hudson.model.*






*Thanks and Regards,Rajendra Prasad Reddy PenumalliSr. Engineer in
Testing.Mobile:9008566233*
Post by RAJENDRA PRASAD
Hi Trupti Bhatt,
Was damn busy , not able to respond for you mail.
Please add import statement on top of your script , it must work,
*import jenkins.model.**
Jenkins.instance.getAllItems(Job.class).each{
println it.name + " - " + it.class
def jobBuilds=it.getBuilds()
//for each of such jobs we can get all the builds (or you can limit the
number at your convenience)
jobBuilds.each { build ->
def runningSince = groovy.time.TimeCategory.minus( new Date(),
build.getTime() )
def currentStatus = build.buildStatusSummary.message
def cause = build.getCauses()[0]
${currentStatus} | Cause: ${cause}"
// You can get all the information available for build parameters.
def parameters = build.getAction(ParametersAction)?.parameters
parameters.each {
println "Type: ${it.class} Name: ${it.name}, Value: ${it.dump()}"
}
}
}
https://github.com/rajendrapenumalli/jenkins-scripts
https://jenkins.io/doc/book/managing/script-approval/
https://pghalliday.com/jenkins/groovy/sonar/chef/configuration/management/2014/09/21/some-useful-jenkins-groovy-scripts.html
dont forget to send me you solution (after removing any sensitive data ;))
*Thanks and Regards,*
*Rajendra Prasad Reddy PenumalliSr. Engineer in Testing.Mobile:9008566233*
Post by trupti bhatt
Thanks Rajendra.
Jenkins.instance.getAllItems(Job.class).each{
Post by RAJENDRA PRASAD
println it.name + " - " + it.class
def jobBuilds=it.getBuilds()
//for each of such jobs we can get all the builds (or you can limit the
number at your convenience)
jobBuilds.each { build ->
def runningSince = groovy.time.TimeCategory.minus( new Date(),
build.getTime() )
def currentStatus = build.buildStatusSummary.message
def cause = build.getCauses()[0]
${currentStatus} | Cause: ${cause}"
// You can get all the information available for build parameters.
def parameters = build.getAction(ParametersAction)?.parameters
parameters.each {
${it.dump()}"
}
}
}
ERROR: Build step failed with exception
groovy.lang.MissingPropertyException: No such property: Jenkins for
class: Script1
at
org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:53)
at
org.codehaus.groovy.runtime.callsite.PogoGetPropertySite.getProperty(PogoGetPropertySite.java:52)
at
org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGroovyObjectGetProperty(AbstractCallSite.java:307)
at Script1.run(Script1.groovy:1)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:585)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:623)
at groovy.lang.GroovyShell.evaluate(GroovyShell.java:594)
at
org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SecureGroovyScript.evaluate(SecureGroovyScript.java:343)
at hudson.plugins.groovy.SystemGroovy.run(SystemGroovy.java:95)
at hudson.plugins.groovy.SystemGroovy.perform(SystemGroovy.java:59)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at
hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:744)
at hudson.model.Build$BuildExecution.build(Build.java:206)
at hudson.model.Build$BuildExecution.doRun(Build.java:163)
at
hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
at hudson.model.Run.execute(Run.java:1815)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)
Build step 'Execute system Groovy script' marked build as failure
On Thursday, November 8, 2018 at 3:49:14 PM UTC+5:30, rajendraprasad
Post by RAJENDRA PRASAD
Hi Tripti,
You are correct there is no plugin that can help you to create a custom
dashboard specified by you.
All you need to write a groovy script to access Jenkins job history and
prepare report according to your need
Jenkins.instance.getAllItems(Job.class).each{
println it.name + " - " + it.class
}
https://github.com/cloudbees/jenkins-scripts/blob/master/get-build-information.groovy
You need to use groovy plugin and it looks like below link.
https://www.google.com/search?safe=active&q=jenkins+groovy+script+examples&sa=X&ved=2ahUKEwj-weOYx8TeAhXEtI8KHbCMABQQ1QIoA3oECAoQBA&biw=412&bih=660&dpr=2.63#imgrc=qnNClrZNVTUKnM
I know I didn't have you full solution but I hope this will give some
direction for to implement your requirement.
Thanks
Rajendra
Post by trupti bhatt
[image: enter image description here]
<https://i.stack.imgur.com/JLX16.png>
so which plugin will help me to get such kind of report?
I have tried multiple plugins, but no luck. I have tried test analyzer
report, dashboard view and jenkins matrix and trends plugin.
I think Groovy scripts may help. can anyone help me on it?
Thank you,
Trupti Bhatt
--
You received this message because you are subscribed to the Google
Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/291de8a3-6bf5-4d5e-ae15-625044d11aaa%40googlegroups.com
<https://groups.google.com/d/msgid/jenkinsci-users/291de8a3-6bf5-4d5e-ae15-625044d11aaa%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/a10ec883-07bf-4bcd-919c-410bc0abaa00%40googlegroups.com
<https://groups.google.com/d/msgid/jenkinsci-users/a10ec883-07bf-4bcd-919c-410bc0abaa00%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAMrg02QqtC69Xb1HYkqB-Pth9f1BN-%3DAOinCsL8k6kbePTbkYQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Loading...