jenkinsci / badge-plugin

Jenkins Badge plugin
https://plugins.jenkins.io/badge/
MIT License
32 stars 43 forks source link

Broken Build Monitor View #3

Closed uchuugaka closed 4 years ago

uchuugaka commented 6 years ago

After updating Groovy Postbuild to latest with this Badge plugin, our Build Monitor View dashboard broke horribly with no meaningful error message. https://plugins.jenkins.io/build-monitor-plugin

We had simple code in like this in a groovy postbuild step.

if (manager.logContains(".*Automation Fail.*")) {
  manager.addWarningBadge("Automation Failure")
  manager.buildUnstable()
  manager.build.@result = hudson.model.Result.UNSTABLE
}

if (manager.logContains(".*ImportError: No module named.*")) {
  manager.addWarningBadge("Automation Failure")
  manager.buildUnstable()
  manager.build.@result = hudson.model.Result.UNSTABLE
}

if (manager.logContains(".*Found crashlog.*appname.*")){
  manager.addErrorBadge("appname Application Crashed")
  manager.buildFailure()
}

def matcher = manager.getLogMatcher("^Fail : (?!Automation)(.*)")

if (matcher?.matches()) {
  manager.addErrorBadge(matcher.group(1))
}

manager.addInfoBadge(manager.envVars['BUILD_USER'])

How should this change after updating the postbuild plugin? Should we remove the manager namespace? or something else? Or are there potential compatibility issues with Build Monitor View?

bakito commented 6 years ago

I get the following error in the log: It seems to be a problem of the groovy-postbuild-plugin and it's adaptions to this plugin. @ikedam Does this mean something to you? ` 29-Mar-2018 19:07:25.211 WARNING [Handling POST /jenkins/$stapler/bound/4ae1343b-5f42-45fa-a39f-f523cc1c85d6/fetchJobViews from 0:0:0:0:0:0:0:1 : http-nio-8080-exec-10] org.kohsuke.stapler.HttpResponseRenderer$Default.handleJavaScriptProxyMethodCall call to /jenkins/$stapler/bound/4ae1343b-5f42-45fa-a39f-f523cc1c85d6/fetchJobViews failed java.lang.NoClassDefFoundError: org/jvnet/hudson/plugins/groovypostbuild/GroovyPostbuildAction at com.smartcodeltd.jenkinsci.plugins.buildmonitor.viewmodel.features.HasBadges.asJson(HasBadges.java:36) at com.smartcodeltd.jenkinsci.plugins.buildmonitor.viewmodel.features.HasBadges.asJson(HasBadges.java:20) at com.smartcodeltd.jenkinsci.plugins.buildmonitor.viewmodel.JobViewSerialiser.serialize(JobViewSerialiser.java:25) at com.smartcodeltd.jenkinsci.plugins.buildmonitor.viewmodel.JobViewSerialiser.serialize(JobViewSerialiser.java:13) at org.codehaus.jackson.map.ser.std.StdContainerSerializers$IndexedListSerializer.serializeContents(StdContainerSerializers.java:122) at org.codehaus.jackson.map.ser.std.StdContainerSerializers$IndexedListSerializer.serializeContents(StdContainerSerializers.java:71) at org.codehaus.jackson.map.ser.std.AsArraySerializerBase.serialize(AsArraySerializerBase.java:86) at org.codehaus.jackson.map.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:446) at org.codehaus.jackson.map.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:150) at org.codehaus.jackson.map.ser.BeanSerializer.serialize(BeanSerializer.java:112) at org.codehaus.jackson.map.ser.StdSerializerProvider._serializeValue(StdSerializerProvider.java:610) at org.codehaus.jackson.map.ser.StdSerializerProvider.serializeValue(StdSerializerProvider.java:256) at org.codehaus.jackson.map.ObjectMapper._configAndWriteValue(ObjectMapper.java:2575) at org.codehaus.jackson.map.ObjectMapper.writeValueAsString(ObjectMapper.java:2097) at com.smartcodeltd.jenkinsci.plugins.buildmonitor.api.Respond.withSuccess(Respond.java:15) at com.smartcodeltd.jenkinsci.plugins.buildmonitor.BuildMonitorView.fetchJobViews(BuildMonitorView.java:142) at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627) at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:343) at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:184) at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:117) at org.kohsuke.stapler.MetaClass$JavaScriptProxyMethodDispatcher.doDispatch(MetaClass.java:473) at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:715) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:845) at org.kohsuke.stapler.MetaClass$10.dispatch(MetaClass.java:374) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:715) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:845) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:782) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:845) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:649) at org.kohsuke.stapler.Stapler.service(Stapler.java:199) at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:154) at com.smartcodeltd.jenkinsci.plugin.assetbundler.filters.LessCSS.doFilter(LessCSS.java:47) at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151) at org.jenkinsci.plugins.ssegateway.Endpoint$SSEListenChannelFilter.doFilter(Endpoint.java:225) at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151) at io.jenkins.blueocean.ResourceCacheControl.doFilter(ResourceCacheControl.java:134) at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151) at io.jenkins.blueocean.auth.jwt.impl.JwtAuthenticationFilter.doFilter(JwtAuthenticationFilter.java:61) at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151) at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:157) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:99) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84) at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:90) at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:171) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:82) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:614) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:522) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1095) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:748)

`

ikedam commented 6 years ago

Please downgrade groovy-postbuild to 2.3.1- for now. You can upgrade to the latest one after this issue is fixed.

ikedam commented 6 years ago

@bakito Build monitor plugin looks depend on groovy-postbuild. Sorry, I missed that plugin as it’s not hosted (I found nothing when searching GroovyPostbuildAction in jenkinsci, and decided not to preserve binary compatibilities). That plugin located in https://github.com/jan-molak/jenkins-build-monitor-plugin . I haven’t had a look on source codes on build-monitor plugin yet, but I think the best way to fix this to to have also build-monitor-plugin migrate to and depend on badge-plugin (and groovy-postbuild-2.4+, if needed).

There are other options:

I believe they’re not so good ways as long-term fixes, and I want to upgrade buil-monitor.

ikedam commented 6 years ago

Duplicates https://issues.jenkins-ci.org/browse/JENKINS-50420

bakito commented 6 years ago

There is already a fix rovided in the jenkins-build-monitor-plugin. see https://github.com/jan-molak/jenkins-build-monitor-plugin/pull/365

uchuugaka commented 6 years ago

Unfortunately, that jenkins-build-monitor-plugin#365 hasn't yet landed in release :(

Thanks all for the great attention to this !