Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

How to get webhook payload #4473

jintaeson ·

Hello,

There is a problem that can't bring the item.
Is there any way to save it in value?

QB version : 9.0.27

webhook response Error :

Failed to evaluate below expression:
mvel:delivery.pull_request.merge_commit_sha

quickbuild webhook setting:

Trigger Build Variables:
  - name: test
  - value : ${delivery.pull_request.merge_commit_sha}

github webhook payload:

Payload:
{
   "action": "closed",
  "number": 23,
  "pull_request": {
    "url": "https://github.com/...",
    "id": 2083417,
    "node_id": "......",
    "html_url": "https://github.com/pull/23",
    "diff_url": "https://github.com/pull/23.diff",
    ...
    ...
    "merge_commit_sha": "47698479438",
   }
}
  • solved #4
  • replies 3
  • views 872
  • stars 0
steveluo ADMIN ·

Hi@jintaeson

I have just tested with settings like yours and can trigger the build successfully. So would you please confirm that the failed case was triggered by the same payload as you wrote. You may just redeliver the payload from GitHub and to see whether the error persists:

redeliver.png
jintaeson ·

Hello@steveluo

Thank you for your reply.
I'm still having problems.

error log:

2023-02-22 19:15:09,246 [qtp1406775514-72] ERROR com.pmease.quickbuild.rest.providers.GenericExceptionMapper - Error serving restful request.
    com.pmease.quickbuild.QuickbuildException: Failed to evaluate below expression:
    mvel:delivery.pull_request.merge_commit_sha
        at com.pmease.quickbuild.util.ExceptionUtils.wrapException(ExceptionUtils.java:89)
        at com.pmease.quickbuild.DefaultScriptEngine.evaluate(DefaultScriptEngine.java:324)
        at com.pmease.quickbuild.DefaultScriptEngine.interpolate(DefaultScriptEngine.java:93)
        at com.pmease.quickbuild.DefaultScriptEngine.interpolate(DefaultScriptEngine.java:79)
        at com.pmease.quickbuild.plugin.webhook.github.GitHubWebHookResource.webhook(GitHubWebHookResource.java:99)
        at sun.reflect.GeneratedMethodAccessor689.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$ResponseOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:168)
        at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:67)
        at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:259)
        at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:133)
        at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:83)
        at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:133)
        at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:71)
        at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:990)
        at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:941)
        at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:932)
        at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:384)
        at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:451)
        at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:632)
        at com.pmease.quickbuild.rest.RestServlet.service(RestServlet.java:54)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
        at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:867)
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1623)
        at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:198)
        at net.bull.javamelody.MonitoringFilter.doFilter(MonitoringFilter.java:176)
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
        at com.pmease.quickbuild.Quickbuild$DisableTraceFilter.doFilter(Quickbuild.java:1188)
        at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1610)
        at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:540)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146)
        at org.eclipse.jetty.server.handler.gzip.GzipHandler.handle(GzipHandler.java:753)
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
        at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257)
        at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1588)
        at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1345)
        at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)
        at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:480)
        at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1557)
        at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)
        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1247)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)
        at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:126)
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
        at org.eclipse.jetty.server.Server.handle(Server.java:502)
        at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:364)
        at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260)
        at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:305)
        at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
        at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118)
        at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:333)
        at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:310)
        at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:168)
        at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:126)
        at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:366)
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:765)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:683)
        at java.lang.Thread.run(Thread.java:748)
    Caused by: [Error: could not access: merge_commit_sha; in class: com.pmease.quickbuild.plugin.webhook.github.model.PullRequest]
    [Near : {... Unknown ....}]
     ^
    [Line: 1, Column: 0]
        at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.getBeanProperty(ReflectiveAccessorOptimizer.java:611)
        at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.compileGetChain(ReflectiveAccessorOptimizer.java:323)
        at org.mvel2.optimizers.impl.refl.ReflectiveAccessorOptimizer.optimizeAccessor(ReflectiveAccessorOptimizer.java:135)
        at org.mvel2.optimizers.dynamic.DynamicOptimizer.optimizeAccessor(DynamicOptimizer.java:66)
        at org.mvel2.ast.ASTNode.getReducedValueAccelerated(ASTNode.java:139)
        at org.mvel2.compiler.ExecutableAccessor.getValue(ExecutableAccessor.java:42)
        at org.mvel2.MVEL.executeExpression(MVEL.java:1057)
        at com.pmease.quickbuild.plugin.basis.BasisPlugin$30.evaluate(BasisPlugin.java:314)
        at com.pmease.quickbuild.DefaultScriptEngine.evaluate(DefaultScriptEngine.java:314)
        ... 58 more

QB:
webhook3.png

steveluo ADMIN ·

@jintaeson

Your QuickBuild version is a bit low which doesn't support merge_commit_sha. Please upgrade to QuickBuild V9.0.49 at least.

For Pull Request event in QB 9.0.27, only below fields are supported while after QB 9.0.49, all GitHub event payloads are supported:

private String url;
	private Long id;
	private String node_id;
	private String html_url;
	private String diff_url;
	private String patch_url;
	private int number;
	private String state;
	private boolean locked;
	private String title;
	private GitHubUser user;
	private GitHubUser assignee;
	private GitHubUser merged_by;
	private String body;
	
	@JsonFormat(pattern = Constants.ISO8601)
	private Date created_at;

	@JsonFormat(pattern = Constants.ISO8601)
	private Date updated_at;

	@JsonFormat(pattern = Constants.ISO8601)
	private Date closed_at;
	
	@JsonFormat(pattern = Constants.ISO8601)
	private Date merged_at;

	private boolean mergeable;
	private boolean merged;
	private int additions;
	private int commits;
	private int deletions;
	private int changed_files;
	private int comments;
	private int review_comments;
	private boolean maintainer_can_modify;
	private Milestone milestone;
	private PullRequestMarker base;
	private PullRequestMarker head;