Many of us use gitlab in our current project but do not truly understand the basics. For this meetup we decided to investigate how building a pipeline works by building and deploying a simple spring boot application.
The application was based on a tutorial I found, which basically covers building a simple spring boot app and deploying it to GCP. As I did not have access to a GCP account I decided it would be interesting to try and build and deploy my app using a locally installed gitlab. As I was setting this up locally I started thinking about docker and its kubernetes capabilities. Setting up gitlab locally did not go as smooth as I wanted and I decided to rather make use of gitlab.com to setup my deployment pipeline. As I could not deploy my application to GCP I decided to activate kubernetes on my local docker. My aim was to build the entire pipeline in gitlab.com and perform all the stages there, except for the deployment. The deployment will have to be done by my local docker/k8s environment.
I have read about the runners before but needed to investigate this some more. I required a locally installed runner to be able to perform my local deploy. Luckily the gitlab.com documentation is pretty clear on how to do this on the mac. I did however have to go read up a bit more detail about runners and how they would function locally, especially the part about executors. It was also important to understand how tags work and how you make use of it to ensure your stage is executed by the correct runner.
I had to make use of many resources across the internet to get this exercise working. Some of the keys parts where how to give your local kubernetes access to your gitlab repository, so that it could pull the image for deployment. We also needed to ensure that our local kubernetes was setup so that we could access our application via localhost once it was deployed by the locally installed gitlab runner.
After this, it all came together quite nicely. We created a spring boot app, pushed it to our gitab repo.
You could also use the WebIDE and pipeline editor to do all the editing via gitlab.
We created a basic pipeline and saw it first perform a maven build and then package our application as docker image. The docker image was published to our gilab repository after the package stage finished. For the final deploy step we saw the locally installed gitlab runner execute our kubernetes resource create scripts and kubernetes starting our local spring boot app as a pod. We could then test it via localhost.
We only touched on very little of what gitab can do for you but found it a very informative session, as we tried some things which was not 100% covered by any tutorials. I really like what I have seen and look forward to using this in more detail.