[英]How to use Hubot to deploy a Github repo to Heroku?
Back when they announced Hubot one of the things GitHub said they do with theirs is deployment. 当他们宣布 Hubot时,GitHub说他们对他们做的事情之一是部署。 I'm attempting to do the same for my project the code for which is hosted on GitHub while the app itself is on Heroku.
我正在尝试为我的项目执行相同的操作,其代码在GitHub上托管,而应用程序本身在Heroku上。 My Hubot also lives on Heroku but I'm doing all my testing locally first.
我的Hubot也住在Heroku上,但我首先在本地进行测试。
My idea was to either clone the target repo in tmp, add a remote in that repo to point to the Heroku app, then run git push heroku
or (like this SO question ) create two remotes and push
that way. 我的想法是在tmp中克隆目标repo,在该repo中添加一个遥控器指向Heroku应用程序,然后运行
git push heroku
或(像这样的SO问题 )创建两个遥控器并按此方式push
。 While I've gotten the git clone
to work locally when I try to run 当我尝试运行时,我已经让
git clone
在本地工作了
Exec "cd #{dir}; git remote add #{proj_loc} git@heroku.com:#{heroku_app}.git"
it ends up adding the remote to the git repo that exists in the directory from which I started bin/hubot
not the git repo that now exists in tmp. 它最终将远程添加到git
bin/hubot
该bin/hubot
存在于我启动bin/hubot
的目录中,而不是现在存在于tmp中的git bin/hubot
。 I know dir is set correctly and that cd
works because I've run 我知道dir设置正确并且
cd
工作因为我已经运行了
Exec "cd #{dir}; pwd"
and the results are what I'd expect. 结果是我所期待的。 So the behavior of
git remote
confuses me. 所以
git remote
的行为让我很困惑。
Has anyone done anything like this or can at least tell me why git remote
doesn't add the remote to the temp in tmp and how to fix it? 有没有人做过这样的事情,或者至少可以告诉我为什么
git remote
不会将遥控器添加到tmp中的temp以及如何修复它?
I've also yet to try to tackle the issue of the keys required to 1) access a private repo on GitHub; 我还要尝试解决1)访问GitHub上的私人仓库所需的密钥问题; and 2) deploy to Heroku.
2)部署到Heroku。 I'll figure that out if I can get this working.
我会弄明白,如果我能让这个工作。
I did this with my system. 我用我的系统做了这个。 I had my hubot contact my build box via SSH and run the git pull / deploy command.
我让我的hubot通过SSH联系我的构建盒并运行git pull / deploy命令。 The deploy command would shoot a POST payload back to the hubot instance and all the statuses are posted to the hubot's chat client.
deploy命令会将POST有效负载发送回hubot实例,并将所有状态发布到hubot的聊天客户端。 I wrote an entire blog post about it: http://tritarget.org/blog/2014/10/13/new-site-ship-it/
我写了一篇关于它的完整博客文章: http : //tritarget.org/blog/2014/10/13/new-site-ship-it/
I considered the same when I heard how Github were using Hubot. 当我听到Github如何使用Hubot时,我也是这么认为的。 At a guess though, they are hosting it on a machine that they manage, like a physical or a VPS which is much more like a local machine when it comes to deploying code.
但有人猜测,他们将它托管在他们管理的机器上,比如物理或VPS,在部署代码时更像是本地机器。 Whilst you may get bits working on Heroku I think you're going to struggle with keys and actually deployment - but I'm open to being proven wrong :)
虽然你可能会在Heroku上工作,但我认为你会在使用密钥和实际部署时遇到困难 - 但我很容易被证明是错误的:)
I created a Java / Play Framework app that might do what you want: 我创建了一个可能做你想要的Java / Play Framework应用程序:
https://github.com/heroku/shareheroku-java https://github.com/heroku/shareheroku-java
The app does the following: 该应用程序执行以下操作:
You can see it in action at: 您可以在以下位置看到它:
http://java.herokuapp.com http://java.herokuapp.com
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.