Oh the joy of deploying an automated build system. I mean, how I hard can it really be? Well harder than it looks. Now don’t get me wrong, most CI(continuous integration) system are well done and make it easy. But when you need to test on multiple system at the same time, with very subtle difference, you end up with no system almost that can really fit your needs.
Now what I wanted was setup a full CI with GitLab. The first thing I obviously tried was GitLab-CI. That would have been too easy. Even if I don’t talk about the non-understandable error 500 I kept getting, I was stuck on a old version of GitLab, making it impossible to really make it work with GitLab-CI. Next? Well an obvious choice was Jenkins. It’s popular and has a lot of plugins and support. Let’s try this!
Oh god, why did I do that. Now don’t get me wrong, I got Jenkins running fairly fast, and using a few plugins such as the CMake and GitLab plugins, I was able to get it running. But only for one platform. The issue is, I needed a distributed system that build on Linux, Mac, and Windows. Where is the problem? CMake. CMake requires you specify the generator for the project. But Jenkins allows me to only configure one CMake generator. So it’s either Visual Studio generator for Windows, or Unix Makefiles for Linux and Mac. Making it in the end fail, but just because the CMake plugin is too dumb. Now I could program another plugin and allow multiple generator, but that would be way too much work. What to do?
I thought I could easily set up multiple installation of Jenkins instead, and just tell GitLab to tell all of them when a commit is pushed to the project. I was more or less right. I can do that in GitLab. But Jenkins ignores the request for somereason. It really wants to be configured as a CI system in GitLab, else it won’t work. But there is a workaround. Dirty, but it works just fine and is not really a problem. How did I do it? Well normally in GitLab you would set-up a web hook like this: http://myJenkinsServer:8080/job/MyProject/. And with the CI configuration done in Jenkins and GitLab, this would trigger the thing correctly. But since I couldn’t do that, I found that you can basically write anything has a web hook. Here’s what it looks like instead: http://myJenkinsServer:8080/job/MyProject/build?delay=0sec. See what I did that? I scheduled a build to be executed in exactly 0 seconds. Making it right now. So whenever a commit gets pushed to GitLab, the web hook is called. Jenkins is going to ignore the data that is sent at the same time, but is going to trigger a build, running the test and doing everything I need. All I have to do is have this web hook set up for my different projects, and for the diffrent platforms. No biggy there.
tl;dr: Had to setup CI with GitLab. Did it with Jenkins. Used a workaround to scheduled a build every commit instead of automatic trigger on commit getting pushed. Works and we’re happy.