Skip to main content

GitHub Actions

Reading time: 0 minute(s) (0 words)

Nobl9 provides a GitHub Action via the GitHub Marketplace that you can leverage to ensure your SLOs are updated in Nobl9 whenever you change the SLO definitions in the source code.

What are GitHub Actions?​

GitHub Actions is a continuous integration (CI) and continuous delivery (CD) platform using YAML syntax. It lets you build, test, and deploy code from your source code repository on https://github.com. For example, if you want to test every pull request made to your repository automatically, you must configure the GitHub Actions workflow to trigger a series of commands. Workflows are defined as YAML files in your code repository in a .github/workflows directory. One workflow references one or more GitHub Actions together as a series of instructions, where each instruction executes a specific task.

For more detailed information on GitHub Actions, refer to the Learn GitHub Actions | GitHub Docs.

GitHub Actions in Nobl9​

Nobl9 allows you to create and manage SLOs using YAML configuration files. You can define your SLOs in code and apply the changes using sloctl, the Nobl9 command-line interface. The SLOs you create in the SLO wizard can also be retrieved and edited as YAML files. For more information, refer to the sloctl user guide.

The Nobl9 GitHub Action applies a configuration file, specified with the sloctl_yml input parameter, to a project using sloctl. With it, you can ensure your SLOs are up-to-date every time you make changes to your repository. The SLOs defined in the YAML file leverage repository versioning and can be checked in parallel with your code. With every build, you can be sure that the associated application’s SLOs are also updated in Nobl9.

Setting up GitHub Action in Nobl9​

Follow these steps to set up GitHub Actions:

  1. Go to the page for the Nobl9 sloctl action in the GitHub Marketplace.

  2. Click the Use latest version button and copy the snippet.

    Image 1: Nobl9 sloctl action configuration
  3. Paste the snippet in your workflow .yml file at the step that makes sense in your build flow, for example:

    name: Nobl9 GitHub Actions Demo
    on: [push]
    jobs:

nobl9: runs-on: ubuntu-latest steps:

  • name: Check out repository code uses: actions/checkout@v2
  • uses: nobl9/nobl9-action@v0.2.0 with: client_id: # secrets.CLIENT_ID client_secret: # secrets.CLIENT_SECRET access_token: # secrets.ACCESS_TOKEN project: "myproject" sloctl_yml: "slos.yaml"

4. Add the **Actions secrets** to your workflow *.yml* file:
<figure>
<img src="/img/githubactions2.png"></img>
<figcaption className="caption">Image 2: Actions secrets configuration</figcaption>
</figure>

The variables are:

- `ACCESS_TOKEN` - a JWT token retrieved from Okta, used by `sloctl` to authenticate with Nobl9. You can retrieve the Access Token in two ways:
- Use the Nobl9 API by following the steps described [here](/api/annotations#tag/Access-Token/paths/~1accessToken/post).

- If you have `sloctl` installed on your local machine, use the following command:
```shell
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 to which the sloctl configuration will be applied.

  • SLOCTL_YML - the path to the sloctl YAML configuration file, relative to the root directory of the repository.

Once you set up the Nobl9 GitHub Action, every build updates Nobl9 with your SLOs' YAML definitions.