Closed syee514 closed 7 years ago
Can you please share the configuration of the hook and also the relevant parts of the Bitbucket log file. Which version of BB are you using?
Does the new commit contain changes which match the hook configuration or have you just created a new branch but without actual changes, but where a previous commit would match the configuration? In the latter case this might be than the same as #1.
File Hook Plugin version 3.0 Bitbucket Server version 5.1
The error is seen:
Created a new repository, added a new file and pushed the changes. Setup the following hooks (note that the error occurs if there is at least one file hook plugin enabled):
In my local workspace:
Test 1: Commit changes does not match the hook configuration
git push --set-upstream origin feature/syee_no_match Counting objects: 3, done. Delta compression using up to 24 threads. Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 276 bytes | 0 bytes/s, done. Total 3 (delta 0), reused 0 (delta 0) remote: Communication breakdown with Bitbucket. To ssh://dev-bitbucket/test/syee_test_repo_4.git ! [remote rejected] feature/syee_no_match -> feature/syee_no_match (pre-receive hook declined) error: failed to push some refs to 'ssh://git@dev-bitbucket/test/syee_test_repo_4.git'
Logs attached no_match_log.txt
Test 2: Commit changes matches the hook configuration
Logs attached yes_match_log.txt
Thanks for sharing the detailed information. I was trying to reproduce this but without luck. Looking at the stack trace and where the exceptions occur, it looks like a little bit that you repository is corrupt in some way and/or some history rewriting tock place.
Can you try with a different/new repository as well to see if it happens there as well?
I created a new repository and was able to reproduce the issue when pushing a new branch with commits to the upstream.
Test Details
Bitbucket Server v5.1.0 File Hooks Plugin v3.0.0 File Size Hook Enabled: Include .*txt Size: 10
Test 1: Commit changes on new branch matches the hook configuration
Log file match_log.txt
Test 2: Commit changes on new branch does not match the hook configuration
Log file nomatch_log.txt
Thanks!
This problem didn't exist in Bitbucket Server 4.14.1 so there may have been a change in the API, although I don't see anything relevant in their documentation. I have opened a PR with a potential fix.
Also worth mentioning, the 4.14.1 server I tried it on has Git 2.9.3 and the 5.1.0 has 2.9.4. I don't see anything obvious in the 2.9.4 release notes though.
Hello,
The File Hooks Plugin version 3.0 is preventing new local branches to be pushed to the remote if the file name and/or file size hook are enabled:
git push -u origin feature/syee_local_branch_test Total 0 (delta 0), reused 0 (delta 0) remote: Communication breakdown with Bitbucket. To ssh://dev-bitbucket/test/syee_test_repo_3.git ! [remote rejected] feature/syee_local_branch_test -> feature/syee_local_branch_test (pre-receive hook declined) error: failed to push some refs to 'ssh://git@dev-bitbucket/test/syee_test_repo_3.git'
If the File Name and File Size Hooks are disabled, the push succeeds:
git push -u origin feature/syee_local_branch_test Total 0 (delta 0), reused 0 (delta 0) remote: remote: Create pull request for feature/syee_local_branch_test: \<cut>
Sylvia