I've been trying to wrap my head around how it would be possible to implement Continuous Delivery with 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).
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? Or your deployment can take a few minutes to download packages, etc.? Then your CI Runner is busy working on stuff.
The best solution I can come up with is:
Any thoughts? Has anyone implemented CD with GitLab CI?
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. 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).
Depending on your repositoy layout, you could then just download the archive via
gitlab.example.net/namespace/repository/archive.zip?ref=githash
or checkout the relevant commit and call your CD script.
If you want to integrate the feedback of your CD script (whether the deployment worked) , you can call all that from the runner. Keep in mind that you can have multiple runners, if your setup takes too long.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With