Are you in the loop? Keep up with the latest by making sure you're subscribed to Community Announcements. Just click Watch and select Articles.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Get pull request id by commit hash

Hello,

Do anyone know how to get the pull request ID based on the commit's hash?

I'm triggering a jenkins job via http webhook. Once the job ends, if there is a problem I want to mark the PR as "needs work".

I've found a working API call (https://docs.atlassian.com/bitbucket-server/rest/6.0.2/bitbucket-rest.html#idp288) but I need to provide the PR ID.

Unfortunately the HTTP webhook plugin does not provide such property.

2 answers

0 votes
Aaron Mailhot
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!
Oct 30, 2023 • edited

I realize it is not quite the answer you requested, but do you use or have you considered using multi-branch pipelines in Jenkins? With multi-branch pipelines, you are automatically hooked into BitBucket such that the failed build will cause the failure to be seen on the BitBucket PR and you can readily have your merge checks 'block' on that failure as in users have to get the job passing before the PR can be merged.

You can also then do more custom behavior if desired, including getting the PR ID from the Jenkins CHANGE_ID and BRANCH_NAME environment variables and sending info to that API endpoint if the built-in hooks are insufficient for your needs.

Hello, 

Have you found a way so far? 

I also need PR ID for a similar use case.

 

Many Thanks in advance!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events