Webrequest - trigger Jenkins build - cannot send the request URL

Ciprian Droc
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!
October 8, 2024

I'm trying to create a jira automation that can trigger a jenkins build remotely using the send webhook request.

I didn't have any success yet. 

I'm able to do this with curl using these variations:

  • providing a user parameter in the form of user:tokenvalue
curl -X POST "https://jenkins.company.com/job/My%20Projects/job/test_hook/build" --user user@company.com:tokenvalue
  • appending the user credentials in the url and replacing the @ sign in the username with %40 for url encoding
curl -X POST "https://user%40company.com:tokenvalue@jenkins.company.com/job/My%20Projects/job/test_hook/build"

I was able to do this in Python as well using below:

  • providing username and password to the post request, password being the token value
url = "https://jenkins.company.com/job/My%20Projects/job/test_hook/build"

username = "user@company.com"

token = "tokenvalue"

response = requests.post(url, auth=(username, token))
  • encoding usernam:tokenvalue to base64 string and providing it in the headers:
url = "https://jenkins.company.com/job/My%20Projects/job/test_hook/build"

headers = {

'Content-Type':'Application/JSON',

'Authorization' : 'Basic base64conversion='

}

response = requests.post(url, headers=headers)
Trying to replicate this in the webhook post request with no success yet. 
I tried recreating it as a 1:1 from the python example using the base64 encoding fails. I tried multilpe variations with no success. Even the ones that show Success in the log don't actually trigger the build. The message says timed out so it doesn't really know if it went through. 
And the errors show that the URL could not be retrieved.
Screenshot 2024-10-08 at 11.30.08 AM.png
Screenshot 2024-10-08 at 11.29.29 AM.png
This person in this thread seems to have been able to trigger but didn't provide more context and based on his screenshot I wasn't able to replicate
Any help would be appreciated. Additionally, I would like to post the issue form through the post request but if that's not possible I'll just have the job retrieve it itself based on the issue key.

2 answers

1 vote
Mark Rekveld - Marvelution
Atlassian Partner
October 10, 2024

Hi @Ciprian Droc 

Welcome to the community.

Next to the mentioned trigger plugin, there is also Jenkins Integration for Jira that has the capability to trigger builds and send issue fields as build parameters using a manual action and workflow post function.

I must say that I'm the maintainer f the before mentioned app.

Cheers,
Mark

Ciprian Droc
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!
October 10, 2024

Thank you, the pricing model doesn't justify my need. It was quite difficult to even discover the pricing.

Mark Rekveld - Marvelution
Atlassian Partner
October 10, 2024

Hi @Ciprian Droc 

On the discovery of the pricing, maybe Atalssian can take the feedback on that one as partners have no say other then the pricing itself.

As for the justification, If you think the app itself would give value and just the pricing is the blocker, then please reach out to me, or book a meeting with me so we can discuss your specific case and see how I can help you.

Cheers,
Mark

1 vote
Mohanraj Thangamuthu
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 8, 2024

Hello, Good day. Instead of automation you could the Webhook option as well. Hope this link helps : https://github.com/jenkinsci/jira-trigger-plugin

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events