1

Is there a way we can prevent developers from pushing to a specific repository (for example, if the build is broken and we don't want to allow any new code until the current build is fixed)? I guess this would require us to also allow specific users to push, while denying the rest of the development team. Is anything like this possible?

4

2 回答 2

2

Manipulating Stash's repo/branch permissions is one way to achieve this, as Christian's answer suggests. Going into the UI to do this could be a bit cumbersome, though. If this is something you want to be able to do quickly and/or regularly, you could consider using the Stash REST API to automate or simplify the process of locking down a repo.

Alternatively, you can inject custom logic into Stash's pre- and post- git commit hooks using a Java API. Here's the (admittedly, marketing-spun) description of the feature. There is already an existing Stash add-on on the Atlassian Marketplace which appears like it may suit your needs, although I have not used it myself and cannot actually recommend if it's any good: https://marketplace.atlassian.com/plugins/com.risingoak.stash.plugins.stash-broken-build-hook

If you want to get your hands dirty, you can write your own pre-commit hook to do this. If you're already familiar with building Atlassian plugins, you can start here: https://developer.atlassian.com/stash/docs/2.2.0/how-tos/repo-hook-examples/async-post-receive-config.html

If you've never built a plugin before, you should go through this tutorial first: https://developer.atlassian.com/display/DOCS/Set+up+the+Atlassian+Plugin+SDK+and+Build+a+Project

于 2013-07-25T23:49:10.437 回答
0

It's possible to set access rights to a project or a repo or a branch - so yes you can lock it if you set the access rights to a single or user.

于 2013-06-25T16:33:30.733 回答