ef-labs / stash-hook-mirror Goto Github PK
View Code? Open in Web Editor NEWAn Atlassian Stash repository hook for mirroring to one or more remote git repositories.
License: MIT License
An Atlassian Stash repository hook for mirroring to one or more remote git repositories.
License: MIT License
Password should not be returned to the client in clear text json
Hey,
I'm getting a problem with mirroring, but nothing significant is appearing in the log files.
I understand this is meant to retry, but my installation of stash isn't running this schedule properly for whatever reason (I'm still looking into that separately).
That means the log looks like:
2014-08-18 16:03:42,336 WARN [threadpool:thread-85] Tony @113CSN8x963x6657x0 1rmbeux 192.168.0.180:56797,192.168.0.2 "PUT /rest/api/latest/projects/_/repos/******/settings/hooks/com.englishtown.stash-hook-mirror:mirror-repository-hook/settings HTTP/1.1" c.e.stash.hook.MirrorRepositoryHook Failed to mirror repository _****, retrying in 1 minute (attempt 1 of 5).
Then doesn't give me any more information (I notice in your code you're waiting til the 5th try before displaying the nature of the exception).
Seriously frustrating. A "debug mode" where it just logs everything wouldn't go astray.
Mirroring to CodeCommit on AWS would be nice. It's a bit more complicated and would require some configuration, however I think it would be doable.
An alternative but less desireable method would be to zip the repo up and ship it to S3, more specifically a URL - like API Gateway. However with repos that get a lot of use it might be best to stick with CodeCommit.
We have bitbucket server 5.1.0 on RHEL im tryingo to use plugin version 2.2.0 and ending up with this:
2018-01-31 11:03:07,763 ERROR [threadpool:thread-1] admin @passwd 10.x.x.x,127.0.0.1 "PUT /rest/api/latest/projects/DB/repos/reponame/settings/hooks/com.englishtown.stash-hook-mirror:mirror-repository-hook/enabled HTTP/1.1" c.e.b.hook.MirrorRepositoryHook Failed to mirror repository reponame after 5 attempts.
com.atlassian.bitbucket.scm.CommandFailedException: '/usr/bin/git push --prune --atomic ssh://servername/repo/git/DB/reponame --force +refs/heads/:refs/heads/ +refs/tags/:refs/tags/ +refs/notes/:refs/notes/' exited with code 129 saying: error: unknown option `atomic'
Latest version of git aviable for RHEL6 is 2.3.5 option atomic is from git-2.4+ I need some way to edit options plugin use... I did read your documents and did not find any Is there any chance for me to use this plugin?
spehyr
Hi, I just found out that since c845d27, the MirrorRepositoryHook
uses --prune
.
I'm thinking about creating a pull request to use the old --mirror
way if it's an older Git, but perhaps you have some philosophy on how you want this to be.
Thoughts?
Or when the hook is enabled if possible.
In case there is a network error, the mirror command should be retried a couple times.
Hi,
I am using the plugin and it works fine when we mirror repos to a remote git server but I tried to mirror a repo to another project in Stash and ran into problems,
Excerpt from log
2014-08-28 14:11:11,840 ERROR [threadpool:thread-3965223] svante.gustafsson 847x60717387x0 4x0p6k ...,127.0.0.1 "PUT /rest/api/latest/projects/ESI/repos/test-repo/settings/hooks/com.englishtown.stash-hook-mirror%3Amirror-repository-hook/settings HTTP/1.0" c.e.stash.hook.MirrorRepositoryHook Failed to mirror repository test-repo after 5 attempts.
com.atlassian.stash.exception.ServerException: An error occurred while executing an external process: '/usr/bin/git push --prune ssh://[email protected]:7999/~admin/test-repo.git --force +refs/heads/:refs/heads/ +refs/tags/:refs/tags/' exited with code 129 saying: error: --mirror can't be combined with refspecs
I have defined the repo URL as:
ssh://[email protected]:7999/~admin/test-repo.git
Can you see what has gone wrong?
Thnx in advance!
// Svante
I have an issue with mirroring using SSH. In the documentation it is mentioned "If using ssh, ensure your private key is installed for the user stash runs under". WHat is meant with "your" in this case. A "technical users" for the Bitbucket instance which needs to be created or the private key of the users which makes some changes leading a mirror action. I guess/assume the first one but wanted to double-check before trigging some internal IT requests.
I was wondering why you don't use git push --mirror
, which to me looks like it's subsuming what your push command is currently doing? Am I missing something?
Add support for Bitbucket 5
A standard mirror will pull in all refs in a git repo, since stash stores info on pull requests on refs this include any pull requests made as well. Overall this seems like unexpected behaviour when mirroring a repo. My particular problem is that the repo we're mirroring into expect Active Directory usernames and emails, which we enforce in our .gitconfigs for commit entries. But, the stash pull requests have no notion of this and instead using the Auther names and Email addresses specified on the stash server, breaking our mirror as those don't match up exactly.
There is an article explaining one method to ignore pull requests while mirroring, I was hoping there might be a way to accomplish this with this plugin, any thoughts?
http://christoph.ruegg.name/blog/git-howto-mirror-a-github-repository-without-pull-refs.html
According to here:
https://confluence.atlassian.com/display/ENTERPRISE/Stash+Data+Center+Add-ons
It's flagged as 'in progress'.
Thanks,
Sean
2017-06-26 10:09:38,930 WARN [http-nio-7990-exec-7] bitbucket @xxxxxxxxxxxx mdn96k "GET /plugins/servlet/stp/view/system-info/view HTTP/1.1" c.a.s.t.p.PluginSupportInfoAppenderManager Problem adding support info for module 'com.atlassian.bitbucket.server.bitbucket-mirroring-upstream:mirroring-upstream-support-info'
com.atlassian.bitbucket.mirroring.upstream.MirroringDisabledException: Mirroring requires a Bitbucket Data Center license.
We need an allowed list of projects for the plugin in the admin section of stash. There are projects which may be mirrored to github, but not all of them.
Should be able to enter multiple mirrored repositories
Exception in thread "Spring executor 17" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'gcExecutor' defined in URL [bundle://76.0:0/META-INF/spring/atlassian-plugin-context.xml]: Cannot resolve reference to bean 'gitScmConfig' while setting constructor argument; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'gitScmConfig' is defined
When I want to enable/configure the plugin, I only get an empty modal window with a spinning loading indictor, nothing else happens.
Looking into chromes dev console, I found several requests that resulted in a 404.
Examples:
https:///stash/s/d41d8cd98f00b204e9800998ecf8427e/de_DE-1988229788/908f9ba/77/3588e7a34f448dcf2e8928abe3d82cc9/_/download/contextbatch/css/com.englishtown.stash-hook-mirror:mirror-repository-hook-config-form
https:///stash/projects//repos//settings/...
.../-stash.layout.repository/batch.css
.../-atl.general
.../-stash.layout.base
.../-stash.page.repository.settings.hooks
.../-stash.layout.entity
Installation from UPM worked like a charm. Looked into the logs, but didn't find anything related.
Stash version is 2.6.3
Hi,
we have some use cases where we want to mirror only a few branches, e.g. based on a branch pattern and not overwrite remote branches. I think your add-on would be a good baseline for this but would requires some additional features.
Would you in general interest in this feature (could potentially also help in #48) and if so would you be open for a contribution via a PR?
Thanks in advance
Christian
Any tag that I create gets mirrored, but removing one from the source repo doesn't remove the one that was created in the repo
My setup is : bitbucket on source, gitlab as a mirror
Hello,
We have a requirement of not to use --force in the push command, which is used to push changes in to remote server. Can we enable mirroring by not using --force in push command. If so how can we do that?
Thanks in Advance
Subin
Having issues syncing repository with server...would like to mirror individual branches. Any advice?
Hi,
I'm using Atlassian Stash 2.5.0 with SubGit 2.0.0 and Repository Mirroring 1.3.0.
The repository is set to sync to and with SubGit. As long as I commit from git and push it works - as soon as I'm commiting from within SVN it doesn't work (the push is not recognized and the changes are not mirrored to the remote mirror).
You have already answered me in the reviews of the addon:
Thanks for the feedback. Unfortunately the plugin uses the stash repository hook api AsyncPostReceiveRepositoryHook: https://developer.atlassian.com/static/javadoc/stash/latest/spi/reference/com/atlassian/stash/hook/repository/AsyncPostReceiveRepositoryHook.html This only fires for pushes and pull request acceptance. Are you running subgit locally on the stash server? If you run subgit on a different machine and then perform a push it should work. I suppose one way to fix this would be to create a git hook that can trigger the stash repository hook to run. Feel free to enter an issue here: https://github.com/englishtown/stash-hook-mirror/issues (and contribute if you'd like)
How do I create such a trigger?
Regards,
Bernhard Friedreich
Bitbucket 4.10.1.
Repository Mirror Plugin 2.0.0
When I use a ssh connection, for example [email protected]:itext/itextsharp.git
, then mirroring doesn't work.
When I change this to https connection, for example https://github.com/itext/itextsharp.git
, then mirroring does work.
This is relevant when automatically setting up mirroring across the entire stash instance.
It's not that bad, but does clutter up the logs and workers.
2014-02-22 15:15:58,695 ERROR [threadpool:thread-728] git-mirror-robot 911x23958x1 yeirr0 192.168.19.0 "PUT /rest/api/1.0/projects/PROJECT_1/repos/rep_1/settings/hooks/com.englishtown.stash-hook-mirror:mirror-repository-hook/settings HTTP/1.1" c.e.stash.hook.MirrorRepositoryHook Failed to mirror repository pay-jenkins after 5 attempts.
com.atlassian.stash.exception.ServerException: An error occurred while executing an external process: '/usr/bin/git push --prune ssh://git@git-mirror/app/git/stash/project_1/rep_1.git +refs/heads/*:refs/heads/* +refs/tags/*:refs/tags/*' exited with code 1 saying: No refs in common and none specified; doing nothing.
Perhaps you should specify a branch such as 'master'.
fatal: The remote end hung up unexpectedly
error: failed to push some refs to 'ssh://git@git-mirror/app/git/stash/project_1/rep_1.git'
at com.atlassian.stash.scm.git.common.command.GitCommandExitHandler.evaluateThrowable(GitCommandExitHandler.java:120) ~[na:na]
at com.atlassian.stash.scm.git.common.command.GitCommandExitHandler.onError(GitCommandExitHandler.java:163) ~[na:na]
at com.atlassian.stash.scm.DefaultCommandExitHandler.onExit(DefaultCommandExitHandler.java:35) ~[stash-spi-2.10.2.jar:na]
at com.englishtown.stash.hook.PasswordHandler.onExit(PasswordHandler.java:46) ~[plugin.6810898803854921466.stash-hook-mirror-1.7.0_1383594112000.jar:na]
at com.atlassian.stash.scm.BaseCommand.callExitHandler(BaseCommand.java:143) ~[stash-spi-2.10.2.jar:na]
at com.atlassian.stash.scm.BaseCommand$CommandFuture.internalGet(BaseCommand.java:256) ~[stash-spi-2.10.2.jar:na]
at com.atlassian.stash.scm.BaseCommand$CommandFuture.get(BaseCommand.java:225) ~[stash-spi-2.10.2.jar:na]
at com.atlassian.stash.scm.BaseCommand.call(BaseCommand.java:78) ~[stash-spi-2.10.2.jar:na]
at com.englishtown.stash.hook.MirrorRepositoryHook$1.call(MirrorRepositoryHook.java:119) [plugin.6810898803854921466.stash-hook-mirror-1.7.0_1383594112000.jar:na]
at com.englishtown.stash.hook.MirrorRepositoryHook$1.call(MirrorRepositoryHook.java:107) [plugin.6810898803854921466.stash-hook-mirror-1.7.0_1383594112000.jar:na]
When I try to enable the plugin for a specific repo, it asks me for some configuration options, and it requires an http(s) url, username, and password. I have a git location and am using public/private keys for the authentication, how do I add a mirror destination then? The previous version of Mirror let me do this.
Hi ,
We've stash 3.7 installed in once server, and Bitbucket 5.5 in another server. we've installed Repository Mirror plugin in stash and enabled the hook to point it to destination bitbucket. However, whenever there happens a code commit in stash, it is not reflecting in bitbucket.
we've verified that we have GIT installed on server where stash installed.
Any help/suggetsions that you provide is greatly appreciated.
Can this plugin do two-way replication between two Bitbucket Server instances?
We would like to make commits/pull-requests in either repository.
How often will this pull the changes that have been pushed up to the remote?
After we upgraded MS TFS to 2017 the plugin stopped mirror to TFS Git repositories. According to what we have discovered it has something to do with TFS 2017 and basic auth.
Any help or ideas would be appreciated.
From Thomas B at Atlassian:
We saw some errors in a customers logs and have identified an issue with your plugin. It seems you are pulling in the stash-scm-git plugin into your jar.
Your pom has:
<dependency>
<groupId>com.atlassian.stash</groupId>
<artifactId>stash-scm-git</artifactId>
</dependency>
Whereas it should be:
<dependency>
<groupId>com.atlassian.stash</groupId>
<artifactId>stash-scm-git</artifactId>
<scope>provided</scope>
</dependency>
This causes errors for users who are not running the version of Stash you compiled your plugin against.
Hi,
Thnx for a great plugin! It works fine when it is configured properly.
One thing I miss though is that there is no feedback in the UI when setting up the replication. The user is unaware if something is wrong and will usually notice this when he/she realizes that nothing is replicated.
The docs says to look into the Stash logs but regular users usually don't have access to these logs. This means that I as the Stash System Admin is overhauled with questions about what is going on behind the scene.
I think adding some status check and report back in the GUI would make this plugin really user friendly!
Cheers,
// Svante
I take it, that this is not a two-way mirror. So what happens if we accept a pull request on GitHub? Sounds like the mirror would need to force push then? Is that assumption true? As soon as someone pushes something else to the mirror-repository it stops working?
Getting the below error, when using the plugin. Whats strange is if I click save and then disable/enable it will mirror the repo twice and then stop working.
Bitbucket is running on Windows Server 2012R2, version 4.14.7 of bitbucket. running git 2.7
2017-07-19 21:46:12,325 WARN [threadpool:thread-2] admin @KN82F5x1306x3330x0 803u3v 172.31.10.133 "PUT /rest/api/latest/projects/NPCPUP/repos/npc_sensu/settings/hooks/com.englishtown.stash-hook-mirror%3Amirror-repository-hook/settings HTTP/1.1" c.e.b.hook.MirrorRepositoryHook Failed to mirror repository npc_sensu, retrying in 1 minute (attempt 1 of 5).
2017-07-19 21:46:14,806 ERROR [http-nio-80-exec-4] @KN82F5x1306x3331x0 10.193.200.2 "GET / HTTP/1.1" c.a.s.internal.nav.NavBuilderImpl Failed to construct a URI for the NavBuilder from the current requests. Defaulting to application properties.
java.net.URISyntaxException: Expected authority at index 7: http://
at java.net.URI$Parser.fail(URI.java:2848)
at java.net.URI$Parser.failExpecting(URI.java:2854)
at java.net.URI$Parser.parseHierarchical(URI.java:3102)
at java.net.URI$Parser.parse(URI.java:3053)
at java.net.URI.<init>(URI.java:673)
at com.atlassian.stash.internal.nav.NavBuilderImpl.onRequestStarted(NavBuilderImpl.java:158)
at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:40)
at com.atlassian.event.internal.AsynchronousAbleEventDispatcher$1$1.run(AsynchronousAbleEventDispatcher.java:38)
at com.google.common.util.concurrent.MoreExecutors$DirectExecutorService.execute(MoreExecutors.java:299)
at com.atlassian.event.internal.AsynchronousAbleEventDispatcher.dispatch(AsynchronousAbleEventDispatcher.java:88)
at com.atlassian.event.internal.LockFreeEventPublisher$Publisher.dispatch(LockFreeEventPublisher.java:222)
at com.atlassian.event.internal.LockFreeEventPublisher.publish(LockFreeEventPublisher.java:95)
at com.atlassian.stash.internal.event.TransactionAwareEventPublisher.internalPublish(TransactionAwareEventPublisher.java:155)
at com.atlassian.stash.internal.event.TransactionAwareEventPublisher.publish(TransactionAwareEventPublisher.java:99)
at com.atlassian.stash.internal.request.DefaultRequestManager.doAsRequest(DefaultRequestManager.java:82)
at com.atlassian.stash.internal.hazelcast.ConfigurableWebFilter.doFilter(ConfigurableWebFilter.java:38)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.lang.Thread.run(Thread.java:745)
... 36 frames trimmed
2017-07-19 21:46:19,829 ERROR [http-nio-80-exec-5] @KN82F5x1306x3332x0 10.193.200.2 "GET / HTTP/1.1" c.a.s.internal.nav.NavBuilderImpl Failed to construct a URI for the NavBuilder from the current requests. Defaulting to application properties.
java.net.URISyntaxException: Expected authority at index 7: http://
at java.net.URI$Parser.fail(URI.java:2848)
at java.net.URI$Parser.failExpecting(URI.java:2854)
at java.net.URI$Parser.parseHierarchical(URI.java:3102)
at java.net.URI$Parser.parse(URI.java:3053)
at java.net.URI.<init>(URI.java:673)
at com.atlassian.stash.internal.nav.NavBuilderImpl.onRequestStarted(NavBuilderImpl.java:158)
at com.atlassian.event.internal.SingleParameterMethodListenerInvoker.invoke(SingleParameterMethodListenerInvoker.java:40)
at com.atlassian.event.internal.AsynchronousAbleEventDispatcher$1$1.run(AsynchronousAbleEventDispatcher.java:38)
at com.google.common.util.concurrent.MoreExecutors$DirectExecutorService.execute(MoreExecutors.java:299)
at com.atlassian.event.internal.AsynchronousAbleEventDispatcher.dispatch(AsynchronousAbleEventDispatcher.java:88)
at com.atlassian.event.internal.LockFreeEventPublisher$Publisher.dispatch(LockFreeEventPublisher.java:222)
at com.atlassian.event.internal.LockFreeEventPublisher.publish(LockFreeEventPublisher.java:95)
at com.atlassian.stash.internal.event.TransactionAwareEventPublisher.internalPublish(TransactionAwareEventPublisher.java:155)
at com.atlassian.stash.internal.event.TransactionAwareEventPublisher.publish(TransactionAwareEventPublisher.java:99)
at com.atlassian.stash.internal.request.DefaultRequestManager.doAsRequest(DefaultRequestManager.java:82)
at com.atlassian.stash.internal.hazelcast.ConfigurableWebFilter.doFilter(ConfigurableWebFilter.java:38)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.lang.Thread.run(Thread.java:745)
... 36 frames trimmed
Hey,
I am setting up this mirror for some of my Stash repos and it works well most of the times. However, for some repos I get the following error message in the log:
2014-09-04 13:49:27,903 ERROR [threadpool:thread-4178050] svante.gustafsson 825x62977372x0 1qr1w8r 1_...,127.0.0.1 "POST /rest/branch-utils/latest/projects/ESUP/repos/gitolite-admin/branches HTTP/1.0" c.e.stash.hook.MirrorRepositoryHook Failed to mirror repository gitolite-admin after 5 attempts.
com.atlassian.stash.exception.ServerException: An error occurred while executing an external process: '/usr/bin/git push --prune [email protected]:gitolite-admin.git --force +refs/heads/:refs/heads/_ +refs/tags/:refs/tags/' exited with code 129 saying: error: --mirror can't be combined with refspecs
usage: git push [] [ [...]]
-v, --verbose be more verbose
-q, --quiet be more quiet
--repo <repository> repository
--all push all refs
--mirror mirror all refs
--delete delete refs
--tags push tags (can't be used with --all or --mirror)
-n, --dry-run dry run
--porcelain machine-readable output
-f, --force force updates
--recurse-submodules[=<check>]
control recursive pushing of submodules
--thin use thin pack
--receive-pack <receive-pack>
receive pack program
--exec <receive-pack>
receive pack program
-u, --set-upstream set upstream for git pull/status
--progress force progress reporting
--prune prune locally removed refs
--no-verify bypass pre-push hook
--follow-tags push missing but relevant tags
at com.atlassian.stash.scm.git.common.command.GitCommandExitHandler.evaluateThrowable(GitCommandExitHandler.java:120) ~[na:na]
at com.atlassian.stash.scm.git.common.command.GitCommandExitHandler.onError(GitCommandExitHandler.java:163) ~[na:na]
at com.atlassian.stash.scm.DefaultCommandExitHandler.onExit(DefaultCommandExitHandler.java:34) ~[stash-spi-2.11.2.jar:na]
at com.englishtown.stash.hook.PasswordHandler.onExit(PasswordHandler.java:46) ~[plugin.2602867967957298015.stash-hook-mirror-1.9.0_1409046838000.jar:na]
at com.atlassian.stash.scm.BaseCommand.callExitHandler(BaseCommand.java:143) ~[stash-spi-2.11.2.jar:na]
at com.atlassian.stash.scm.BaseCommand$CommandFuture.internalGet(BaseCommand.java:256) ~[stash-spi-2.11.2.jar:na]
at com.atlassian.stash.scm.BaseCommand$CommandFuture.get(BaseCommand.java:225) ~[stash-spi-2.11.2.jar:na]
at com.atlassian.stash.scm.BaseCommand.call(BaseCommand.java:78) ~[stash-spi-2.11.2.jar:na]
at com.englishtown.stash.hook.MirrorRepositoryHook$1.call(MirrorRepositoryHook.java:127) [plugin.2602867967957298015.stash-hook-mirror-1.9.0_1409046838000.jar:na]
at com.englishtown.stash.hook.MirrorRepositoryHook$1.call(MirrorRepositoryHook.java:115) [plugin.2602867967957298015.stash-hook-mirror-1.9.0_1409046838000.jar:na]
at com.atlassian.stash.internal.concurrent.StateTransferringExecutorService$StateTransferringCallable.call(StateTransferringExecutorService.java:131) [stash-platform-2.11.2.jar:na]
at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_45]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178) [na:1.7.0_45]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292) [na:1.7.0_45]
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.utils.process.ProcessException: Non-zero exit code: 129
at com.atlassian.stash.scm.SummarizingProcessHandler.complete(SummarizingProcessHandler.java:49) ~[stash-spi-2.11.2.jar:na]
at com.atlassian.utils.process.ExternalProcessImpl.wrapUpProcess(ExternalProcessImpl.java:659) ~[atlassian-processutils-1.6.0-m1.jar:na]
at com.atlassian.utils.process.ExternalProcessImpl.finish(ExternalProcessImpl.java:161) ~[atlassian-processutils-1.6.0-m1.jar:na]
at com.atlassian.stash.scm.BaseCommand$CommandFuture.get(BaseCommand.java:223) ~[stash-spi-2.11.2.jar:na]
... 10 common frames omitted
I have no clue why this happens for some repos and not for other. I have checked our gitolite settings on the target server and the repos I am mirroring to have the same permission settings setup.
Can you help out here?
Thnx in advance!
// Svante
During mirroring huge repository sometimes process hangs. Why plugin can't clear out hangs process?
Your evaluation license is expired. Pushing has been disabled until the license
is brought back into compliance.
I get the error above. Why? I don't recall seeing anything mentioning a limit of use.
Hu
The configuration doesn't currently allow using file: URLs. I'd like to use this plugin for doing continuous deployment of configuration files on push to master but won't have HTTP or SSH running on the target machines.
Is there a technical limitation to using file:, or is the http/ssh constraint only in configuration?
In Bitbucket server 4.02, we've added a tag and pushed it using the REST API. If we create a clone from the Bitbucket repository, we see the tag in the respository. If we create a clone from the mirror, we don't see the tag in the repository.
If we create a tag using the git cli and do a push, the tag is in the repository and in the mirror.
Hello,
I'm using the hook on hundreds of repositories on my Bitbucket instance. They all mirror to the same destination. Unfortunately I have to change the mirror URL and I'm trying to find a way to edit all of the configurations at the same time. Is it possible ?
Hi,
If i use https it works fine.
When i use ssh it doesn't work and i get a process timed out in the logs.
This is the error that i'm getting in the log:
2017-01-05 11:01:28,994 DEBUG [threadpool:thread-703] pmfonseca @MQ10L8x652x915x3 13sq5fn 192.168.1.136 SSH - git-receive-pack '/test/svc-fon.git' com.atlassian.stash.scm.BaseCommand Executed C:\Git\bin\git.exe push --prune ssh://[email protected]:7999/visioncenter/test.git --force +refs/heads/:refs/heads/ +refs/tags/:refs/tags/
2017-01-05 11:01:29,001 ERROR [threadpool:thread-703] pmfonseca @MQ10L8x652x915x3 13sq5fn 192.168.1.136 SSH - git-receive-pack '/test/svc-fon.git' c.e.stash.hook.MirrorRepositoryHook Failed to mirror repository SVC-FON after 5 attempts.
com.atlassian.stash.exception.ServerException: An error occurred while executing an external process: process timed out
at com.atlassian.stash.scm.git.common.command.GitCommandExitHandler.evaluateThrowable(GitCommandExitHandler.java:113) ~[na:na]
at com.atlassian.stash.scm.git.common.command.GitCommandExitHandler.onError(GitCommandExitHandler.java:159) ~[na:na]
at com.atlassian.stash.scm.DefaultCommandExitHandler.onExit(DefaultCommandExitHandler.java:33) ~[stash-spi-3.7.1.jar:na]
at com.englishtown.stash.hook.PasswordHandler.onExit(PasswordHandler.java:46) ~[plugin.640321809486732222.stash-hook-mirror-1.9.0_1483467141180.jar:na]
at com.atlassian.stash.scm.BaseCommand.callExitHandler(BaseCommand.java:138) ~[stash-spi-3.7.1.jar:na]
at com.atlassian.stash.scm.BaseCommand$CommandFuture.internalGet(BaseCommand.java:251) ~[stash-spi-3.7.1.jar:na]
at com.atlassian.stash.scm.BaseCommand$CommandFuture.get(BaseCommand.java:220) ~[stash-spi-3.7.1.jar:na]
at com.atlassian.stash.scm.BaseCommand.call(BaseCommand.java:75) ~[stash-spi-3.7.1.jar:na]
at com.englishtown.stash.hook.MirrorRepositoryHook$1.call(MirrorRepositoryHook.java:127) [plugin.640321809486732222.stash-hook-mirror-1.9.0_1483467141180.jar:na]
at com.englishtown.stash.hook.MirrorRepositoryHook$1.call(MirrorRepositoryHook.java:115) [plugin.640321809486732222.stash-hook-mirror-1.9.0_1483467141180.jar:na]
at com.atlassian.stash.internal.concurrent.StateTransferringExecutorService$StateTransferringCallable.call(StateTransferringExecutorService.java:147) [stash-platform-3.7.1.jar:na]
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) [na:1.7.0_17]
at java.util.concurrent.FutureTask.run(Unknown Source) [na:1.7.0_17]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source) [na:1.7.0_17]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) [na:1.7.0_17]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.7.0_17]
at java.lang.Thread.run(Unknown Source) [na:1.7.0_17]
... 1 frame trimmed
Caused by: com.atlassian.utils.process.ProcessTimeoutException: process timed out
at com.atlassian.utils.process.ExternalProcessImpl.wrapUpProcess(ExternalProcessImpl.java:656) ~[atlassian-processutils-1.6.0-m2.jar:na]
at com.atlassian.utils.process.ExternalProcessImpl.finish(ExternalProcessImpl.java:161) ~[atlassian-processutils-1.6.0-m2.jar:na]
at com.atlassian.stash.scm.BaseCommand$CommandFuture.get(BaseCommand.java:218) ~[stash-spi-3.7.1.jar:na]
... 11 common frames omitted
Any thoughts?
Thanks in advance
To repro:
Result: each push spawns a full push of the repo to the remote. Net effect is massive number of git processes all competing with each other and starving the machine. (We saw CPU saturation and a load average of over 400!) We also concurrency related issues (can't lock refs, etc) due to concurrent git operations.
Expected: pushes to a remote should be serialized, so only one git operation happens at a time.
cc @simoleone
Ponder this scenario:
A
A
into a personal repo B
C
on githubB
-> C
Now, if I commit code in A
and have sync forks turned on, will the commit propagate all the way down to C
?
The repository is private with limited user access. Github repo is also private but the mirroring fails. Why? Could you please help?
I'm trying to mirror my changes to another server that I can only connect using public key authentication. The problem is that I can't find how to specify my key and the remote ssh server connection always fail. I tried setting the key in the stash user's .ssh folder without success. Any Idea ?
The error I get is :
Failed in pushing to mirror: An error occurred while executing an external process: '/usr/bin/git push server' exited with code 128 saying: Host key verification failed.
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Found alternative solution.
Hi there,
It has been demonstrated that commits to existing branches in the repo enabled with the mirror-hook are no longer syncing to remote repos. We are running stash 3.5.1 and it appeared this stopped working after we upgraded to 3.5.1.
It does work if commits are made to empty feature branches.
Any help to investigate this would be great since we rely on this plugin for production work.
-Scott
Sometimes the administrator of stash doesn't control the remote repository to which we're mirroring to.
In such cases, the remote repo might not allow "push -f", while the local repo may allow force push, as stash allows for per-branch permissions and it is easy to deny "push -f" on important branches like master and allow it for personal feature branches.
It would be great to toggle a behaviour in which when a regular push fails (because it is not a fast-forward), the plugin will attempt to first delete the remote branch and re-push into it.
https://github.com/englishtown/stash-hook-mirror/wiki/Mirror-To-Non-Bare-Remote-Repo
The steps for the non-bare repo are unclear on if those changes are for Stash's repo or the target repo.
After upgrade from v2.1.0 to v2.3.0 the sync with aws codecommit is broken - i got the following message in bitbutcket error logs:
com.atlassian.bitbucket.scm.CommandFailedException: '/usr/bin/git push --prune --atomic ssh://codecommit-eu-central-1/v1/repos/test --force +refs/heads/*:refs/heads/* +refs/tags/*:refs/tags/* +refs/notes/*:refs/notes/*' exited with code 128 saying: fatal: the receiving end does not support --atomic push
It seems that codecommit does not support atomic commits. Is ist possible to make "Atomic commit" as an option/checkbox?
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.