New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ERROR ExternalHooksListener unable to enable hook: com.atlassian.bitbucket.IllegalEntityStateException: You can not enable a repository hook com.ngs.stash.externalhooks.external-hooks:external-post-receive-hook with no saved configuration #100
Comments
Hi! Thanks for the report and for the logs, it definitely looks like a bug. We will investigate the issue as soon as possible. |
@sebastic What version of Bitbucket do you use? |
Currently 6.7.0 because of an issue with 6.7.1 unrelated to External Hooks. The add-on version is 7.2.0-1. We've first noticed this issue when upgrading from 6.5.1 to 6.6.0. The upgrade prior to that was from 5.16.9 to 6.5.1. With that upgrade to 6.x we noticed that repos which had the add-on enabled on repo level as well as on project level had it executed twice, we then migrated to the current setup with the add-on only configured on the project level. |
We just upgraded to 6.7.2 and this issue is still present. Any progress finding the cause? |
Unfortunately, no. We've tried several cases and were not able to reproduce the case. The error goes from the internals of Bitbucket SDK and means that your configuration of the plugin disappeared in BB internals. What database do you use? Which version of the plugin do you have currently? |
We use PostgreSQL 11.5 (on Debian buster). The plugin is still at version 7.2.0-1. Where should the configuration be stored? The configuration is present, because when you edit the hook settings it loads what was previous stored, just clicking the save button fixes the hook as previously mentioned. |
Hi, we have reproduced the error with postgresql and we are looking into
it. I will keep you posted.
…On Mon, Oct 28, 2019, 11:16 Bas Couwenberg ***@***.***> wrote:
We use PostgreSQL 11.5 (on Debian buster).
The plugin is still at version 7.2.0-1.
Where should the configuration be stored?
The configuration is present, because when you edit the hook settings it
loads what was previous stored, just clicking the save button fixes the
hook as previously mentioned.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#100?email_source=notifications&email_token=ACAN7ZCV3XFCQZ6DFJELFZTQQ2NU3A5CNFSM4I6AV7OKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECMBLJI#issuecomment-546837925>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACAN7ZFP3PB6SCV2PYUTNDTQQ2NU3ANCNFSM4I6AV7OA>
.
|
We've found the root cause, fixed it and send the issue to our QA. |
@sebastic please upgrade the add-on to 7.3.0, we've fixed bug and released the version in the Atlassian Marketplace. https://marketplace.atlassian.com/apps/1211631/external-hooks-by-reconquest/version-history#b6392 You can download the add-on from this page or upgrade it in "Manage apps" page in the admin panel. |
The add-on has been updated to 7.3.0 on both our test & production instance. After restarting the atlbitbucket service on the test instance the hook is created successfully:
Looking good so far. We'll have to wait for the next Bitbucket Server upgrade to confirm that it's fixed then too. |
The new version of the add-on may introduce a new, but related issue. The hook configuration on the repository level changed from "Inherited (enabled)" to "Enabled" causing the hook to be executed twice for a single push. |
|
The update cannot be installed because it's not marked as compatible with 6.7. |
Hmm. That's weird. I've fixed it manually, please check now
…On Tue, Nov 5, 2019 at 4:10 PM Bas Couwenberg ***@***.***> wrote:
The update cannot be installed because it's not marked as compatible with
6.7.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#100?email_source=notifications&email_token=ACAN7ZA4M4U475UO3I73RT3QSFWDTA5CNFSM4I6AV7OKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEDCYNTQ#issuecomment-549816014>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACAN7ZDIPAWIRP7HG32IGL3QSFWDTANCNFSM4I6AV7OA>
.
|
Upgraded to 7.5.0 on both our instances. Creating the hooks after restarting the service still looks good:
The configuration on the repo level remained "Inherited (enabled)". |
We've also upgraded to Bitbucket Server 6.8.0, and the hooks were correctly created after the upgrade as well. Thanks for fixing this issue! |
I spoke too soon regarding the fix for this issue. While the logging implies that the hook is created correctly, it doesn't actually execute the hook on push. For that to work the configuration needs to be saved again. |
I've tried your case with fresh bitbucket 6.8.0 setup and the latest version of the addon and haven't reproduced the problem. Could you provide steps to reproduce the problem? I've tried the following:
|
Our setup We have several projects, but not all, with 'External Post Receive Hook' enabled. Hook settings:
Files on the server:
Copies of the files in question: Then we have several repositories under the projects with 'External Post Receive Hook' enabled, these repos have their hooks inherited from their project. The process this morning was to upgrade the add-on to 7.5.0 while still running Bitbucket 6.7.2, and after restarting the atlbitbucket service Then we upgraded to Bitbucket 6.8.0 using the installer. After the service was started the log and hook configuration was checked again. Moving on to another task some changes were commited and pushed to one of the repos, the expected emails were not sent because the hook was not executed. |
I can reproduce the issue with Bitbucket 6.8.0 by restarting the service and pushing some changes. When saving the hook configuration again via the web interface the logging shows:
Note the When saving the configuration again via the REST API the logging is different:
Note the following messages:
Pushing a change after this triggers the hook and the mail is sent. |
Could you also post logs during startup of the service? There is a routine related to ExternalHooksListener like in your first post. |
Logging after startup for ExternalHooks:
Is this sufficient or do you need the full log? |
Might the problem be that The code shows that when the hookId doesn't equal the repository hook key the body is not executed. The database shows hook keys in the form of
The hookId has the scope type (and resource id if available) appended to this when using
Should Or am I getting confused by the Should the variable for the plugin settings not be named |
Thanks for your input, but in that case where onRepositoryHookEnabled doesn't install hook script it will be easy to reproduce, but I can't reproduce it on my local setup and can't reproduce it with isolated official docker container installation. I'm looking into the following message:
which looks strange because event should not be deferred, maybe for some internal reason the event is not delivered to the addon. I'll keep you posted. |
@sebastic I've found a case where OnRepositoryHookEnabled events are not triggered by Bitbucket's event factory during BB startup. I've found a workaround for it and sent new version to QA to test all basic scenarios. Changes published in a separated branch: https://github.com/reconquest/atlassian-external-hooks/tree/no-events-fix |
Just letting you know that the bug is not reproducible in official docker image bitbucket-server (I've also tried DC mode), but it's easily reproducible on debian10 (I've reproduced it on Linode VPS) |
@sebastic good news, the beta release has passed QA, could you try the following beta release on your development instance? The following patch addresses case with missing events and causing missing hook scripts after startup: |
Upgraded the add-on on our test instance, de logging still shows that the hook was already gone, but the hook was created correctly, there was no need to save the configuration again.
|
Thanks! We've released the version in the official marketplace: https://marketplace.atlassian.com/apps/1211631/external-hooks-by-reconquest/version-history#b6432 |
I'm closing this issue, feel free to re-open it if you still have any issues. I'm glad that the issue is solved, really appreciate your patience and trust. |
Just upgraded to 6.8.1 and the hooks were created correctly. |
After upgrading Bitbucket Server and restarting the service, the External Hooks don't work any more. De logging shows the following for every repo with External Hooks enabled:
All repositories except one have the add-on enabled on the project level, and only one test repo has it enabled on repo level which does work:
After saving the configuration for every project, the hook works again.
The text was updated successfully, but these errors were encountered: