GitLab
Nobl9 and GitLab have partnered to build a CI script to activate SLOs-as-Code for GitLab users. When using GitLab as the source repository, you can check the SLO YAML definitions along with your product code. Then, the CI script ensures any changes to the YAML file are automatically pushed to Nobl9 through sloctl
.
What is GitLab?β
GitLab is a DevOps platform that allows users to develop, secure, and operate software in a single application. It's a web-based Git repository that provides open and private repositories for free, as well as wikis and issue-tracking capabilities.
Nobl9 and GitLabβ
With the CI configuration, GitLab calls sloctl
every time you build your repo and pushes the SLO definitions to Nobl9. This means you can use GitLab to version your SLO definitions and be sure that the definitions in Nobl9 are kept consistent and up to date. The CI script removes any doubt about what the most recent version is, allowing you to take the appropriate action when your error budget is burning too fast or is about to be exhausted.
Setting up Nobl9 CI script in GitLabβ
Follow these steps to set up the Nobl9 CI script in GitLab:
-
Log in to your GitLab account.
-
Go to Settings > CI/CD > Variables, and click the Expand button.
-
Add the following variables:
-
ACCESS_TOKEN
- a JWT token retrieved from Okta, used bysloctl
to authenticate with Nobl9. You can retrieve the Access Token in two ways:-
Use the Nobl9 API by following the steps described here.
-
If you have
sloctl
installed on your local machine, use the following command:grep accessToken ~/.config/nobl9/config.toml
-
-
CLIENT_ID
- the Client ID of your Nobl9 account. For information on creating a Client ID, refer to the sloctl user guide. -
CLIENT_SECRET
- the Client Secret of your Nobl9 account. For information on creating a Client Secret, refer to the sloctl user guide. -
PROJECT
- the name of the project in Nobl9 that your SLO belongs to. -
SLOCTL_YML
- the path to the sloctl YAML file you want to push to Nobl9 each time a change is made.
-
-
Create the CI/CD job to apply the YAML. In GitLabβs UI, go to CI/CD -> Jobs, and click the Create CI/CD configuration file button.
-
Enter the following code in the
.gitlab.ci.yml
file:variables:
CLIENT_ID: $NOBL9_CLIENT_ID
CLIENT_SECRET: $NOBL9_CLIENT_SECRET
ACCESS_TOKEN: $NOBL9_ACCESS_TOKEN
PROJECT: $NOBL9_PROJECT
SLOCTL_YML: $SLOCTL_YML
include:
- project: 'nobl9/nobl9-ci-template'
ref: main
file: '/nobl9.gitlab-ci.yml'
Once you set up the Nobl9 CI script, any changes to the SLOCTL_YML
file you reference are automatically pushed to Nobl9 once the updates are committed.