Jenkins Integration

Integrate with GitLab self-managed to perform checks against your repositories and define services through config-as-code with opslevel.yml.

OpsLevel’s deploy integration lets you capture information about services’ deploys from your CI/CD systems.

This Jenkins integration makes it even easier to get started and keep track of the deploy info coming from your Jenkins pipelines. You can track all builds in Jenkins or select specific builds to include or exclude. As well, you can fully customize what deploy data is sent, directly from the plugin.

Here’s a detailed rundown of what you need to do to integrate Jenkins with OpsLevel.

Add a Jenkins Integration

  1. In the OpsLevel app, Click Integrations in the left sidebar.
  2. Click on the + New Integration button.
  3. Add the Jenkins Integration.
Jenkins Integration

Install the Jenkins plugin

  1. From your Jenkins home page, navigate to Manage Jenkins.
  2. Navigate to Manage Plugins.
Jenkins Manage Plugins
  1. Change the tab to Available.
  2. Search for ‘opslevel’.
  3. Check the box next to install & install the plugin.
Install OpsLevel Plugin

Jenkins Configuration

Global Configuration

  1. From your Jenkins home page, navigate to Manage Jenkins.
  2. Navigate to Configure System.
Configure System
  1. Find the Global OpsLevel Integration section.
  2. In the OpsLevel App, copy the webhook URL from the Jenkins Integration we made:
Jenkins Integration Webhook URL
  1. paste it into the Deploy Webhook URL box:
Jenkins Global Configuration
  1. Click Save.

OpsLevel will now be notified after every successful build!

Customizing Notifications for a Build

OpsLevel will try to set the notification parameters from available environment variables, notably Jenkins BUILD_* variables and GIT_* variables. However, if you want to override any of the parameters in a specific job you can do so with either a pipeline step, or a freestyle project post-build action:

Pipeline Configuration

  1. Navigate to your job and click Configure in the left sidebar.
Jenkins Integration
  1. Add an opsLevelNotifyParams post step with the desired parameter overrides:
Jenkins Pipeline Configuration
  1. Here’s an example of the parameters you can override:
  opsLevelNotifyParams(
    webhookUrl: "https://app.opslevel.com/integrations/deploy/3e06d761-0347-4741-a617-XXXXXXXXXXXX",
    serviceAlias: "catalog_service",
    environment: "Staging",
    description: "Test Description",
    deployUrl: "",
    deployerId: "",
    deployerEmail: "",
    deployerName: "Jenkins Test Deploy",
    run: true
  )

Freestyle Job Configuration

  1. Navigate to your job and click Configure in the left sidebar.
Jenkins Integration
  1. Add our post-build action Publish successful build to OpsLevel.
  2. You can override notification parameters here:
Jenkins Configuration

Selecting which Jenkins builds send data to OpsLevel

If you need more fine grained control over which builds send deploy info, you can override them from within individual builds/pipelines.

Including Specific Builds

You can also customize the Jenkins integration so that it does not notify for all builds, but only some builds. To do so, first uncheck the Notify for all builds checkbox in the Global Configuration and then add build steps to the builds you care about.

Exclude Build

Excluding Specific Builds

Related, if there a few builds that you want to exclude from sending deploys, you could enable notifications globally and override specific builds to not run.

For Freestyle builds:

Exclude Build

For pipelines:

{
  ...
  post {
    always {
      opsLevelNotifyParams run: false
    }
  }
}