- changed title to support for Stash 3.5.* cloud
- edited description
support for POST requests
Hi, I've seen your plugin on the marketplace and unfortunately I can't install it in Stash 3.5: do you have a version for this software?
Thanks a lot.
Best regards.
Matteo
Comments (25)
-
reporter -
Hi @satboy78 ,
Stash is only available as self-hosted server application - the Atlassian cloud solution is bitbucket. At least as far as I know.
Could you give me some more details on what you are running? Perhaps also some links?
Cheers, Alex
-
reporter Hi Alex, thanks a lot for your answer. Sorry, I mixed up things. Here we have Stash installed on a server, our version is 3.5, we would like to install your plugin: do you think it's possible? I've seen that your plugin works with Stash <= 3.10
Thanks a lot.
Best regards.
Matteo
-
reporter - changed title to support for Stash 3.5.*
- edited description
-
Hi @satboy78 ,
the current version of the plugin (3.2) works for versions of stash from 2.10 to 3.10 - so stash 3.5 should work just fine. What's the error you are getting? Could you attach a screenshot or something?
Cheers, Alex
-
I just tried it out and there should be no problem:
-
reporter Hi @aeffle , thanks a lot for your email; I'll try again and then I'll send you a feedback, maybe I did something wrong.
Thanks a lot.
Best regards, Matteo
-
reporter Hi @aeffle thanks a lot, it has been installed correctly!!
I'm trying to trigger a hook at every push I make; I've used this url
https://packagist.mtvi.com/api/update-package?username=XXX&apiToken=YYY
with POST method, but it doesn't work.
Do I have to modify the url?
Thanks a lot for your help!
Matteo
-
Hi @satboy78 ,
POST currently doesn't support this.. but I'm on it. Should be done within the next few days... For now, try to stick to GET if that's possible...
Cheers, Alex
-
reporter Hi @aeffle , thanks a lot! I've tried to use GET but it doesn't work... do you have ever tried to use GET method with your plugin for Stash and Packagist?
Thanks, Matteo
-
Hi @satboy78 ,
from the packagist docu, they require a POST request with the content-type application/json and some json-data as body:
From https://packagist.org/about:
If you use BitBucket, GitLab or other non-supported method you can add a "POST" hook or Push Event and then enter 'https://packagist.org/api/update-package? username=XXX&apiToken=YYY' as the URL. To manually send update notices from other services you can build up a POST request to the previous URL and send the following JSON request body: {"repository": { "url": "...the VCS url Packagist should update..."}}. Do not forget to send a Content-Type header set to application/json too.
Your timing couldn't be better :-) I am currently implementing the data part of the POST request. I started with content-type "application/x-www-form-urlencoded" as one normally would like to post a form. I was even just about to simplify the gui and only support the form-thingy but with your request I now see that it makes sense to support more :-)
I will add it to the todo list and you will probably get a solution soon.
Cheers, Alex
-
Hi @satboy78 ,
the simple version with a POST to
https://packagist.org/api/bitbucket?username=username&apiToken=…
should already work with the current version.
Cheers, Alex
-
reporter - changed title to support for Stash 3.5.*
-
reporter - changed title to support for POST requests
- marked as bug
-
- marked as enhancement
-
Hi @satboy78 ,
I have a snapshot which you might want to try out in our test environment.
Here is a screenshot of the UI (which I will probably rearrange at some point):
And this is the request it will generate:
I will put the jar file in the download section and you can check it out :-) I will do some testing as well and once I'm convinced, I will release it to the marketplace as well :-)
Cheers, Alex
-
reporter Hi @aeffle ,
thanks a lot, I download it and then I'll test it.
I'll keep you updated.
Thanks a lot.
Regards, Matteo
-
reporter Hi @aeffle,
I've installed this new version but unfortunately it doesn't work.
Here you can see our Stash log; nothing in the packagist log.
Do you think this issue is due to http request? maybe packagist needs https requests?
Thanks a lot.
Best regards, Matteo
2015-06-16 09:47:04,558 ERROR [AtlassianEvent::thread-22] brunomat @xxxxxxxxxxxxxxxxx 1mi85xn xxx.xxx.xxx.xxx SSH - git-receive-pack '/intl-seta/standard-edition.git' d.a.s.p. hook.HttpGetPostReceiveHook Some IO exception occured Server returned HTTP response code: 406 for URL: http://packagist.mtvi.com/api/update-package?username=brunomat&apiToken=YYYYYYYYYYYY java.io.IOException: Server returned HTTP response code: 406 for URL: http://packagist.mtvi.com/api/update-package?username=brunomat&apiToken=YYYYYYYYYYYYY at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:1.7.0_45] at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:1675) ~[na:1.7.0_45] at sun.net.www.protocol.http.HttpURLConnection$6.run(HttpURLConnection.java:1673) ~[na:1.7.0_45] at java.security.AccessController.doPrivileged(Native Method) ~[na:1.7.0_45] at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1671) ~[na:1.7.0_45] at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1244) ~[na:1.7.0_45] at de.aeffle.stash.plugin.hook.helper.HttpAgent.logResponseBody(HttpAgent.java:159) ~[plugin_5960404243428465353_stash-http-get-post-receive-hook-3.3-SNAPSHOT_1434456258 000.jar:na] at de.aeffle.stash.plugin.hook.helper.HttpAgent.doPost(HttpAgent.java:143) ~[plugin_5960404243428465353_stash-http-get-post-receive-hook-3.3-SNAPSHOT_1434456258000.jar:n a] at de.aeffle.stash.plugin.hook.helper.HttpAgent.doPageRequest(HttpAgent.java:82) ~[plugin_5960404243428465353_stash-http-get-post-receive-hook-3.3-SNAPSHOT_1434456258000 .jar:na] at de.aeffle.stash.plugin.hook.HttpGetPostReceiveHook.postReceive(HttpGetPostReceiveHook.java:89) [plugin_5960404243428465353_stash-http-get-post-receive-hook-3.3-SNAPSH OT_1434456258000.jar:na] at com.atlassian.stash.internal.hook.repository.AsyncPostReceiveRepositoryHookAdapter$1.visit(AsyncPostReceiveRepositoryHookAdapter.java:49) [AsyncPostReceiveRepositoryH ookAdapter$1.class:na] at com.atlassian.stash.internal.hook.repository.AsyncPostReceiveRepositoryHookAdapter$1.visit(AsyncPostReceiveRepositoryHookAdapter.java:45) [AsyncPostReceiveRepositoryH ookAdapter$1.class:na] at com.atlassian.stash.internal.hook.repository.DefaultRepositoryHookService$RepositoryHookPagedTransactionCallback.doInTransaction(DefaultRepositoryHookService.java:616 ) [DefaultRepositoryHookService$RepositoryHookPagedTransactionCallback.class:na] at com.atlassian.stash.internal.hook.repository.DefaultRepositoryHookService$RepositoryHookPagedTransactionCallback.doInTransaction(DefaultRepositoryHookService.java:592 ) [DefaultRepositoryHookService$RepositoryHookPagedTransactionCallback.class:na] at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:133) [TransactionTemplate.class:4.1.1.RELEASE] at com.atlassian.stash.internal.hook.repository.DefaultRepositoryHookService.visitEnabledHooks(DefaultRepositoryHookService.java:304) [DefaultRepositoryHookService.class :na] at com.atlassian.stash.internal.hook.repository.AsyncPostReceiveRepositoryHookAdapter.postReceive(AsyncPostReceiveRepositoryHookAdapter.java:45) [AsyncPostReceiveReposit oryHookAdapter.class:na] at com.atlassian.stash.internal.hook.repository.AsyncPostReceiveRepositoryHookAdapter.onRefsChangedEvent(AsyncPostReceiveRepositoryHookAdapter.java:40) [AsyncPostReceive RepositoryHookAdapter.class:na] at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:36) [SingleParameterMethodListenerInvoker.class:na] at com.atlassian.stash.internal.event.AsyncBatchingInvokersTransformer$AsyncInvokerBatch.invoke(AsyncBatchingInvokersTransformer.java:100) [AsyncBatchingInvokersTransfor mer$AsyncInvokerBatch.class:na] at com.atlassian.event.internal.AsynchronousAbleEventDispatcher$1$1.run(AsynchronousAbleEventDispatcher.java:48) [AsynchronousAbleEventDispatcher$1$1.class:na] at com.atlassian.sal.core.executor.ThreadLocalDelegateRunnable.run(ThreadLocalDelegateRunnable.java:38) [ThreadLocalDelegateRunnable.class: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] ... 32 frames trimmed Caused by: java.io.IOException: Server returned HTTP response code: 406 for URL: http://packagist.mtvi.com/api/update-package?username=brunomat&apiToken=YYYYYYYYYYYYYYY at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1626) ~[na:1.7.0_45] at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:468) ~[na:1.7.0_45] at de.aeffle.stash.plugin.hook.helper.HttpAgent.checkResponseCode(HttpAgent.java:150) ~[plugin_5960404243428465353_stash-http-get-post-receive-hook-3.3-SNAPSHOT_1434456258000.jar:na] at de.aeffle.stash.plugin.hook.helper.HttpAgent.doPost(HttpAgent.java:142) ~[plugin_5960404243428465353_stash-http-get-post-receive-hook-3.3-SNAPSHOT_1434456258000.jar:na] 17 common frames omitted
-
reporter Hi @aeffle , it seems that http 406 errors happen when "The requested resource is only capable of generating content not acceptable according to the Accept headers sent in the request."
So, current issue is that packagist is trying to return content of a mime type not in the accept header of the request.
Can you please check it?
Thanks a lot.
Best regards.
Matteo
-
reporter Hi [~burdgem], I wrote a php post-receive hook script and it seems that Packagist answer is "Could not parse payload repository URL"
This is the full transcript:
string(337) "HTTP/1.1 406 Not Acceptable Date: Thu, 18 Jun 2015 08:44:45 GMT Server: Apache/2.2.29 (Unix) X-Powered-By: PHP/5.6.5 Cache-Control: no-cache X-Frame-Options: DENY Vary: User-Agent Connection: close Transfer-Encoding: chunked Content-Type: application/json 'status' => string(5) "error" 'message' => string(38) "Could not parse payload repository URL"
I've googled around for this error, it seems that Packagist doesn't accept our Stash url
https://github.com/composer/packagist/blob/master/src/Packagist/WebBundle/Controller/ApiController.php - rows 175 - 188
and in fact, reading rows 58 - 87, you can see that regex rules don't match our url
ssh://git@stash.mtvi.com/intl-seta/standard-edition.git (and even https://stash.mtvi.com/git/intl-seta/standard-edition.git)
Maybe we need to fork Packagist and create a regex that can handle Stash repos.
I'll keep you updated.
Thanks a lot.
Regards.
Matteo
-
reporter Hi @aeffle, I've prepared a regex and I made a pull request to Packagist a few minutes ago.
https://github.com/composer/packagist/pull/528
I hope they will merge it asap!!
I'll keep you updated.
Thanks a lot.
Matteo
-
Hi Matteo,
thanks for your messages. Hope you get your packagist pull-request merged soon. For now, on my part, I can see that some better debugging capabilities would be nice. I will think about it and probably write another enhancement request myself to add these...
Keep me updated :-)
Cheers, Alex
-
reporter Hi @aeffle , Seldaek merged my commit into composer:master a day ago. Today I'll make some tests and then I'll tell you if it's all ok.
Have a great day. Matteo
-
reporter Hi @aeffle , I've made some tests, the hook works fine!
Thanks a lot for your help!
Matteo
-
- changed status to resolved
Will be available in the new release for bitbucket server 4.0
- Log in to comment