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 Join to answer
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

712 views 0 4
Read article

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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot