我有一个 PHP 应用程序,每次推送时都会使用 Jenkins 和 GitHub 自动部署。
我在一个分支上工作,所以如果我将我想要部署的任何更改推送到 branch.test.com 并立即看到更改。
我正在尝试在 Jenkins 中使用“Execute Shell”,因此在构建之后,它会找出更新了哪个分支(“master”或“develop”)并将其复制到 www
文件夹以反射(reflect)变化。
我走在正确的轨道上吗?
最佳答案
是的,您走在正确的轨道上。 Jenkins 可用于持续交付 (CD),每个分支执行构建/部署/测试过程是一个很好的做法。
我建议您为每个分支使用单独的作业。连Jenkins Best Practices page是这样说的:
One of advantages of using CI tools is to detect problems early in the development lifecycle. Setting up a different job/project for each branch you create will help to maximize the benefit of detecting problems early as part of supporting parallel development efforts and reducing risk.
通常,项目会增长并变得有很多分支,在某些时候,您需要自动化为每个分支创建一堆作业的过程。以下是一些有帮助的文章:
关于git - Jenkins 每个分支部署,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30881985/