mohamicorp / stash-jenkins-postreceive-webhook Goto Github PK
View Code? Open in Web Editor NEWWebhook used to notify Jenkins when commits are made to Stash
License: Other
Webhook used to notify Jenkins when commits are made to Stash
License: Other
Allow the hook to be configured globally with the ability to override the global configuration for each repository.
Why do I need to populate the URL of the Git repo i'm currently enabling a hook on? Surely the plugin is able to do this for me?
Can the UI have a dropdown: HTTP/SSH
Text Box: auto completes from selection above, but allows manual override
On an intermittent basis, a single job will be started twice for a single change. When I push a commit to Stash, sometimes the same Jenkins job (for that development branch or maybe a job that runs off the master when merging to the master) will be started twice.
I do have "Execute concurrent builds if necessary" enabled for the job in Jenkins as I do want to have multiple builds running if there is a newer commit pushed while the existing build is still running.
Is it possible to configure the webhook to be triggered if there is a change to a specific branch?
For example, I would like to trigger a jenkins job only if there is a push to a branch called "release".
Hi!
We get a strange exception for non-admin users that only have write permission to the repo:
at sun.proxy.$Proxy223.getSettings(Unknown Source) ~[na:na]
at com.nerdwin15.stash.webhook.service.eligibility.IgnoreCommittersEligibilityFilter.shouldDeliverNotification(IgnoreCommittersEligibilityFilter.java:39) ~[na:na]
at com.nerdwin15.stash.webhook.service.eligibility.ConcreteEligibilityFilterChain.shouldDeliverNotification(ConcreteEligibilityFilterChain.java:27) ~[na:na]
at com.nerdwin15.stash.webhook.RepositoryChangeListener.onRefsChangedEvent(RepositoryChangeListener.java:34) ~[na:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.6.0_24]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.6.0_24]
The hook ends up with
java.lang.RuntimeException: You are not permitted to access this resource
in atlassian-stash.log.
For admin users everything works fine. For all others the hook is not completed.
When you press the "Trigger Jenkins" button and something goes wrong, it displays "It didn't work!" Would it be possible to display a more helpful error message that would indicate what didn't work?
There are circumstances where it's very handy to have a manual Jenkins trigger button available.
I'll explain a situation that we've come across.
When you create a pull-request from branch X to branch Y, the latest version of the plugin triggers a build on Jenkins, all is well.
However, when another developer would then commit something to branch Y, the build of the pull-request is out of date, since the target branch was modified.
When you would then open the pull-request in the Stash pages, a new automerge is created in the background.
At this moment no build is triggered since every open pull-request with target branch Y would have to be triggered.
This would stress the Jenkins buildserver too much.
In our Stash setup we use the stash-jenkins-postreceive-webhook plugin combined with the stash-build-status-plugin.
The latter one disables the Stash merge-button until a successful build of the automerge was performed.
This will however also block the pull-request from being merged when branch Y was updated in the meanwhile.
A button to trigger a build manually would circumvent this problem.
I'm looking for a way to trigger a parameterized jenkins build. Example, I want the name of the branch on which the commit was pushed.
it would use a url like this:
http://server/job/myjob/buildWithParameters?Branch=Value
(where 'Value' is the name of the branch)
Is that already possible with this plugin?
I installed this plugin and I am currently using it to notify my buildbot. Currently there is almost nothing Jenkins specific in this plugin and it could be used as a generic webhook.
One exception is that the plugins unconditionally adds the /git/notifyCommit?url=...
part to the URL, but the whole generated URL could be put in the Jenkins URL field as well. It's a little less user friendly, but much more flexible.
On the current develop branch, the repo URL is generated and can be overridden with a new base URL. The URL is generated using the NavBuilder. Apparently, the URL provided does not work for SSH, even if swapping out the base URL.
Example:
HTTP Clone URL: http://test.jenkins/stash/scm/test/helloworld.git
SSH Clone URL: ssh://[email protected]:7999/test/helloworld.git
NavBuilder Provides: http://test.jenkins/stash/scm/test/helloworld.git
Note that there's the extra /scm/ in the HTTP/NavBuilder URL. The fix is simply to replace the /scm/ if a Overridden Base URL uses SSH. But, want a second pair of eyes to confirm.
What is the syntax for connecting to a ssl enabled Jenkins that uses authentication for the webhook?
I can't get this to work
Hi, i tried myself but i could not figure it out.
Could you add an example where the user can only select from say 3 different jenkins urls?
From what i can gather, i would think i only need to have a change to the simply.soy no?
Even with the checkbox checked to "Skip SSL Certificate Validation" I get the following error: Error: hostname in certificate didn't match: <sf-itjenkins-01> != <test site>
I am using the "default" SSL capability built into Jenkins, which apparently creates an SSL cert for "<test site>
" (ugh)... I will look into that, but in the mean time, shouldn't "Skip SSL Certificate Validation" work?
We use HTTPS exclusively for Jenkins, and it is a genuine, non-self-signed certificate, so I didn't check 'Skip... Validation' at first. However, this didn't work, and I had to turn on Stash debugging to find out why. This was in catalina.out:
java.lang.NullPointerException
at com.nerdwin15.stash.webhook.service.ConcreteHttpClientFactory.getHttpClient(ConcreteHttpClientFactory.java:36)
at com.nerdwin15.stash.webhook.JenkinsWebhook.postReceive(JenkinsWebhook.java:47)
at com.atlassian.stash.internal.hook.repository.AsyncPostReceiveRepositoryHookAdapter$1.visit(AsyncPostReceiveRepositoryHookAdapter.java:49)
at com.atlassian.stash.internal.hook.repository.AsyncPostReceiveRepositoryHookAdapter$1.visit(AsyncPostReceiveRepositoryHookAdapter.java:44)
at com.atlassian.stash.internal.hook.repository.DefaultRepositoryHookService$8.doInTransaction(DefaultRepositoryHookService.java:412)
at com.atlassian.stash.internal.hook.repository.DefaultRepositoryHookService$8.doInTransaction(DefaultRepositoryHookService.java:406)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:131)
at com.atlassian.stash.internal.hook.repository.DefaultRepositoryHookService.visitEnabledHooks(DefaultRepositoryHookService.java:406)
at sun.reflect.GeneratedMethodAccessor574.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:80)
at com.atlassian.stash.internal.aop.ProfilingAspect.profileMethod(ProfilingAspect.java:43)
at sun.reflect.GeneratedMethodAccessor149.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:621)
at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:610)
at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:65)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.security.access.intercept.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:64)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.adapter.ThrowsAdviceInterceptor.invoke(ThrowsAdviceInterceptor.java:124)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:161)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at com.sun.proxy.$Proxy182.visitEnabledHooks(Unknown Source)
at com.atlassian.stash.internal.hook.repository.AsyncPostReceiveRepositoryHookAdapter.postReceive(AsyncPostReceiveRepositoryHookAdapter.java:44)
at com.atlassian.stash.internal.hook.repository.AsyncPostReceiveRepositoryHookAdapter.onRefsChangedEvent(AsyncPostReceiveRepositoryHookAdapter.java:39)
at sun.reflect.GeneratedMethodAccessor769.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:36)
at com.atlassian.event.internal.AsynchronousAbleEventDispatcher$2.run(AsynchronousAbleEventDispatcher.java:66)
at com.atlassian.sal.core.executor.ThreadLocalDelegateRunnable.run(ThreadLocalDelegateRunnable.java:38)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
It does work now that I have the box checked, which is an acceptable workaround. Just letting you know. Thanks for sharing this webhook!
For control reasons, I have my repository in Stash locked down so that no 'real' user has write access. Developers can review and approve pull requests, but not merge. I am using the Workzone Stash plugin to perform automatic merges once sufficient approvals of a pull request are received. The automatic merge is configured to use a special 'non-interactive' account that does have write access to the repository.
When the pull request is approved and merged, it looks like the Stash Jenkins Webhook is failing due to a permissions error. It looks like it is using the effective permission of the user logged in when the automatic merge occurs.
Below are partial snippets of the 2 errors I found in the Stash log file that lead me down this path. These are the only log entries that would indicate why my jenkins jobs are not getting triggered.
If this is the case, is there a way to have Stash run this EventListener as a different user?
---snip---
2013-10-16 11:48:36,428 ERROR [AtlassianEvent::pool-3-thread-2] ---[identifying information removed]--- "POST /rest/api/latest/projects/CFMGT/repos/cfmgt/pull-requests/2/approve HTTP/1.1" c.a.e.i.AsynchronousAbleEventDispatcher There was an exception thrown trying to dispatch event 'com.atlassian.stash.repository.sync.RefsSynchronizedEvent[source=com.atlassian.stash.internal.repository.sync.DefaultRefSyncService@302b25c0]' from the invoker 'SingleParameterMethodListenerInvoker{method=public void com.nerdwin15.stash.webhook.RepositoryChangeListener.onRefsChangedEvent(com.atlassian.stash.event.RepositoryRefsChangedEvent), listener=com.nerdwin15.stash.webhook.RepositoryChangeListener@5e123c18}'.
java.lang.RuntimeException: You are not permitted to access this resource
at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:54) ~[atlassian-event-2.3.0.jar:na]
at com.atlassian.event.internal.AsynchronousAbleEventDispatcher$2.run(AsynchronousAbleEventDispatcher.java:66) ~[atlassian-event-2.3.0.jar:na]
at com.atlassian.sal.core.executor.ThreadLocalDelegateRunnable.run(ThreadLocalDelegateRunnable.java:38) ~[sal-core-2.10.3.jar:na]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) ~[na:1.7.0_25]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) ~[na:1.7.0_25]
at java.lang.Thread.run(Thread.java:724) ~[na:1.7.0_25]
Caused by: 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-2.6.2.jar:na]
at sun.reflect.GeneratedMethodAccessor1802.invoke(Unknown Source) ~[na:na]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_25]
at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_25]
at org.springframework.aop.framework.adapter.ThrowsAdviceInterceptor.invokeHandlerMethod(ThrowsAdviceInterceptor.java:144) ~[spring-aop-3.2.3.RELEASE.jar:3.2.3.RELEASE]
---end snip---
---snip---
2013-10-16 11:48:36,640 ERROR [AtlassianEvent::pool-3-thread-2] ---[identifying information removed]--- "POST /rest/api/latest/projects/CFMGT/repos/cfmgt/pull-requests/2/approve HTTP/1.1" c.a.e.i.AsynchronousAbleEventDispatcher There was an exception thrown trying to dispatch event 'com.atlassian.stash.repository.sync.RefsSynchronizedEvent[source=com.atlassian.stash.internal.repository.sync.DefaultRefSyncService@302b25c0]' from the invoker 'SingleParameterMethodListenerInvoker{method=public void com.wittified.TaskRepositoryEvent.postReceive(com.atlassian.stash.event.RepositoryRefsChangedEvent), listener=com.wittified.TaskRepositoryEvent@8efa324}'.
java.lang.RuntimeException: An error occurred while executing an external process: [e02b6a2]: Unexpected output; expected a 'commit' object
at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:54) ~[atlassian-event-2.3.0.jar:na]
at com.atlassian.event.internal.AsynchronousAbleEventDispatcher$2.run(AsynchronousAbleEventDispatcher.java:66) ~[atlassian-event-2.3.0.jar:na]
at com.atlassian.sal.core.executor.ThreadLocalDelegateRunnable.run(ThreadLocalDelegateRunnable.java:38) ~[sal-core-2.10.3.jar:na]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) ~[na:1.7.0_25]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) ~[na:1.7.0_25]
at java.lang.Thread.run(Thread.java:724) ~[na:1.7.0_25]
Caused by: com.atlassian.stash.exception.ServerException: An error occurred while executing an external process: [e02b6a2]: Unexpected output; expected a 'commit' object
at com.atlassian.stash.internal.scm.git.GitCommandExitHandler.evaluateThrowable(GitCommandExitHandler.java:120) ~[na:na]
at com.atlassian.stash.internal.scm.git.GitCommandExitHandler.onCancel(GitCommandExitHandler.java:46) ~[na:na]
at com.atlassian.stash.scm.BaseCommand.callExitHandler(BaseCommand.java:138) ~[stash-spi-2.6.2.jar:na]
at com.atlassian.stash.scm.BaseCommand$CommandFuture.internalGet(BaseCommand.java:257) ~[stash-spi-2.6.2.jar:na]
at com.atlassian.stash.scm.BaseCommand$CommandFuture.get(BaseCommand.java:224) ~[stash-spi-2.6.2.jar:na]
---end snip---
Thanks,
Doug Hanks
Hi!
I set up a post receive hook in order to trigger a Jenkins build as soon as there is a change committed to branch develop
. Rationale: we do not want to wait until Jenkins would poll for changes but to proactively start a new build the moment some change was committed.
In Stash, I configured Stash Post-Receive Webhook to Jenkins with the following values:
https://jenkins.local/job/product-develop/build?token=foobar&cause=Triggered%20by%20Stash%20Post-Receive%20Webhook
ssh://[email protected]:7999/PROD/code.git
checked
In Jenkins, I am using the following configuration (among other settings, obviously):
ssh://[email protected]:7999/PROD/code.git
origin/develop
checked
foobar
checked
"every five minutes"
However, it seems that Stash Post-Receive Webhook never connects to Jenkins. At least, no new build gets scheduled.
Why is it required to enable the "Poll SCM option" anyway? I actually want to trigger builds remotely via the Stash Post-Receive Webhook and not via Jenkin's polling mechanism. I think there is a misunderstanding on my part, right?
Regards,
Martin
Is it possible to support stash 2.6.x with this plugin? I tried updating the version and building locally, but doesn't build (even when its 2.2.0)
I am getting this when a non admin user commits to the branch, no build is scheduled in jenkins. Admin users can commit and trigger the build.
c.a.s.i.e.AsyncBatchingInvokersTransformer There was an exception thrown trying to dispatch event 'com.atlassian.stash.event.RepositoryPushEvent[source=com.atlassian.stash.internal.hook.PostReceiveEventHook@3cecd9df]' for the invoker 'SingleParameterMethodListenerInvoker{method=public void com.nerdwin15.stash.webhook.RepositoryChangeListener.onRefsChangedEvent(com.atlassian.stash.event.RepositoryRefsChangedEvent), listener=com.nerdwin15.stash.webhook.RepositoryChangeListener@443ca59a}'.
java.lang.RuntimeException: You are not permitted to access this resource
at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:54) ~[atlassian-event-2.3.0.jar:na]
at com.atlassian.stash.internal.event.AsyncBatchingInvokersTransformer$AsyncInvokerBatch.invoke(AsyncBatchingInvokersTransformer.java:100) ~[stash-platform-2.9.4.jar:na]
at com.atlassian.event.internal.AsynchronousAbleEventDispatcher$2.run(AsynchronousAbleEventDispatcher.java:66) [atlassian-event-2.3.0.jar:na]
at com.atlassian.sal.core.executor.ThreadLocalDelegateRunnable.run(ThreadLocalDelegateRunnable.java:38) [sal-core-2.10.9.jar:na]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_45]
at java.lang.Thread.run(Thread.java:744) [na:1.7.0_45]
... 1 frame trimmed
Caused by: 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-2.9.4.jar:na]
at com.sun.proxy.$Proxy194.getSettings(Unknown Source) ~[na:na]
at com.sun.proxy.$Proxy230.getSettings(Unknown Source) ~[na:na]
at com.sun.proxy.$Proxy230.getSettings(Unknown Source) ~[na:na]
at com.nerdwin15.stash.webhook.service.eligibility.IgnoreCommittersEligibilityFilter.shouldDeliverNotification(IgnoreCommittersEligibilityFilter.java:39) ~[na:na]
at com.nerdwin15.stash.webhook.service.eligibility.ConcreteEligibilityFilterChain.shouldDeliverNotification(ConcreteEligibilityFilterChain.java:27) ~[na:na]
at com.nerdwin15.stash.webhook.RepositoryChangeListener.onRefsChangedEvent(RepositoryChangeListener.java:34) ~[na:na]
at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:36) ~[atlassian-event-2.3.0.jar:na]
... 6 common frames omitted
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.1.4.RELEASE.jar:3.1.4.RELEASE]
... 13 common frames omitted
Hi,
I have a requirement to do the build in different environment depends upon the parameter in Java application. Following are my environments
a) Development environment
b) Testing environment
c) Beta environment (would be production environment)
I have different parameters like connectivity, jdbc and ldap parameters for the above 3 environments that are maintained in resource bundle properties.
Currently, i am changing the parameters manually to deploy it respective environment.
If i have to do the build in Jenkins, i need to create three different jobs for 3 different environment
Requirement would be as follows:
a) On click of Development environment job, would pull the souce code from Git
b) Depends upon environment, it has to dynamically take the parameter from properties file and pass the
values to application.
c) Does the build and create a war file
d) Copy the war file in respective folders (Development artifact folder, test artifact folder and beta artifact
folder)
It would be appreciated to let me know what plugins / features exist in the Jenkins to take this forward or any work around solution.
Thanks,
Rhenatas
We get code via Subversion Mirror into stash.
But the hook to jenkins never get fired. Manually Testing works fine.
Logfile:
2014-01-22 00:34:47,776 ERROR [AtlassianEvent::pool-2-thread-6] c.a.s.i.e.AsyncBatchingInvokersTransformer There was an exception thrown trying to dispatch event 'com.atlassian.stash.event.RepositoryPushEvent[source=org.tmatesoft.subgit.stash.web.SgRepositoryManager@41219615]' for the invoker 'SingleParameterMethodListenerInvoker{method=public void com.nerdwin15.stash.webhook.RepositoryChangeListener.onRefsChangedEvent(com.atlassian.stash.event.RepositoryRefsChangedEvent), listener=com.nerdwin15.stash.webhook.RepositoryChangeListener@13e1c6a6}'.
java.lang.RuntimeException: java.lang.NullPointerException
at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:50) ~[atlassian-event-2.3.1.jar:na]
at com.atlassian.stash.internal.event.AsyncBatchingInvokersTransformer$AsyncInvokerBatch.invoke(AsyncBatchingInvokersTransformer.java:100) ~[stash-platform-2.10.0.jar:na]
at com.atlassian.event.internal.AsynchronousAbleEventDispatcher$2$1.run(AsynchronousAbleEventDispatcher.java:52) [atlassian-event-2.3.1.jar:na]
at com.atlassian.sal.core.executor.ThreadLocalDelegateRunnable.run(ThreadLocalDelegateRunnable.java:38) [sal-core-2.10.9.jar:na]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_51]
at java.lang.Thread.run(Thread.java:744) [na:1.7.0_51]
... 1 frame trimmed
Caused by: java.lang.NullPointerException: null
at com.nerdwin15.stash.webhook.RepositoryChangeListener.onRefsChangedEvent(RepositoryChangeListener.java:47) ~[na:na]
at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:36) ~[atlassian-event-2.3.1.jar:na]
... 6 common frames omitted
May anyone can help me or fix it if it is an bug.
Thank you,
Thomas
Right now the plugin doesn't appear in the in-product marketplace view (the Universal Plugin Manager) for Stash 2.4.1.
I suspect that is because of the claimed version compatibility. I don't know if there is an easy way to mark your plugin as 'forward-compatible' from 2.2.0 - 2.X or whatever, or if you have to update it with each release of Stash.
When we upgraded the plugin to 2.5, every commit on Stash causes Jenkins all builds to start. We did not see this happen with version 2.4, only on the upgrade. This is a big problem as it was causing even builds that should not be triggered by a commit to start.
Any idea what could be causing this?
Please consider adding a button in the settings dialog to trigger test builds against Jenkins. I think that would be better than having users do test commits and pushing to ensure they have the correct URLs.
Hello,
I have installed yesterday your hook, which looks very good (great work!), but it seems that no notify is triggered after a commit into a branch. I am using Stash 2.8.4.
In the configuration of the hook all work fine and it is possible to trigger a polling.
I have enabled debug output for the Notifier and JenkinsResource class, but I get no output when committing something.
It makes no difference using an administrative account or a normal user. It seems like the Notifier class isn't called at all.
No exceptions or similar can be found. I don't know how to activate the debug log for the Hook Service otherwise I had looked into its log.
What could be wrong?
Hi,
we're making heavy use of your webhook and firstly I'd like to say how fantastic it is!
We have one slight issue - we have multiple jenkins jobs pointing at the same Stash repo, each job configured to build a different branch.
What I'm seeing is, when I push to one branch, the build for that branch is triggered, but also builds for other branches too.
Could this be a problem in the way I've set things up? Am I misunderstanding something? Or could it be a bug in the webhook?
Many thanks
I've been using this plugin for about a week, it works really well, but this morning I installed an update when Stash notified me a new version was available. I've just realised that as a result the plugin is no longer enabled in any of my repositories.
This is really annoying, will this happen every time it updates? That seems untenable.
I'm not really sure what version I was running before but I can hunt through the backups if you need that info.
Steps:
But, when I enable the plugin in Stash with Jenkins URL = jenkins.xyz.com:8080 and GIT repo URL = ssh://[email protected]:7999/eee/repo.git, merging my pull-request to the master branch does NOT trigger the jenkins build. Is there a way to look at logs for the plugin to figure out what's going on?
I have to agree with ashnazg on issue #38.
The post-merge trigger doesn't execute anymore, causing the post-merge build not to run.
Hi,
We recently upgraded from Stash 2.5.4 to 3.2.0 and in doing so moved to the 2.5.0 version of the Stash Jenkins Webhook. We noticed that the plugin will trigger builds on an initial pull request. However, if the pull request is subsequently updated with an additional commit no additional build is triggered. This wasn't the case in the previous version of the plugin.
I noticed you had a 2.5.1-SNAPSHOT version for another issue and I am wondering if that same JavaScript issue was affecting us in this case as well.
Thanks for this plugin by the way.
Would be great if could have a way to ignore comments by git email address instead of something specific to Stash.
For Jenkins, I've just an access key directly to the repository, but since that user doesn't have a Stash account, it seems I can't block commits from Jenkins. This is causing a loop in my build server as I do a commit during build to update version numbers automatically.
Either somewhat to ignore commits by access key as well, or maybe the ability to ignore commits where the comment matches a particular regex. I would like to ignore commits which have a comment similar to something like 'Release x.x.x'.\
Maybe others have been able to do this another way, or I'm missing something.
Thanks
Steph
(copying comments from blog)
-- Comment from 12/4 11:10
We tried to use your plugin with Stash Pull Requests, but encountered a problem, I know that it is on Stash side, but want to ask if you have some workaround in mind:
What we want to accomplish is:
But to update reference and have additional commits in the same Pull we need to Approve and Unapprove each time after commit, which is makes no sense
Do you have any workaround or any ideas how to adopt this to Pull Requests process?
------ Comment on 12/4 11:57
I got a fast reply from Atlassian Developer according to this.
Michael could be interesting for you as a feature, since he also submitted some code snippet how to solve this - https://answers.atlassian.com/questions/239988/change-pull-request-refs-after-commit-instead-of-after-approval-or-workaround
Stash is setup to send a notification to jenkins after a commit to the develop branch. However, after we merge a pull request, it will trigger two builds.
The first build (in hipchat) says something like "Started by changes from John Doe (x files(s) changed)
The second build will just say "Started by an SCM change"
The second build is triggered pretty soon after the first build (it doesn't run until the first build is finished, however).
When viewing the Build Status for a given PR overall, as well as for individual commits, a single Build Failure will result in the overall Build Status to be shown as Failure even when subsequent builds are successful.
Note how the overall PR build status shows failure (far right), but the popup build history shows the most recent build was successful:
Here again, note how the given commit (the top one) shows build failure (far right), but the popup build history for it shows the most recent build was successful:
I wanted to check with you, the plugin, to see what you think about there the icon choice bug might be, before filing a bug with Stash itself.
When trying to configure the plugin - I'm receiving this error (when trying to configure the settings for the hook (in settings in the repo) -
Failed to load config form: com.nerdwin15.stash-stash-webhook-jenkins:jenkinsPostReceiveHook-config-form, errors: TypeError: Cannot read property 'nerdwin15' of undefined
It also seems that since upgrading from 3.1.x to 3.2.0 - the plugin is no longer triggering our Jenkins server
We are using the latest version of the plugin 2.5.0
Hi,
please see/vote this issue:
https://issues.jenkins-ci.org/browse/JENKINS-24133
THe Update to 2.5.0 caused Problems to our setups. We decided to downgrade to 2.4.2 instead of applying the workaroudn described there...
Can anything be done on Plugin-side? (e.g. disable sending the sha1sum)
We have configured 'Ignore from' option of this hook with value of 'master production release/* integration/* sandbox/* ' , but all of these branches are still being built for every new change detected in git repository. Tried look into the source code, but still clueless. Does it work for anyone?
Hey there.
Currently the stash-jenkins-postreceive-webhook does not trigger jenkins if a new branch was created and pushed but that branch had no new commits. It might be possible to identify a new branch creation from a push event by checking for a RefChangeType of ADD from RefChange.getType().
Background:
As part of the git-flow release process, a release/X.Y.Z branch is cut from develop. If develop was stable, possibly no commits are necessary to release/X.Y.Z. In this case we would want jenkins to build a release candidate artifact from this new branch creation event (even though no new commit was made) and auto-deploy it for testing. Possibly develop commits get autodeployed to a dev environment and release/* commits get autodeployed to a qa environment.
RepositoryChangeListener sends a notification to Jenkins on the event thread. This is a remote call that can block the event thread if the network is slow or the Jenkins server is slow to respond. If the Jenkins instance is structurally slow, all event threads will eventually get blocked trying to send notifications to Jenkins and event processing will fail.
Ideally, the notification to Jenkins should use an asynchronous HTTP request and not block the threads. See https://hc.apache.org/httpcomponents-asyncclient-dev/httpasyncclient/examples/org/apache/http/examples/nio/client/AsyncClientHttpExchangeFutureCallback.java for an example.
Michael Heemskerk
Atlassian Stash
Or is there a specific reason why you checked this in?
Hi,
I'm using the Stash Webhook to Jenkins plugin v.2.4.1 with Stash v.2.12.1 and the following message shows up each time I click on the "Enable" button for the plugin in the Hooks Settings page for any repo :
"An error occured" "Something went wrong while trying to serve your request. Try reloading the page."
If I click "Reload the page", the config. window closes and nothing happens.
If I click "Close" instead of "Reload" I can then fill all the required fields and press "Enable". If I come back and edit the configuration, I will see the error message again.
The plugin works correctly except for the error message that is displayed without reason.
Could you fix it or tell me if there is a workaround?
Thanks.
We have multiple Jenkins servers building different platforms. At the moment each commit can only notify a single Jenkins environment, but being able to notify more than one would be extremely useful.
In my case, just the ability to add multiple URLs would be fine as the remaining properties are the same in each instance.
Identify the SHA of the current head of a pull request merge product (refs/pull-requests/*/merge) and use that to trigger a build of the merge product in Jenkins.
Note that this might break reporting by the Jenkins StashNotifier plugin as that relies on the SHA to report, I imagine the reporting itself will happen correctly but the merge product SHA is not one of the commits listed in the Stash pull request UI. It would be an acceptable hack if we could somehow send the source branch SHA as a parameter and use that for reporting build results back to Stash.
I mean it can call any URL not only jenkin, and support the API in https://help.github.com/articles/post-receive-hooks
Currently the "trigger build" button triggers Jenkins to poll Stash, if a build has already completed for a given commit Jenkins will not rerun that build.
The Jenkins Git plugin API can take a SHA as a parameter. Would it be possible to have the plugin calculate the most recent SHA in a pull request and have Jenkins rebuild that commit when the "trigger build" button is pressed?
Would it also be possible to provide a configuration option so that rather than sending the SHA of the source branch the plugin sent the SHA of the merge product of the source and target created by Stash (refs/pull-requests/*/merge)?
I can provide use cases and details if that would be helpful.
Thanks,
Jim
I saw the blog post about requiring build passes in order to merge a pull request, but I couldn't find any pull request hook plugins.
Does this run every time a new pull request is made?
If so, does it run again after the pull request is merged?
When I create a pull request, a NullPointerException is thrown.
I saw the other NPE issue, but my configuration has the 'Skip SSL Certification Validation' checkbox checked, so it may not be the same issue.
Based on the stack trace, this may be related to the 'Committers to ignore' option. This field is blank in my configuration.
Here is the error from the Stash log.
--snip--
2013-10-17 09:18:03,854 ERROR [AtlassianEvent::pool-3-thread-1] ---[identity removed=--- SSH - git-receive-pack '~dhanks/dhanks-cfmgt-filenameparsing.git' c.a.e.i.AsynchronousAbleEventDispatcher There was an exception thrown trying to dispatch event 'com.atlassian.stash.event.RepositoryPushEvent[source=com.atlassian.stash.internal.hook.PostReceiveEventHook@644d254e]' from the invoker 'SingleParameterMethodListenerInvoker{method=public void com.nerdwin15.stash.webhook.RepositoryChangeListener.onRefsChangedEvent(com.atlassian.stash.event.RepositoryRefsChangedEvent), listener=com.nerdwin15.stash.webhook.RepositoryChangeListener@5e123c18}'.
java.lang.RuntimeException: java.lang.NullPointerException
at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:50) ~[atlassian-event-2.3.0.jar:na]
at com.atlassian.event.internal.AsynchronousAbleEventDispatcher$2.run(AsynchronousAbleEventDispatcher.java:66) ~[atlassian-event-2.3.0.jar:na]
at com.atlassian.sal.core.executor.ThreadLocalDelegateRunnable.run(ThreadLocalDelegateRunnable.java:38) ~[sal-core-2.10.3.jar:na]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) ~[na:1.7.0_25]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) ~[na:1.7.0_25]
at java.lang.Thread.run(Thread.java:724) ~[na:1.7.0_25]
Caused by: java.lang.NullPointerException: null
at com.nerdwin15.stash.webhook.service.eligibility.IgnoreCommittersEligibilityFilter.shouldDeliverNotification(IgnoreCommittersEligibilityFilter.java:41) ~[na:na]
at com.nerdwin15.stash.webhook.service.eligibility.ConcreteEligibilityFilterChain.shouldDeliverNotification(ConcreteEligibilityFilterChain.java:27) ~[na:na]
at com.nerdwin15.stash.webhook.RepositoryChangeListener.onRefsChangedEvent(RepositoryChangeListener.java:34) ~[na:na]
at sun.reflect.GeneratedMethodAccessor5099.invoke(Unknown Source) ~[na:na]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_25]
at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_25]
at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:36) ~[atlassian-event-2.3.0.jar:na]
... 5 common frames omitted
---end snip---
Thanks,
Doug
Hello,
I've been trying to test the plugin but am unable to trigger a build for branches with a slash. For example, a branch name of "users/johny" won't build, but the "master" branch will.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.