Skip to main content

GitHub Actions

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 | Nobl9 Documentation.

The Nobl9 GitHub Action applies a configuration file, specified with the sloctl_yml input parameter, to a project using sloctl. This enables you to 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.
  1. Click the Use latest version button and copy the snippet.

    Image 1: Nobl9 sloctl action configuration
  2. 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"
  3. Add the Actions secrets to your workflow .yml file:

    Image 2: Actions secrets configuration

    The variables are:

    • ACCESS_TOKEN - used to authenticate to the sloctl. The Access Token consists of your Client ID and Client Secret (base64enc(${clientId}:${clientSecret})), which you can generate in the Nobl9 UI. If you already have sloctl installed on your local machine, you can retrieve your Access Token using the following command: cat ~/.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 | Nobl9 Documentation.

    • CLIENT_SECRET - the Client Secret of your Nobl9 account. For information on creating a Client Secret, refer to the sloctl User Guide | Nobl9 Documentation.

    • 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.