However when it runs in 5.3.1, no exceptions are thrown, but the hook does not get enabled. If it’s already enabled, its settings do not change. Seems enable() and setSettings() do not have any effect.
According to 5.3.1 RepositoryHookService API, the used methods are deprecated with removal in 6.0. Did their functionality already change?
PS: it’s been tested also in 5.1.5, where RepositoryHookService API is not changed yet - it fails to enable the hook and to change its settings too. More details are in the replies below
I added logging of the hook state at the end of the method. According to atlassian-bitbucket.log the hook gets enabled. The same is confirmed by atlassian-bitbucket-augit.log. However it’s not reflected in UI and the hook does not fire.
Hi @sylvie, @bturner, I’m sorry for addressing you here directly, but I stuck and do not hear any suggestions in the forum.
Do you know if there is a way in BitBucket 5+ to configure and to enable repository hook within code of another repository hook? It works just fine in 4.11 (and my plugin is written against 4.11.2 version of APIs), but plugin to fails to “commit” changes in 5.3.1.
It also fails to enable repository hook (and to change its settings) in 5.1.5, where API of RepositoryHookService is not changed yet
I will very appreciate if you can lit any light on this.
@Deprecated @Nonnull RepositoryHook disable(Repository repository, String hookKey)
This method is deprecated. in 5.2 for removal in 6.0. Use disable(DisableRepositoryHookRequest) instead.
@Deprecated @Nonnull RepositoryHook enable(Repository repository, String hookKey, Settings settings)
This method is deprecated. in 5.2 for removal in 6.0. Use enable(EnableRepositoryHookRequest) instead.
Hi @acalantog, thanks a lot for taking a look at the problem!
Frankly speaking, I hope “deprecated” does not mean “broken” and therefore the same code should work with BitBucket versions from 4.7.1 until 6.0. Otherwise it forces developers to release different versions of the plugins for every major version of BB… This might be acceptable, but still this is not what “deprecated” means.
However new methods are introduced in 5.2, but the old methods (not deprecated yet) stop working in 5.0 and 5.1. What should be done for these versions? Let’s try to getting this functionality working in 5.1.6