[英]Continuous Delivery with GitLab CI
I've been trying to wrap my head around how it would be possible to implement Continuous Delivery with GitLab CI? 我一直试图围绕如何使用GitLab CI实现持续交付?
Every solution I read for CD relies on multi-step pipelines (such as Jenkins), or a custom application that listens to webhooks and provides its own interface for deployment (For example, GitHub's HuBot + Heaven + Janky). 我为CD读取的每个解决方案都依赖于多步骤流水线(例如Jenkins),或者是一个自定义应用程序,它可以监听webhook并提供自己的部署界面(例如,GitHub的HuBot + Heaven + Janky)。
If we only care about performing CD on the Master branch, and our test suite/deployment steps are very fast, you can simply include it as part of the shell script that gets ran by GitLab CI.... However, what if your test suite isn't fast? 如果我们只关心在Master分支上执行CD,并且我们的测试套件/部署步骤非常快,您可以简单地将其作为由GitLab CI运行的shell脚本的一部分包含....但是,如果您的测试怎么办?套房不快? Or your deployment can take a few minutes to download packages, etc.?
或者您的部署可能需要几分钟才能下载软件包等? Then your CI Runner is busy working on stuff.
然后你的CI Runner正在忙着处理事情。
The best solution I can come up with is: 我能想出的最佳解决方案是:
Any thoughts? 有什么想法吗? Has anyone implemented CD with GitLab CI?
有没有人用GitLab CI实现CD?
I would develop a listener to the webhooks from gitlab CI and only process successful builds for the tracked branch that then needs to be checkout and delivered. 我将从gitlab CI开发一个webhooks的监听器,并且只处理跟踪分支的成功构建,然后需要签出和交付。 In particular, I don't see a need for processing webhooks from gitlab and the corrdination, the information from gitlab CI seems sufficient (it contains the build status, the reference branch and the commit id).
特别是,我认为不需要从gitlab和corrdination处理webhooks,来自gitlab CI的信息似乎足够(它包含构建状态,引用分支和提交ID)。
Depending on your repositoy layout, you could then just download the archive via 根据您的repositoy布局,您可以通过以下方式下载存档
gitlab.example.net/namespace/repository/archive.zip?ref=githash
gitlab.example.net/namespace/repository/archive.zip?ref=githash
or checkout the relevant commit and call your CD script. 或签出相关提交并调用您的CD脚本。
If you want to integrate the feedback of your CD script (whether the deployment worked) , you can call all that from the runner. 如果要整合CD脚本的反馈(部署是否有效),您可以从跑步者那里调用所有内容。 Keep in mind that you can have multiple runners, if your setup takes too long.
请记住,如果设置时间过长,您可以拥有多个跑步者。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.