Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Require commits to have the same JIRA Issue with the branch Edited

Hello Adaptavist, Atlassian,

I have setup Script Event Handlers and Script Pre Hooks 'Naming standard enforcement' for bugfix and hotfix as per below in Bamboo Server Scriptrunner add-on

bugfix/[A-Z]{2,9}-\d+.*
hotfix/[A-Z]{2,9}-\d+.*

Now what we need next is a condition in Pre Hooks or Event Handlers to compare in between commit message JIRA Issue number with the branch JIRA Issue number when there is commits occur.

The idea is that

  1. To prevent accidental commit into unwanted branch.
  2. Each JIRA Issue bugfix or hotfix must have its own branch associated with JIRA Issue number.
  3. Only the same JIRA Issue number can commit.

Example:-

Branch: " bugfix/DEMO-123 Fixing issue xxxx"

Git commit message: " DEMO-123 New commits"

 

As such, do I need to use "Pre-receive Hooks -> Require commits to be associated with a JIRA issue" ? If so appreciate if you can provide the condition/script that I need to use to archive this.

 

Thank you in advance.

1 answer

I was hoping to see an answer here because our problem is similar.   We are using the built-in pre-receive hook to to Require commits to be associated with a JIRA issue and it will succeed if it finds a matching Jira issueID in either the commit or in the branch name.   The problem:  if the developer created the branch with the correct Jira issue ID mentioned, they are able to commit without any valid issue ID mentioned at all.  Once the pull request is merged and the branch is deleted, the Jira tracability for these commits is lost.   We're hoping there's a way to either force the hook to only look at the commit messages and not at the branch name or else to do what's mentioned here:  require the issue ID to be mentioned in both the branch name and the corresponding commits.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase

The benefits of using Jira in different departments

Jira is a great tool to use across different departments. Forget that paperwork – switch to Jira and get that tasks done smoothly. Marketing Jira allows for a complete digital transformation of you...

72 views 0 3
Read article

Community Events

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

Events near you