Automation of ScriptRunner Pre-Receive Hooks Addition

John Henry September 20, 2021

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

0 votes
Robert Giddings [Adaptavist]
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 21, 2021

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
AUG Leaders

Atlassian Community Events