Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,301,209
Community Members
 
Community Events
165
Community Groups

Automation of ScriptRunner Pre-Receive Hooks Addition

Edited

Hey everyone,

I have been running into this problem, and I am not sure how to properly solve it.

I have created a Python script that uses the BitBucket Atlassian plugin to create repositories under a given project. I have finished this task.

However, under each repository, I want to automate the process of including a default pre-receive (protect git refs) hook in ScriptRunner. I am not sure what is the best way to go about it is.

Does anyone have any clues or pseudocode? I have tried doing POST calls that mimic the network transaction, but I am getting a 500 error. 

Thanks

1 answer

Hi @John Henry ,

Currently ScriptRunner for Bitbucket does not support automated creation of ScriptRunner Hooks.

This is something we are looking into providing support for in future.

In the meantime, I believe you have three options you could try:

1) Continue your experimenting with the POST calls you have been doing.

2) Are you aware of the Clone Repository Configuration Built-In Script (https://docs.adaptavist.com/sr4bib/latest/features/built-in-scripts/clone-repository-configuration) as this could answer your requirement in a different way?

3) Are you aware that when setting up global Hooks (as a Bitbucket administrator) using ScriptRunner for Bitbucket you can set them to apply to all current and future projects and repositories. Thereby negating the need to include the default hook each time.

Please let me know if any of these options help you achieve what you want to achieve?

Kind regards,

Robert Giddings,

Product Manager, ScriptRunner for Bitbucket

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

Git push size limits are coming to Bitbucket Cloud starting April 4th, 2022

Beginning on April 4th, we will be implementing push limits. This means that your push cannot be completed if it is over 3.5 GB. If you do attempt to complete a push that is over 3.5 GB, it will fail...

2,265 views 2 9
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