Pre Hook not working in all repositories

Issue #2 new
Former user created an issue

I have enabled the Pre Hook with Rally Policy in all our repositories, but only our newest repository rejects commits without a Rally Task or Story.

The other repoisitories allow commits without a RAlly tie-in but give the following error:

2016-05-04 15:27:30,175 ERROR [threadpool:thread-246] [user] 927x21977x0 5049qe 10.5.245.63 "POST /scm/esb/tlog.git/git-receive-pack HTTP/1.1" c.p.s.p.h.RallyPreReceiveRepositoryHook Unexpected error com.atlassian.stash.exception.AuthorisationException: You are not permitted to access this resource at com.atlassian.stash.internal.aop.ExceptionRewriteAdvice.afterThrowing(ExceptionRewriteAdvice.java:36) ~[stash-platform-3.0.1.jar:na] at com.sun.proxy.$Proxy176.getChangesetsBetween(Unknown Source) ~[na:na] at com.sun.proxy.$Proxy280.getChangesetsBetween(Unknown Source) ~[na:na] at com.sun.proxy.$Proxy1422.getChangesetsBetween(Unknown Source) ~[na:na] at com.pluginsawesome.stash.plugins.services.v36Compatibility.ChangesetServiceImpl$1.get(ChangesetServiceImpl.java:103) ~[na:na] at com.atlassian.stash.util.PagedIterable.iterator(PagedIterable.java:23) ~[stash-util-3.0.1.jar:na] at com.pluginsawesome.stash.plugins.services.v36Compatibility.ChangesetServiceImpl.getNewChangesets(ChangesetServiceImpl.java:107) ~[na:na] at com.pluginsawesome.stash.plugins.services.CommitFilterServiceImpl.filter(CommitFilterServiceImpl.java:53) ~[na:na] at com.pluginsawesome.stash.plugins.services.CommitFilterServiceImpl.filter(CommitFilterServiceImpl.java:83) ~[na:na] at com.pluginsawesome.stash.plugins.services.ValidationServiceImpl.validateRefChanges(ValidationServiceImpl.java:71) ~[na:na] at com.pluginsawesome.stash.plugins.hook.RallyPreReceiveRepositoryHook.onReceive(RallyPreReceiveRepositoryHook.java:61) ~[na:na] at com.atlassian.stash.internal.hook.repository.PreReceiveRepositoryHookAdapter$1.visit(PreReceiveRepositoryHookAdapter.java:38) [stash-service-impl-3.0.1.jar:na] at com.atlassian.stash.internal.hook.repository.PreReceiveRepositoryHookAdapter$1.visit(PreReceiveRepositoryHookAdapter.java:33) [stash-service-impl-3.0.1.jar:na] at com.atlassian.stash.internal.hook.repository.DefaultRepositoryHookService$8.doInTransaction(DefaultRepositoryHookService.java:411) [stash-service-impl-3.0.1.jar:na] at com.atlassian.stash.internal.hook.repository.DefaultRepositoryHookService$8.doInTransaction(DefaultRepositoryHookService.java:405) [stash-service-impl-3.0.1.jar:na] at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133) [spring-tx-4.0.3.RELEASE.jar:4.0.3.RELEASE] at com.atlassian.stash.internal.hook.repository.DefaultRepositoryHookService.visitEnabledHooks(DefaultRepositoryHookService.java:405) [stash-service-impl-3.0.1.jar:na] at com.sun.proxy.$Proxy222.visitEnabledHooks(Unknown Source) [na:na] at com.atlassian.stash.internal.hook.repository.PreReceiveRepositoryHookAdapter.onReceive(PreReceiveRepositoryHookAdapter.java:33) [stash-service-impl-3.0.1.jar:na] at com.atlassian.stash.internal.hook.DefaultBuiltInHookHandlerFactory$1.handle(DefaultBuiltInHookHandlerFactory.java:41) [stash-service-impl-3.0.1.jar:na] at com.atlassian.stash.internal.hook.DefaultHookService.doHandleRequest(DefaultHookService.java:353) [stash-service-impl-3.0.1.jar:na] at com.atlassian.stash.internal.hook.DefaultHookService.handleRequest(DefaultHookService.java:339) [stash-service-impl-3.0.1.jar:na] at com.atlassian.stash.internal.hook.DefaultHookService.handleRawRequest(DefaultHookService.java:250) [stash-service-impl-3.0.1.jar:na] at com.atlassian.stash.internal.hook.DefaultHookService$2$1.run(DefaultHookService.java:210) [stash-service-impl-3.0.1.jar:na] at com.atlassian.stash.internal.concurrent.StateTransferringExecutor$StateTransferringRunnable.run(StateTransferringExecutor.java:69) [stash-platform-3.0.1.jar:na] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [na:1.7.0_95] at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_95] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178) [na:1.7.0_95] at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292) [na:1.7.0_95] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_95] at java.lang.Thread.run(Thread.java:745) [na:1.7.0_95] ... 57 frames trimmed Caused by: org.springframework.security.access.AccessDeniedException: Access is denied at org.springframework.security.access.vote.AffirmativeBased.decide(AffirmativeBased.java:83) ~[spring-security-core-3.2.3.RELEASE.jar:3.2.3.RELEASE] ... 31 common frames omitted

