Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Does Script Runner work with Webhooks

Jonathanwatson
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 15, 2016

I have tried setting up a webhook using JQL by Script Runner and the hook never appears to fire. Is this possible to setup? I tried using standard JQL and it worked fine and I tried the Script Runner JQL in the issue browser so I know that both parts work independently but don't work together

I am trying to do the following:

issueFunction in linkedIssuesOf("issuetype = Epic and resolution is empty", "is epic of")

1 answer

0 votes
JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 22, 2016

As far as I can see it works, I tested with:

issueFunction in hasSubtasks()

Can you go to one of the issues you think the hook should fire on, let's say the key is JRA-1.

Then try to run the query:

issueFunction in linkedIssuesOf("issuetype = Epic and resolution is empty", "is epic of") and key = JRA-1

Does this return the one issue? If not maybe you have your links the wrong way round. 

What events are you listening for?

 

Jonathanwatson
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 22, 2016

Hi Jamie,

Thanks for coming back. I have just tested this as you said and I can see that it does find the issue as expected.

The events are just issue created or updated.

Thanks

JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 22, 2016

Could you try with the simple query I used? 

There is no logging in the relevant class so I can't give you anything to show that that fired or not.

 

AndrewB
Contributor
March 25, 2016

@Jamie Echlin [Adaptavist] - I've recently run into this as well and have been playing around with this the last 2 days. I set up a bogus URL so I see the webhook failures in my log file. I easily set up a web hook for both events & on post functions using a regular JQL search. Then I tried setting up a webhook using ScriptRunner JQL functions on a post function. I noticed something peculiar. The original JQL I was using with my webhook was issuetype = 'A' and issueFunction in subtasksOf('issuetype = B and issueFuncion in linkedIssuesOf("issuetype = C and labels = a-label", ALink)'). I double checked to make sure that the issue I tested on matched the JQL. Nothing appeared in the log (neither the expected failed webhook call or a failure in starting the webhook). I tried other randomish ScriptRunner JQL functions with the same result (nothing). Then I tried issuetype = A and issueFunction in hasLinkType("Duplicate") (I tried this because there are very few ~300 matches and it's fairly simple JQL). This fired the webhook. I wonder if this is because of how long the JQL searches take. I'm not sure how to go about testing this though.

JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 29, 2016

How long does the long-running query take? In the most recent version there is a profiler thingy - https://scriptrunner.adaptavist.com/latest/jira/jql-functions.html#_query_profiler - which will show you how long it takes. But, I don't remember see any reference to a timeout when I looked at the code.

 

JamieA
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 29, 2016

I even artifically made the query take 2 seconds and it still worked. 

Can you set the log level to debug for com.atlassian.webhooks , run again, and post the logs.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events