JIRA webhook trigger Bamboo build

All,

I'm working on testing using JIRA workflow post function to tigger a webhook to initiate a build in Bamboo but it does not seem working.

In Jira:
(1) I created a webhook with URL = http://bamboo-server:8085/rest/api/latest/queue/JTST-JTST/${issue.key}and Exclude details = Yes
(2) Add trigger webhook post function to a workflow transition

After transitioning an issue to trigger Bamboo build, the targeted build did not trigger and the JIRA log file showed the following:
==================================================
2014-07-07 12:24:52,830 httpclient-callbacks:thread-5 WARN anonymous [atlassian.webhooks.plugin.PublishTaskFactoryImpl$PublishTaskImpl] Client error - 401 when posting to web hook at 'http://bamboo-server:8085/rest/api/latest/queue/JTST-JTST/SCM-36?user_id=<myUserId>&user_key=<myUserId>', body is:
==================================================

What is user_key? Is it my JIRA login password?
My JIRA Server version is v6.1.3 and Bamboo is v5.5.0. Can you tell me what was the problem?

Thanks,
JC

2 answers

1 accepted

I switched to use HTTPRequest-Workflow function add-on instead of Webhooks and it works as expected. My problem has been resolved. Thanks.

Note that HTTPRequest-Workflow function version 1.2.0 is missing the HTTP method selection box (defect was reported to hasCode.com). However version 1.1.0 works fine.

0 vote

Hi JC,

Thank you for your question.

I would suggest you on updating your Webhook URL to:

http://&lt;your bamboo host&gt;/api/rest/updateAndBuild.action?buildKey=&lt;projectkey&gt;-&lt;buildkey&gt;

Alternatively, you can use Groovy script using Script runner plugin https://marketplace.atlassian.com/plugins/com.onresolve.jira.groovy.groovyrunner. In the postfunction you can use the REST API of Bamboo to start the build.

Kind regards,
Rafael

Hi Rafael,


Thanks for your response. I tested setting webhook URL = http://bamboo-host:8085/api/rest/updateAndBuild.action?buildKey=JTST-JTST

but the webhook did not fire. The JIRA log showed:
=====================================
2014-07-09 10:59:46,910 httpclient-callbacks:thread-19 WARN anonymous [atlassian.webhooks.plugin.PublishTaskFactoryImpl$PublishTaskImpl] Unable to post the information to http://bamboo-host:8085/api/rest/updateAndBuild.action?buildKey=JTST-JTST&user_id=jchang&user_key=jchangdue to null
=====================================

I then tested using "curl" with or without setting trigger (tried all 4 different trigger types) in JTST-JTST:
$ curl -X POST --user admin:admin http://bamboo-host:8085/api/rest/updateAndBuild.action?buildKey=JTST-JTST


None of them was working. I either got:
"The plan "JTST - JTST" is not configured for remote triggering" or:
"Build request for plan "JTST - JTST" originated from <local-host-ip> which is not an allowed address"


However, the "queue" REST API on curl command line worked:
$ curl -X POST "http://bamboo-host:8085/rest/api/latest/queue/JTST-JTST?os_authType=basic&os_username=admin&os_password=admin"

So, I added it to webhook:
Webhook URL = http://bamboo-host:8085/rest/api/latest/queue/JTST-JTST?&os_authType=basic&os_username=admin&os_password=admin

It did not fire and JIRA log showed "server error":
=======================================
2014-07-09 12:34:24,377 httpclient-callbacks:thread-20 WARN anonymous [atlassian.webhooks.plugin.PublishTaskFactoryImpl$PublishTaskImpl] Server error - 500 when posting to web hook at 'http://bamboo-host:8085/rest/api/latest/queue/JTST-JTST?&os_authType=basic&os_username=admin&os_password=admin&user_id=jchang&user_key=jchang', body is:
======================================

Added ${issue.key} to the webhook was also no prevail and JIRA log showed "client error":
===================================
2014-07-09 12:44:31,626 httpclient-callbacks:thread-21 WARN anonymous [atlassian.webhooks.plugin.PublishTaskFactoryImpl$PublishTaskImpl] Client error - 404 when posting to web hook at 'http://bamboo-host:8085/rest/api/latest/queue/JTST-JTST/SCM-36?&os_authType=basic&os_username=admin&os_password=admin&user_id=jchang&user_key=jchang', body is:
===================================

From all the testing, I see one common id "anonymous" which indicates that webhook did not pass authentication correctly.
Question: Is there any workaround for the webhook authentication? Has anyone been successfully got webhook to trigger Bamboo build?

Thanks in advance for any responses.

JC

P. S. May be I need to investigate using Groovy Script Runner but there is learning curve to overcome.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Julia Dillon
Posted Tuesday in Jira

Tell us how your team runs on Jira!

Hey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...

375 views 1 18
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you