Categories
Technology

In the LAB with GitLab

I’m a huge fan of GitLab. I wanted to do a special post on what super powers GitLab offers. GitLab is a repository management technology that offers:

Photo cred: GitLab

GitLab is often confused with GitHub, which is a similar open source technology associated with repository management. GitLab covers the entire application development life-cycle. Outside of GitLab, if you are using DevOps technology, it is likely that you are using multiple tools and services that you’ve configured. Like piecing disparate puzzle pieces together in order to streamline your application development life-cycle.

You can create a repository similarly to creating one with GitHub.

Click ‘New project’ to create a new repository
Make sure you have already configured your ssh keys locally. If you’re not sure how to do that, click here!

You can also enable custom configuration with your repository pipeline with a .gitlab-ci.yml file (Do NOT forget the period in front – this has tripped me up for hours before). You can also configure custom environment variables for your pipeline. For example, let’s say you create your first project and you clone your new repository locally. For this example, you’ve got a .Net C# application that you’ve Dockerized and want to deploy your new image to Amazon Web Services ECR service (Elastic Container Registry). You can create an environment variable (looks like a normal key-value pair relationship, ie: key – ecr_repo_name and value – <registry-id>.dkr.ecr.us-east-1.amazonaws.com/your_ecr_repository_name) and reference that repository name with the environment variable you’ve created.

The highlighted parts are areas of the GitLab UI that will help with configuring your GitLab pipeline and setting your CICD environment variables

So let’s say in your .gitlab-ci.yml file you’ve got your first three stages set to accomplish these three steps:

  • Create a new version for your application
  • Build and Test your application
  • Deploy new image to AWS ECR repository name

Once you make your changes in your IDE (Integrated Development Environment, like Visual Studio), commit your changes locally and then push those changes to your remote repository. Then your pipeline will be set to run (make sure you have a GitLab runner configured as well!) And you can watch each of the stages in your pipeline run through GitLab’s UI.

If all of your stages succeed and your pipeline passes, then the newest version of your image should be showing as ‘latest’ next to your AWS ECR repository that you referenced within your ‘Deploy new image to AWS ECR repo name’ stage.

I am a really big fan of GitLab and think their technology is simplifying a really difficult problem a lot of developers have when it comes to managing the entirety of the development life-cycle end-to-end.

Resources mentioned in this article:

Dale Yarborough

By Dale Yarborough

I am a Software Engineer at General Motors and Appalachian State University Alum. Previously: Whole Foods Market IT, Charles Schwab