tomasbjerre / simple-bitbucket-commit-checker

Simple, and easy to use, commit checker for Atlassian Bitbucket Server
https://marketplace.atlassian.com/plugins/se.bjurr.sscc.sscc
Other
21 stars 19 forks source link

Hook validations getting triggered when viewing PR overview UI Page. #80

Open araviteja opened 6 years ago

araviteja commented 6 years ago

Hi Tomas,

We found below error when we try to view our PR overview page. When we access bitbucket PR overview page, server will perform internal diff and merge to check for conflicts. during this process SBCC hook validation is getting triggered as well. this is not stopping us to see the page/internal git operations but this is slowing down the things and some times we are getting BBDC server timeout errors. When we checked with BBDC support they found below errors and suggesting us to disable plugin.

This plugin it really needed for us. Can you please check this.? Hook validation should happen when someone tying to push the changes to remote branch/master. if user accessing PR UI page/click on diff at UI it should not validate things.

During the below issue time. i was not pushing any files to remote branch. I was just opened PR overview page from UI.

2017-12-19 10:10:27,982 INFO [http-nio-7990-exec-295] ravixxxX *1Oxxxxxxxx28483x5 m4yjt6 103.XXXXXXX,172.XXXXXX "GET /rest/prnfb-admin/1.0/settings/buttons/repository/456/pullrequest/10401 HTTP/1.1" se.bjurr.sbcc.SbccRepositoryHook Using settings: SbccSettings [commitDiffRegexp=null, commitDiffRegexpMessage=null, commitSizeMessage=null, commitSize=0, acceptMessage=null, branches=null, dryRun=false, dryRunMessage=null, excludeMergeCommits=true, excludeTagCommits=true, groups=[ACCEPT ALL * Commit Message Checker. **], rejectMessage=null, requireMatchingAuthorEmail=false, requireMatchingCommitterEmail=true, requireMatchingAuthorEmailMessage=* Message ** User email is not matching with bitbucket user email. Please check your git user.email config. or If not above, This could bee issue with the Author email. Author email should exist in bitbucket user directory. Please refer https://XXXXX.pega.com/docs/DXXXXX5 for more details.

* Message End**, requireMatchingAuthorName=false, requireMatchingAuthorNameSlug=false, requireMatchingCommitterName=false, requireMatchingCommitterNameSlug=true, requireMatchingAuthorNameMessage=* Message ** Committer name in user.name is not matching with bitbucket user slug. Please make sure you have mentioned correct network id in your git user.name config. Please refer https://XXXXXX.pega.com/docs/DXXXXX5 for more details. * Message End**, requireOnlyOneIssue=false, requireOnlyOneIssueMessage=null, branchRejectionRegexp=^([a-z0-9-.]+[/])*([a-zA-Z0-9-.])$, branchRejectionRegexpMessage= Message ** Your push has been prevented as it conflicted with our naming conventions policy here: https://XXXXX.pega.com/docs/DXXXXXX

Please rename your branch accordingly (see https://XXXXXX.pega.com/docs/DXXXXXXX) and push again.

Valid branch names must be one of :

master release/<release #> hotfix/<release #>/<hotfix #> feature/<XXX #>- bugfix/<XXX #>- generated/ *** Message End**, allowServiceUsers=true, requireMatchingAuthorEmailRegexp=null, jqlCheck=false, jqlCheckMessage=null, jqlCheckQuery=, commitRegexp=null, requireMatchingAuthorEmailInBitbucket=true, requireMatchingAuthorNameInBitbucket=false, requireMatchingAuthorNameInBitbucketSlug=true, shouldCheckPullRequests=false, shouldCheckPullRequestsMessage=null, ignoreUsersPattern=camuser]

Regards, Raviteja

araviteja commented 6 years ago

Just for your information. We are also using your Pull Request Notifier for Bitbucket plugin. We have a custom button configured, which will trigger a validation build and merge the changes master.

Thank you.

Regards, Raviteja

tomasbjerre commented 6 years ago

Do you have the checkbox "Check pull requests" checked? If so, unchecking it should make things faster.

tomasbjerre commented 6 years ago

Oh i see you have it disabled...

tomasbjerre commented 6 years ago

In Pull Request Notifier, do you have "Merge condition" set to "always"? That should make it not perform the merge check.

araviteja commented 6 years ago

Below is our current merge condition setting: "Merge condition: trigger only when merge is not conflicting". pull-request-notifier plugin version: Installed version: 3.1

image

do you suggest us to change it to "trigger for any merge condition" ?

Regards, Raviteja

tomasbjerre commented 6 years ago

Yes :)

tomasbjerre commented 6 years ago

Did it work?

araviteja commented 6 years ago

Thanks. We didn't wanted users to click on button when there is conflict in merge. We will discuss internal and take the action.

BTW. We are seeing error from SBCC. while accessing UI. does this means validation is getting triggered when users are viewing UI? is this expected?

tomasbjerre commented 6 years ago

Im not sure. Depends on what error you see? Do you have a stack trace?

araviteja commented 6 years ago

Sorry for delay in response. Below what we found in logs. Does this trace will help you ?

This error was generated while i was accessing PR overview UI page.

2017-12-19 09:53:00,427 ERROR [threadpool:thread-5] RulesMerge *1XXBXXXXXx1026303x14 ls3cll 17X.XXX.XXX.X SSH - git-receive-pack '/pXXX/pXXX-pXXXXXXm.git' se.bjurr.sbcc.SbccRepositoryHook Error while validating reference changes. Will allow all of them. "An error occurred while executing an external process: process timed out" com.atlassian.bitbucket.ServerException: An error occurred while executing an external process: process timed out at com.atlassian.bitbucket.scm.git.command.GitCommandExitHandler.evaluateThrowable(GitCommandExitHandler.java:113) at com.atlassian.bitbucket.scm.git.command.GitCommandExitHandler.onError(GitCommandExitHandler.java:201) at com.atlassian.bitbucket.scm.DefaultCommandExitHandler.onExit(DefaultCommandExitHandler.java:31) at com.atlassian.bitbucket.scm.BaseCommand.callExitHandler(BaseCommand.java:146) at com.atlassian.bitbucket.scm.BaseCommand$CommandFuture.internalGet(BaseCommand.java:280) at com.atlassian.bitbucket.scm.BaseCommand$CommandFuture.get(BaseCommand.java:244) at com.atlassian.bitbucket.scm.BaseCommand.call(BaseCommand.java:83) at se.bjurr.sbcc.commits.ChangeSetsService.getCommits(ChangeSetsService.java:83) at se.bjurr.sbcc.commits.ChangeSetsService.getNewChangesets(ChangeSetsService.java:67) at se.bjurr.sbcc.commits.ChangeSetsService.getNewChangeSets(ChangeSetsService.java:40) at se.bjurr.sbcc.RefChangeValidator.validateRefChange(RefChangeValidator.java:82) at se.bjurr.sbcc.SbccRepositoryHook.performChecks(SbccRepositoryHook.java:117) at se.bjurr.sbcc.SbccPreReceiveRepositoryHook.preUpdate(SbccPreReceiveRepositoryHook.java:48) at com.atlassian.stash.internal.hook.repository.DefaultRepositoryHookService.preUpdate(DefaultRepositoryHookService.java:798) at com.atlassian.stash.internal.hook.repository.DefaultRepositoryHookService.preUpdate(DefaultRepositoryHookService.java:411) at com.atlassian.stash.internal.hook.DefaultBuiltInHookHandlerFactory.lambda$preReceive$0(DefaultBuiltInHookHandlerFactory.java:36) at com.atlassian.stash.internal.scm.git.GitQuarantineHelper.lambda$null$0(GitQuarantineHelper.java:87) at com.atlassian.stash.internal.hook.DefaultHookService.doHandleRequest(DefaultHookService.java:303) at com.atlassian.stash.internal.hook.DefaultHookService.handleRequest(DefaultHookService.java:289) at com.atlassian.stash.internal.hook.DefaultHookService.handleRawRequest(DefaultHookService.java:230) at com.atlassian.stash.internal.hook.DefaultHookService$1.lambda$run$0(DefaultHookService.java:197) at com.atlassian.stash.internal.concurrent.DefaultTransferableStateManager$StateTransferringRunnable.run(DefaultTransferableStateManager.java:166) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.lang.Thread.run(Thread.java:748) ... 26 frames trimmed Caused by: com.atlassian.utils.process.ProcessTimeoutException: process timed out at com.atlassian.utils.process.ExternalProcessImpl.wrapUpProcess(ExternalProcessImpl.java:664) at com.atlassian.utils.process.ExternalProcessImpl.finish(ExternalProcessImpl.java:163) at com.atlassian.bitbucket.scm.BaseCommand$CommandFuture.get(BaseCommand.java:242) ... 23 common frames omitted There is interference of the plugin: at se.bjurr.sbcc.commits.ChangeSetsService.getCommits(ChangeSetsService.java:83) at se.bjurr.sbcc.commits.ChangeSetsService.getNewChangesets(ChangeSetsService.java:67) at se.bjurr.sbcc.commits.ChangeSetsService.getNewChangeSets(ChangeSetsService.java:40) at se.bjurr.sbcc.RefChangeValidator.validateRefChange(RefChangeValidator.java:82) at se.bjurr.sbcc.SbccRepositoryHook.performChecks(SbccRepositoryHook.java:117) at se.bjurr.sbcc.SbccPreReceiveRepositoryHook.preUpdate(SbccPreReceiveRepositoryHook.java:48)

And below one

2017-12-19 10:10:27,982 INFO [http-nio-7990-exec-295] ravixxxX *1Oxxxxxxxx28483x5 m4yjt6 1X3.XXXXXXX,1XX.XXXXXX "GET /rest/prnfb-admin/1.0/settings/buttons/repository/456/pullrequest/10401 HTTP/1.1" se.bjurr.sbcc.SbccRepositoryHook Using settings: SbccSettings [commitDiffRegexp=null, commitDiffRegexpMessage=null, commitSizeMessage=null, commitSize=0, acceptMessage=null, branches=null, dryRun=false, dryRunMessage=null, excludeMergeCommits=true, excludeTagCommits=true, groups=[ACCEPT ALL ***** Commit Message Checker. *], rejectMessage=null, requireMatchingAuthorEmail=false, requireMatchingCommitterEmail=true, requireMatchingAuthorEmailMessage= Message ** User email is not matching with bitbucket user email. Please check your git user.email config. or If not above, This could bee issue with the Author email. Author email should exist in bitbucket user directory. Please refer https://XXXXX.pega.com/docs/DXXXXX5 for more details.

* Message End**, requireMatchingAuthorName=false, requireMatchingAuthorNameSlug=false, requireMatchingCommitterName=false, requireMatchingCommitterNameSlug=true, requireMatchingAuthorNameMessage=* Message ** Committer name in user.name is not matching with bitbucket user slug. Please make sure you have mentioned correct network id in your git user.name config. Please refer https://XXXXXX.pega.com/docs/DXXXXX5 for more details. * Message End**, requireOnlyOneIssue=false, requireOnlyOneIssueMessage=null, branchRejectionRegexp=^([a-z0-9-.]+[/])([a-zA-Z0-9-.])$, branchRejectionRegexpMessage=* Message ** Your push has been prevented as it conflicted with our naming conventions policy here: https://XXXXX.pega.com/docs/DXXXXXX

Please rename your branch accordingly (see https://XXXXXX.pega.com/docs/DXXXXXXX) and push again.

Valid branch names must be one of :

master release/<release #> hotfix/<release #>/<hotfix #> feature/<XXX #>- bugfix/<XXX #>- generated/ *** Message End**, allowServiceUsers=true, requireMatchingAuthorEmailRegexp=null, jqlCheck=false, jqlCheckMessage=null, jqlCheckQuery=, commitRegexp=null, requireMatchingAuthorEmailInBitbucket=true, requireMatchingAuthorNameInBitbucket=false, requireMatchingAuthorNameInBitbucketSlug=true, shouldCheckPullRequests=false, shouldCheckPullRequestsMessage=null, ignoreUsersPattern=camuser]