Restrict pushing of git tags to certain users

Hello,

I would like to restrict pushing of git tags to certain branches to certain users.

Since this seems not to be possible with vanilla BBC and the Atlassian team promoted Forge on the dangling issue (https://jira.atlassian.com/browse/BCLOUD-10967) I wanted to give it a try.

Unfortunately I could not find any reference or Documentation that would tell me how to do that. It seems like I want to run some custom check on push and stop the actual push if the conditions fail.

Could somebody please point me into the right direction or tell me if it is possible at all?

Thanks

The reference documentation is here: https://developer.atlassian.com/platform/forge/manifest-reference/modules/bitbucket-merge-check/ I’d guess you want the on-code-pushed trigger.

Thanks a lot @AaronCollier ,

I was looking for this but ended up somewhere else or just have overseen the trigger part.

What makes me curious though is:

The triggers provide a mechanism for the bitbucket:mergeCheck module to control when the check should be invoked for a given pull request. These can be seen as business events within the lifecycle of a pull request.

Does it mean it will only trigger on pushes associated with a Pull/Merge request?

How could this prevent direct pushing of git tags to main or release branch.
The current bitbucket cloud policy can not prevent that. We have disabled direct pushing to master and release branches for everybody. But tags can just be pushed…

I was hoping that now this forge app can prevent this as advertised.

From the first sentence:

The bitbucket:mergeCheck module defines a custom merge check that runs in the context of a pull request.

So I would say that no, this feature can’t work against direct pushes to a given branch. You can prevent a pull request from being merged, but not a push to a branch that isn’t the source for a pull request.