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
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi JC,
Thank you for your question.
I would suggest you on updating your Webhook URL to:
http://<your bamboo host>/api/rest/updateAndBuild.action?buildKey=<projectkey>-<buildkey>
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.