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.
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.
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
curlcommand 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?
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. :)
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?
>> 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.
In case you cannot find much in Jenkins logs, another thing you can do is the following:
I hope this helps
Happy Monday community! This week Monday coffee with Jexo welcomed a special guest - @Jari Worsley from Adaptavist to present you the latest news from the Atlassian ecosystem. Thank you fo...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events