script to check the status of a hook

Does any one has a script or a plug-in which can fetch me the status ( enabled or disabled ) of a hook for a repository in STASH and preferably enable it or disable it from command line if there is a need ?

I basically wanted to collect report for all projects in STASH. we are using STASH 2.6.2 on a Linux encvironment. Let me know, if you need additional details. Thanks

1 answer

1 accepted

0 vote

Hi,

You can use the REST endpoints to check and modify the status of hooks. See https://answers.atlassian.com/questions/284439/stash-checking-enablement-of-hook?page=1#284450

Cheers,

Michael

Michael,

Couple of questions.

1. Is there a plug-in which can restrict / prevent users to push derived objects such as *.exe, *.dll, *.so, *.jar etc ? These files can be derived out a build and there is no need to push them to repository. otherwise, it can fill the disk quickly.

2. How can I find such files which were already pushed to repos in Lunux ?

using a Linux find command or so.

2. How do I enable hooks project level or enable hooks as soon as project or repo gets created ?

Thanks

Is there a plug-in which can restrict / prevent users to push derived objects such as *.exe, *.dll, *.so, *.jar etc ? These files can be derived out a build and there is no need to push them to repository. otherwise, it can fill the disk quickly.

Stash doesn't bundle a hook like that and I don't remember seeing such a hook on marketplace either, but you can check: http://marketplace.atlassian.com. If you don't find such a hook, you can consider creating it yourself. Instructions on how to create repository hooks can be found on https://developer.atlassian.com/stash/docs/latest/how-tos/repository-hooks.html

How can I find such files which were already pushed to repos in Lunux ?

If you want to check on the server, it'll be tough. The git repositories on the server are bare repositories, which means that they have no checked out version of the repository. The easiest way to find out is to clone the repository and use 'find' to search for those extensions?

How do I enable hooks project level or enable hooks as soon as project or repo gets created ?

There currently is no built-in way to do that, but you could write a small plugin that listens for the ProjectCreatedEvent and/or RepositoryCreatedEvent and configure the hooks.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jun 12, 2018 in Bitbucket

Do you use any Atlassian products for your personal projects?

After spinning my wheels trying to get organized enough to write a book for National Novel Writing Month (NaNoWriMo) I took my affinity for Atlassian products from my work life and decided to tr...

24,105 views 26 12
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you