Add Reliably to your GitLab CI/CD pipeline

Adding Reliably to your GitHub repositories is as simple as adding GitLab CI/CD to your repository.

The source code used in this walkthrough is available in this demo repository.

Setup your Reliably access token as Variable

The CLI must be run with a valid access token to make authenticated calls to Reliably.

As a prerequisite, the RELIABLY_TOKEN must be defined as a masked variable in your project’s settings; See how to create a custom variable in the UI.

Define Reliably token as GitLab variable

You can see how to retrieve your access token.

Setup your Reliably organization as Variable

You shall define the organization to work on, when using the CLI, by defining the RELIABLY_ORG environment variable as a masked variable.

To retrieve your currently active organization, run: reliably org current.

You can use either the organization ID or name as RELIABLY_ORG value.

If not specified, the logged in user’s default organization will be used.

Add Reliably to a GitLab Pipeline

For this walkthrough, we’re going to add a CI/CD Pipeline to a new GitLab repository. If you have an existing GitLab repository with CI/CD setup you can jump ahead to where we Add Reliably to GitLab CI/CD

Reliably integrates with GitLab through GitLab CI/CD. CI/CD is configured by creating a file called .gitlab-ci.yml at the root of your GitLab repository.

You can read more about the GitLab Pipeline Architecture in the GitLab Reference documentation. The first section describes a basic pipeline, with a useful diagram to visualise the concept. A basic GitLab CI/CD Pipeline will run everything on one stage in parallel, then it will do the same for the subsequent stage.

In the repository that you want Reliably to work with, add new GitLab CI/CD configuration file .gitlab-ci.yml.

    - reliably graph agent
      entrypoint: ["/bin/sh", "-c"]

The reliably agent command is best run at regular times so the most appropriate approach is to create a schedule.

Make sure to populate the following variables in your repository settings:

  • RELIABLY_TOKEN: your token to communicate with Reliably services
  • RELIABLY_ORG: the org to read/write data to

Congratulations, you now integrated Reliably into a repository on GitLab. Reliably can start surfacing Reliability Suggestions as you evolve your code.