gitlab-plugin
gitlab-plugin copied to clipboard
Declarative Directive generator throws exception
Issue
On gitlab.com and jenkins 2.121.1 and Gitlab plugin 1.5.8
For my multibranch pipeline project, I'd like branches to be triggered on push to gitlab.
If I navigate to https://
Context
- Gitlab plugin version: 1.5.8
- Gitlab version: Gitlab.com?
- Jenkins version: 2.121.1
- Job type: Multibranch pipeline

I can confirm this. The full stack trace is:
Jul 24, 2018 4:05:04 PM org.jenkinsci.plugins.pipeline.modeldefinition.generator.DirectiveGenerator doGenerateDirective
WARNING: failed to render {"triggers": {"triggerOnPush": true, "triggerOnMergeRequest": true, "triggerOnAcceptedMergeRequest": false, "triggerOnClosedMergeRequest": false, "triggerOpenMergeRequestOnPush": "never", "triggerOnApprovedMergeRequest": true, "triggerOnNoteRequest": true, "noteRegex": "Jenkins please retry a build", "ciSkip": true, "skipWorkInProgressMergeRequest": true, "setBuildDescription": true, "triggerOnPipelineEvent": false, "pendingBuildName": "", "cancelPendingBuildsOnUpdate": false, "branchFilterType": "All", "includeBranchesSpec": "", "excludeBranchesSpec": "", "targetBranchRegex": "", "secretToken": "", "stapler-class": "com.dabsquared.gitlabjenkins.GitLabPushTrigger", "$class": "com.dabsquared.gitlabjenkins.GitLabPushTrigger"}, "stapler-class": "org.jenkinsci.plugins.pipeline.modeldefinition.generator.TriggersDirective", "$class": "org.jenkinsci.plugins.pipeline.modeldefinition.generator.TriggersDirective"}
java.lang.UnsupportedOperationException: no public field ‘acceptMergeRequestOnSuccess’ (or getter method) found in class com.dabsquared.gitlabjenkins.GitLabPushTrigger
at org.jenkinsci.plugins.structs.describable.DescribableParameter.getValue(DescribableParameter.java:161)
at org.jenkinsci.plugins.structs.describable.DescribableParameter.inspect(DescribableParameter.java:142)
at org.jenkinsci.plugins.structs.describable.DescribableModel.uninstantiate2(DescribableModel.java:555)
at org.jenkinsci.plugins.structs.describable.DescribableModel.uninstantiate2_(DescribableModel.java:646)
at org.jenkinsci.plugins.structs.describable.UninstantiatedDescribable.from(UninstantiatedDescribable.java:172)
at org.jenkinsci.plugins.pipeline.modeldefinition.generator.TriggersDirective$DescriptorImpl.toGroovy(TriggersDirective.java:85)
at org.jenkinsci.plugins.pipeline.modeldefinition.generator.TriggersDirective$DescriptorImpl.toGroovy(TriggersDirective.java:57)
at org.jenkinsci.plugins.pipeline.modeldefinition.generator.DirectiveDescriptor.toIndentedGroovy(DirectiveDescriptor.java:57)
at org.jenkinsci.plugins.pipeline.modeldefinition.generator.DirectiveGenerator.doGenerateDirective(DirectiveGenerator.java:93)
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$1.doDispatch(MetaClass.java:129)
at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:734)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:864)
at org.kohsuke.stapler.MetaClass$10.dispatch(MetaClass.java:374)
at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:734)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:864)
at org.kohsuke.stapler.Stapler.invoke(Stapler.java:668)
at org.kohsuke.stapler.Stapler.service(Stapler.java:238)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:860)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1650)
at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:154)
at com.cloudbees.jenkins.support.slowrequest.SlowRequestFilter.doFilter(SlowRequestFilter.java:37)
at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151)
at jenkins.metrics.impl.MetricsFilter.doFilter(MetricsFilter.java:125)
at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:151)
at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:157)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:99)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
at hudson.security.UnwrapSecurityExceptionFilter.doFilter(UnwrapSecurityExceptionFilter.java:51)
at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
at jenkins.security.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:117)
at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:135)
at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271)
at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
at jenkins.security.BasicHeaderProcessor.doFilter(BasicHeaderProcessor.java:93)
at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
at hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:67)
at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:90)
at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:171)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:82)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1637)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:533)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:190)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1253)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1155)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.Server.handle(Server.java:530)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:347)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:256)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:102)
at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:247)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:140)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)
at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:382)
at winstone.BoundedExecutorService$1.run(BoundedExecutorService.java:77)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
@raghur sorry that this is broken, it may not get fixed quickly... but the README has examples of how to configure jobs using Declarative Pipeline, hopefully that will be enough to get you going.
@abayer are we doing something obviously wrong here? I only ask because I believe the regular Snippet Generator works fine for the plugin's steps, it seems only the Declarative generator is broken.
So the failure is definitely because the various fields (in this particular case, acceptMergeRequestOnSuccess, but it'd probably apply to any of them) don't have get* methods. This is probably barfing here but not in the snippet generator because the directive generator ends up having to do things from a slightly different angle than the snippet generator - the snippet generator just turns the JobPropertyStep defining the trigger into Groovy, while the directive generator turns the actual trigger itself directly into Groovy. I'm not 100% sure what the difference in behavior behind the scenes actually is such that it works when you start at the step but not when you start at the trigger, but I'm looking into that.
Regardless, having getter methods isn't a bad thing anyway. =)
Just a naive comment:
- Could the fix be adding this getter (or should it be named
isAcceptMergeRequestOnSuccess()) tocom.dabsquared.gitlabjenkins.GitLabPushTrigger?
public boolean getAcceptMergeRequestOnSuccess() {
return acceptMergeRequestOnSuccess;
}
- Is this just the first problem, and others will pop up after fixing this one?
Still not work
Still not work
Still not work!
Still not work!
Still not work
Still not work!
I am working on a patch for this issue
Just a naive comment:
- Could the fix be adding this getter (or should it be named
isAcceptMergeRequestOnSuccess()) tocom.dabsquared.gitlabjenkins.GitLabPushTrigger?public boolean getAcceptMergeRequestOnSuccess() { return acceptMergeRequestOnSuccess; }
- Is this just the first problem, and others will pop up after fixing this one?
Am trying this approach to see if the error still persists.
A patch has been made for this which has been included in the latest release of the plugin version 1.7.11.