Comments (7)

  1. Jason Jorgenson

    2016-05-05 12:11:14,806 WARN [http-bio-7990-exec-134] <USER1> 731x24666x0 3a12vp 10.4.50.181 "PUT /rest/api/latest/logs/logger/com.pluginsawesome/debug HTTP/1.1" com.pluginsawesome Switching to log level [debug] 2016-05-05 12:12:34,411 INFO [NioProcessor-2] c.a.s.i.s.s.SelfClosingChannelSession Executing command: git-receive-pack '/epf/sample.git' 2016-05-05 12:12:34,664 DEBUG [threadpool:thread-288] <USER1> 732x24667x0 7s071e 10.5.242.47 SSH - git-receive-pack '/epf/sample.git' c.p.s.p.h.RallyPreReceiveRepositoryHook Starting pre receive validation... 2016-05-05 12:12:34,783 DEBUG [threadpool:thread-288] <USER1> 732x24667x0 7s071e 10.5.242.47 SSH - git-receive-pack '/epf/sample.git' c.p.s.p.h.RallyPreReceiveRepositoryHook Pre receive validation done. 2016-05-05 12:12:35,144 DEBUG [Indexer:thread-2] <USER2 for some reason even though USER1 was doing the commit/PUSH > 913x3302x0 1hldzal 10.5.241.158 "POST /scm/esb/tlog.git/git-receive-pack HTTP/1.1" c.p.s.p.s.CommitParserServiceImpl Parsing commit message: 'test with debugging' 2016-05-05 12:12:35,144 DEBUG [Indexer:thread-2] <USER2 for some reason even though USER1 was doing the commit/PUSH > 913x3302x0 1hldzal 10.5.241.158 "POST /scm/esb/tlog.git/git-receive-pack HTTP/1.1" c.p.s.p.s.CommitParserServiceImpl Found artifacts '[]'. 2016-05-05 12:12:35,251 DEBUG [Indexer:thread-2] <USER2 for some reason even though USER1 was doing the commit/PUSH > 913x3302x0 1hldzal 10.5.241.158 "POST /scm/esb/tlog.git/git-receive-pack HTTP/1.1" c.p.s.p.s.CommitParserServiceImpl Parsing commit message: 'master' 2016-05-05 12:12:35,251 DEBUG [Indexer:thread-2] <USER2 for some reason even though USER1 was doing the commit/PUSH > 913x3302x0 1hldzal 10.5.241.158 "POST /scm/esb/tlog.git/git-receive-pack HTTP/1.1" c.p.s.p.s.CommitParserServiceImpl Found artifacts '[]'.

    2016-05-05 12:17:50,600 INFO [NioProcessor-3] c.a.s.i.s.s.SelfClosingChannelSession Executing command: git-receive-pack '/epf/sample.git' 2016-05-05 12:18:47,982 INFO [NioProcessor-1] c.a.s.i.s.s.SelfClosingChannelSession Executing command: git-receive-pack '/epf/sample.git' 2016-05-05 12:18:48,215 DEBUG [threadpool:thread-291] <USER1> 738x24671x0 1z974x 10.5.242.47 SSH - git-receive-pack '/epf/sample.git' c.p.s.p.h.RallyPreReceiveRepositoryHook Starting pre receive validation... 2016-05-05 12:18:48,215 DEBUG [threadpool:thread-291] <USER1> 738x24671x0 1z974x 10.5.242.47 SSH - git-receive-pack '/epf/sample.git' c.p.s.p.s.ConnectorLicenseServiceImpl Going to check plugin license... 2016-05-05 12:18:48,341 DEBUG [threadpool:thread-291] <USER1> 738x24671x0 1z974x 10.5.242.47 SSH - git-receive-pack '/epf/sample.git' c.p.s.p.h.RallyPreReceiveRepositoryHook Pre receive validation done. 2016-05-05 12:18:48,553 DEBUG [Indexer:thread-1] <USER3 [another different user]> 721x1561x0 197eho 10.5.241.219 "POST /rest/branch-utils/latest/projects/ESB/repos/emsobjects/branches HTTP/1.1" c.p.s.p.s.CommitParserServiceImpl Parsing commit message: 'test with debugging again' 2016-05-05 12:18:48,554 DEBUG [Indexer:thread-1] <USER3> 721x1561x0 197eho 10.5.241.219 "POST /rest/branch-utils/latest/projects/ESB/repos/emsobjects/branches HTTP/1.1" c.p.s.p.s.CommitParserServiceImpl Found artifacts '[]'. 2016-05-05 12:18:48,659 DEBUG [Indexer:thread-1] <USER3> 721x1561x0 197eho 10.5.241.219 "POST /rest/branch-utils/latest/projects/ESB/repos/emsobjects/branches HTTP/1.1" c.p.s.p.s.CommitParserServiceImpl Parsing commit message: 'master' 2016-05-05 12:18:48,660 DEBUG [Indexer:thread-1] <USER3> 721x1561x0 197eho 10.5.241.219 "POST /rest/branch-utils/latest/projects/ESB/repos/emsobjects/branches HTTP/1.1" c.p.s.p.s.CommitParserServiceImpl Found artifacts '[]'.

    ------Viewing commits page User is correct--------

    2016-05-05 12:19:08,866 DEBUG [http-bio-7990-exec-128] <USER1> 739x24672x0 10bn5yo 10.5.242.47 "GET /projects/EPF/repos/sample/commits HTTP/1.1" c.p.s.p.s.CommitParserServiceImpl Parsing commit message: 'test with debugging again' 2016-05-05 12:19:08,866 DEBUG [http-bio-7990-exec-128] <USER1> 739x24672x0 10bn5yo 10.5.242.47 "GET /projects/EPF/repos/sample/commits HTTP/1.1" c.p.s.p.s.CommitParserServiceImpl Found artifacts '[]'. 2016-05-05 12:19:08,876 DEBUG [http-bio-7990-exec-128] <USER1> 739x24672x0 10bn5yo 10.5.242.47 "GET /projects/EPF/repos/sample/commits HTTP/1.1" c.p.s.p.s.CommitParserServiceImpl Parsing commit message: 'test with debugging' 2016-05-05 12:19:08,876 DEBUG [http-bio-7990-exec-128] <USER1> 739x24672x0 10bn5yo 10.5.242.47 "GET /projects/EPF/repos/sample/commits HTTP/1.1" c.p.s.p.s.CommitParserServiceImpl Found artifacts '[]'. 2016-05-05 12:19:08,885 DEBUG [http-bio-7990-exec-128] <USER1> 739x24672x0 10bn5yo 10.5.242.47 "GET /projects/EPF/repos/sample/commits HTTP/1.1" c.p.s.p.s.CommitParserServiceImpl Parsing commit message: 'test with hook now enabled' 2016-05-05 12:19:08,885 DEBUG [http-bio-7990-exec-128] <USER1> 739x24672x0 10bn5yo 10.5.242.47 "GET /projects/EPF/repos/sample/commits HTTP/1.1" c.p.s.p.s.CommitParserServiceImpl Found artifacts '[]'. 2016-05-05 12:19:08,894 DEBUG [http-bio-7990-exec-128] <USER1> 739x24672x0 10bn5yo 10.5.242.47 "GET /projects/EPF/repos/sample/commits HTTP/1.1" c.p.s.p.s.CommitParserServiceImpl Parsing commit message: 'test with old repo' 2016-05-05 12:19:08,894 DEBUG [http-bio-7990-exec-128] <USER1> 739x24672x0 10bn5yo 10.5.242.47 "GET /projects/EPF/repos/sample/commits HTTP/1.1" c.p.s.p.s.CommitParserServiceImpl Found artifacts '[]'.

    --------------Debug results from repository where pre-validation works------------------

    2016-05-05 12:26:54,529 DEBUG [threadpool:thread-294] <USER1> 746x24690x0 xm3qi8 10.5.45.153 "POST /scm/tes/rallyintegration.git/git-receive-pack HTTP/1.1" c.p.s.p.h.RallyPreReceiveRepositoryHook Starting pre receive validation... 2016-05-05 12:26:54,725 DEBUG [threadpool:thread-294] <USER1> 746x24690x0 xm3qi8 10.5.45.153 "POST /scm/tes/rallyintegration.git/git-receive-pack HTTP/1.1" c.p.s.p.s.CommitFilterServiceImpl commit 'c8040635bbea37e6f0a534132f3ee4ca1881840d' parent size 1. 2016-05-05 12:26:54,726 DEBUG [threadpool:thread-294] <USER1> 746x24690x0 xm3qi8 10.5.45.153 "POST /scm/tes/rallyintegration.git/git-receive-pack HTTP/1.1" c.p.s.p.s.CommitFilterServiceImpl commit '5dff676514b89948954e408a4f25131d48e649fb' parent size 1. 2016-05-05 12:26:54,726 DEBUG [threadpool:thread-294] <USER1> 746x24690x0 xm3qi8 10.5.45.153 "POST /scm/tes/rallyintegration.git/git-receive-pack HTTP/1.1" c.p.s.p.s.CommitParserServiceImpl Parsing commit message: 'test with working pre-hook ' 2016-05-05 12:26:54,726 DEBUG [threadpool:thread-294] <USER1> 746x24690x0 xm3qi8 10.5.45.153 "POST /scm/tes/rallyintegration.git/git-receive-pack HTTP/1.1" c.p.s.p.s.CommitParserServiceImpl Found artifacts '[]'. 2016-05-05 12:26:54,735 DEBUG [threadpool:thread-294] <USER1> 746x24690x0 xm3qi8 10.5.45.153 "POST /scm/tes/rallyintegration.git/git-receive-pack HTTP/1.1" c.p.s.p.s.CommitParserServiceImpl Parsing commit message: 'master' 2016-05-05 12:26:54,735 DEBUG [threadpool:thread-294] <USER1> 746x24690x0 xm3qi8 10.5.45.153 "POST /scm/tes/rallyintegration.git/git-receive-pack HTTP/1.1" c.p.s.p.s.CommitParserServiceImpl Found artifacts '[]'. 2016-05-05 12:26:54,735 DEBUG [threadpool:thread-294] <USER1> 746x24690x0 xm3qi8 10.5.45.153 "POST /scm/tes/rallyintegration.git/git-receive-pack HTTP/1.1" c.p.s.p.s.CommitParserServiceImpl Parsing commit message: 'Test without a task ' 2016-05-05 12:26:54,736 DEBUG [threadpool:thread-294] <USER1> 746x24690x0 xm3qi8 10.5.45.153 "POST /scm/tes/rallyintegration.git/git-receive-pack HTTP/1.1" c.p.s.p.s.CommitParserServiceImpl Found artifacts '[]'. 2016-05-05 12:26:54,742 DEBUG [threadpool:thread-294] <USER1> 746x24690x0 xm3qi8 10.5.45.153 "POST /scm/tes/rallyintegration.git/git-receive-pack HTTP/1.1" c.p.s.p.s.CommitParserServiceImpl Parsing commit message: 'master' 2016-05-05 12:26:54,742 DEBUG [threadpool:thread-294] <USER1> 746x24690x0 xm3qi8 10.5.45.153 "POST /scm/tes/rallyintegration.git/git-receive-pack HTTP/1.1" c.p.s.p.s.CommitParserServiceImpl Found artifacts '[]'. 2016-05-05 12:26:54,743 DEBUG [threadpool:thread-294] <USER1> 746x24690x0 xm3qi8 10.5.45.153 "POST /scm/tes/rallyintegration.git/git-receive-pack HTTP/1.1" c.p.s.p.h.RallyPreReceiveRepositoryHook Pre receive validation done.

    ------Message as expected in GIT BASH------- $ git push Counting objects: 7, done. Delta compression using up to 8 threads. Compressing objects: 100% (4/4), done. Writing objects: 100% (6/6), 646 bytes | 0 bytes/s, done. Total 6 (delta 0), reused 0 (delta 0) remote: remote: The following commits are not valid and was not pushed: remote: remote: commit c8040635bbea37e6f0a534132f3ee4ca1881840d remote: Author: <USER1> <jason.jorgenson[at]wholefoods.com> remote: test with working pre-hook remote: remote: remote: Reason: No Rally artifacts was found on commit message. remote: commit 5dff676514b89948954e408a4f25131d48e649fb remote: Author: <USER1> <jason.jorgenson[at]wholefoods.com> remote: Test without a task remote: remote: remote: Reason: No Rally artifacts was found on commit message. To http://<USER1>@<server>:7990/scm/tes/rallyintegration.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'http://<USER1>@<server>:7990/scm/tes/rallyintegration.git'

  2. George Mace

    Try to disable the pre hook validation and commit your changes. After that, enable the pre hook validation again and commit something using a valid rally artifact. e.g. git commit -m "TA001". - Notice, once you enable the pre hook validation you must provide a rally artifact.

    Please, let me know if it works properly.

  3. ViswanathanR

    Hi George This happens for other new repos where pre hook enabled. Either I use message policy or rally policy, it still does not reflect in rally change set. I use valid rally ID on my commit and it still does not reflect in tally change set.

    We are actively looking for the integration and your support response is very slow.

    How are you going to assist once this plugin is installed on prod.

    Regards Viswa

    -

  4. George Mace

    Hi Viswa, the rally changeset is handled by another hook, that should be enabled and also configured on the rally side. Take a look on the issue #1. Are you still facing network timeout issues?

  5. ViswanathanR

    I don’t see the timeout errors on my BBS side under user profile. But the below com.atlassian.sal.api.net.ResponseException: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

    Rally certs are imported to the bitbcket keystore and Bitbucket is restarted. But still the same

    Regards, Viswa

  6. Log in to comment