You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Hi Everyone,
I am trying to trigger Jenkins build using Jira Automation, but it's failing. I am getting "No valid crumb was included in the request" error even after passing the Jenkins-Crumb header.
Configuration:
Error:
Also, I mention that when i try the same request using Talend API tester It works fine.
Hello @mayank goyal ,
Welcome to the Atlassian Community!
According to the Jenking Remote Access API documentation page, basic authentication with username and api-token has to be preferred over crumbs for CSRF protection:
Remote API and security
When your Jenkins is secured, you can use HTTP BASIC authentication to authenticate remote API requests. See Authenticating scripted clients for more details.
CSRF Protection
Note: API tokens are preferred instead of crumbs for CSRF protection.
Also, according to the Authenticating Scripted Clients, the content-type header is not needed:
Shell with curl
The
curl
command is available for most operating systems including Linux, macOS, Windows, FreeBSD, and more.curl -X POST -L --user your-user-name:apiToken \ https://jenkins.example.com/job/your_job/build
Therefore, can you kindly do the following and let us know the results?
Cheers,
Dario
Hey Dario!
Thanks a lot, this worked really well. :-)
I want ask a question: Last time when I was trying with username:password it was failing in jira automation but succeeded with Talend API tester.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for your quick reply @mayank goyal ,
However, I am not sure I understand what the question is, can you kindly try to reformulate?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes sure.
When I was trying to trigger the Jenkins job using username:password it was failing in Jira Automation (reason I asked this question). But when I tried to trigger the jenkins job using same way i.e username:password in Talend API tester it worked (screen-shot attached below).
So why username:password authorization is failing in Jira Automation while it's working fine in Talend API test.
EDIT: In the Talend API tester I am able to trigger the jenkins job even without username and password (only with Jenkins-Crumb)
I hope question is clear this time. Please let me know if it's unclear. :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @mayank goyal ,
The question is crystal clear now, but not having access to Jenkins logs I can just guess that the REST API call fired by Automation for Jira was somehow different than the one sent by Talend API tester :)
Maybe in Jenkins logs you can find more information on why it failed.
Also, just to make sure I understood correctly, can you confirm this is actually working now?
Cheers,
Dario
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Dario,
>> Maybe in Jenkins logs you can find more information on why it failed.
Thanks, I will try to debug the logs.
>> Also, just to make sure I understood correctly, can you confirm this is actually working now?
Yes, after using the username:API-token method I am able to trigger the jenkins job from JIRA Automation.
Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In case you cannot find much in Jenkins logs, another thing you can do is the following:
I hope this helps
Cheers,
Dario
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello
Hope I'm not hijacking this thread.
@Dario B I'm not as lucky as @mayank goyal .
I followed your 4 steps posted at Jul 06, 2021, I can't get Automation to work.
First of all, command line curl works as expected. Jenkins job will be triggered.
curl -X POST -L --user charles:110c243XXXX195249b3a46517a0cf12822 'https://jenkins.xxxxxx.com/job/Xray%20project/build'
I don't know the correct way to use Headers.
Here is what I'm using.
Jenkins' log says I need to use Crumb.... strange.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@charleslcso I am trying to setup a similar automation and would really like to know how you "got it working".
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Dario B @mayank goyal and @charleslcso
I am also not able configure this automation webhook fires 503 error. Dont know where i missed.
Server: squid
Mime-Version: 1.0
Date: Thu, 10 Mar 2022 20:03:36 GMT
Content-Type: text/html;charset=utf-8
Content-Length: 3261
X-Squid-Error: ERR_DNS_FAIL 0
Vary: Accept-Language
Content-Language: en
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The error you get is "service unavailable" and therefore this doesn't seem to be authentication related.
Actually, the error returned by squid is DNS related:
ERR_DNS_FAIL
Are you actually able to send the same request using Curl?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
We tried from Postman and able to trigger build in jenkins. Getting error only when triggered from JIRA Cloud site.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Not providing any detail about what does not work is not helping us to help you ;)
However, as a starting point, you may want to check the error message returned by Jenkins.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for your reply @Dario B
This thread was continue of mine - trying to configure JIRA cloud site - using automation webhook option - to trigger jenkins build based on jira ticket status change or update.
It fires the following squied error - 503 error.
Server: squid
Mime-Version: 1.0
Date: Thu, 10 Mar 2022 20:03:36 GMT
Content-Type: text/html;charset=utf-8
Content-Length: 3261
X-Squid-Error: ERR_DNS_FAIL 0
Vary: Accept-Language
Content-Language: en
our developer @karthik.c tries using postman api tool to verify able to trigger our jenkins build. What need to be addressed to achieve this jenkins build trigger from jira ticket.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
As already written on the 11th of March the error you are getting is a DNS fail:
Actually, the error returned by squid is DNS related:
ERR_DNS_FAIL
And indeed, it looks like your Jenkins site is not reachable from the Internet:
phoenix.olamnet.com: Name or service not known
Not even the domain olamnet.com is actually translating to an IP address and therefore it's not reachable form the Internet:
Most likely you are able to connect using POSTMAN because you use either a VPN or a proxy that allows you to connect to that URL from your computer, but in order to be accessible from your Cloud site your Jenkins installation has to be reachable from the Internet using https (please notice: self-signed certificates are not accepted).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Simon says:
' @gnanavelu_murthy the host phoenix.olamnet.com is known only in your kitchen. Let the global DNS know about it first. '
https://mxtoolbox.com/SuperTool.aspx?action=a%3aphoenix.olamnet.com&run=toolpage
Simon out.
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.