CI/CD: Setting up GitLab Runners on AWS using CoreOS & Terraform

GitLab Runner is used as part of GitLab CI/CD pipelines. On a side note, it also supports GitHub and BitBucket too! But I digress… 

In this post we’ll cover how to install, configure and register Runner.

So many choices!

Runner can be installed on various operating systems/tools (Linux, Windows, Mac, Kubernetes, Docker), to name a few. If you’re interested, a full list can be found in the documentation. For the purpose of this post, we’ll use the Dockerised version on a CoreOS instance which is running in AWS. (Boy, that was a mouthful!)

URL & Token

Before we can spin up our Runner, we’ll first need to retrieve our GitLab URL and registration token. We can obtain both of these by:

  1. Selecting a repository
  2. Clicking “Settings” –> “CI/CD”
  3. Navigating to the “Specific Runners” section

Continue reading

Allure2: A GUI for your code tests

In my previous post I touched on the basics of how you can use pytest to test your code. In this post I’ll be covering how you can use Allure2 to prettify your pytest results.

Allure2 Adapter for pytest

The first thing we need to is install the Allure adapter for Pytest. As the documentation states, this repository contains a plugin for py.test which automatically prepares input data used to generate Allure Report.

Issue the following command to install the adapter:

Continue reading

Testing your code with pytest

If you’re fairly new to coding chances are you’ve run into an issue where you make a minor change in one place, and then end up breaking your script in another place. In order to find out what went wrong you start adding print statements all over the place to debug your code.

While it sound like a good idea, what you’re actually doing is relying on Python to tell you when you’ve made a syntactical error. However, what if your syntax is find, but your code is incorrect?

For example, say you accidentally changed your addition function to a multiplication function by replacing the + with a *:

Continue reading