Jenkins dashboard report with customization

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Jenkins dashboard report with customization

trupti bhatt

I want to get the jenkins report as in this template:

enter image description here

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 [hidden email].
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.
Reply | Threaded
Open this post in threaded view
|

Re: Jenkins dashboard report with customization

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


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:


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


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

Thanks
Rajendra



On Tue, 6 Nov, 2018, 15:41 trupti bhatt <[hidden email] wrote:

I want to get the jenkins report as in this template:

enter image description here

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 [hidden email].
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.

--
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 [hidden email].
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.
Reply | Threaded
Open this post in threaded view
|

Re: Jenkins dashboard report with customization

trupti bhatt
Thanks Rajendra.

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

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()}" 
}
}
  }


Error Is :
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 wrote:
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 <a href="http://it.name" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fit.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFzPnolFcOKHC2izDRzc7N56F6Jnw&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fit.name\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFzPnolFcOKHC2izDRzc7N56F6Jnw&#39;;return true;">it.name + " - " + it.class
  }

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

<a href="https://github.com/cloudbees/jenkins-scripts/blob/master/get-build-information.groovy" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fcloudbees%2Fjenkins-scripts%2Fblob%2Fmaster%2Fget-build-information.groovy\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF7IJniD_KbDBfeSvgJJtPgTmducg&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fcloudbees%2Fjenkins-scripts%2Fblob%2Fmaster%2Fget-build-information.groovy\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF7IJniD_KbDBfeSvgJJtPgTmducg&#39;;return true;">https://github.com/cloudbees/jenkins-scripts/blob/master/get-build-information.groovy

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

<a href="https://www.google.com/search?safe=active&amp;q=jenkins+groovy+script+examples&amp;sa=X&amp;ved=2ahUKEwj-weOYx8TeAhXEtI8KHbCMABQQ1QIoA3oECAoQBA&amp;biw=412&amp;bih=660&amp;dpr=2.63#imgrc=qnNClrZNVTUKnM" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/search?safe\x3dactive\x26q\x3djenkins+groovy+script+examples\x26sa\x3dX\x26ved\x3d2ahUKEwj-weOYx8TeAhXEtI8KHbCMABQQ1QIoA3oECAoQBA\x26biw\x3d412\x26bih\x3d660\x26dpr\x3d2.63#imgrc\x3dqnNClrZNVTUKnM&#39;;return true;" onclick="this.href=&#39;https://www.google.com/search?safe\x3dactive\x26q\x3djenkins+groovy+script+examples\x26sa\x3dX\x26ved\x3d2ahUKEwj-weOYx8TeAhXEtI8KHbCMABQQ1QIoA3oECAoQBA\x26biw\x3d412\x26bih\x3d660\x26dpr\x3d2.63#imgrc\x3dqnNClrZNVTUKnM&#39;;return true;">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



On Tue, 6 Nov, 2018, 15:41 trupti bhatt <<a href="javascript:" rel="nofollow" target="_blank" gdf-obfuscated-mailto="LtcqTuinAAAJ" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">trupti...@... wrote:

I want to get the jenkins report as in this template:

<a href="https://i.stack.imgur.com/JLX16.png" rel="nofollow" style="font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:inherit;vertical-align:baseline;color:rgb(0,89,153)" target="_blank" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fi.stack.imgur.com%2FJLX16.png\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNG58Kj0lT74peSswgpbcHhTuaS-1Q&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fi.stack.imgur.com%2FJLX16.png\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNG58Kj0lT74peSswgpbcHhTuaS-1Q&#39;;return true;">enter image description here

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 <a href="javascript:" rel="nofollow" target="_blank" gdf-obfuscated-mailto="LtcqTuinAAAJ" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/jenkinsci-users/291de8a3-6bf5-4d5e-ae15-625044d11aaa%40googlegroups.com?utm_medium=email&amp;utm_source=footer" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/291de8a3-6bf5-4d5e-ae15-625044d11aaa%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/291de8a3-6bf5-4d5e-ae15-625044d11aaa%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/jenkinsci-users/291de8a3-6bf5-4d5e-ae15-625044d11aaa%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" rel="nofollow" target="_blank" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">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 [hidden email].
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.