OpsLevel

OpsLevel plugin for Jenkins

Provides Jenkins integration with OpsLevel. This allows you to notify OpsLevel when a deploy succeeds.

Getting started

Add a Jenkins Integration in OpsLevel

  1. Get an OpsLevel account https://www.opslevel.com
  2. In the OpsLevel app, Click Integrations in the left sidebar
  3. Click on the + New Integration button
  4. 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
  3. Change the tab to Available
  4. Search for 'opslevel'
  5. Check the box next to install & install the plugin

Jenkins Configuration

Global Configuration

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

OpsLevel will now be notified after every successful build!

If you need more fine grained control, you can override the notification parameters from within your builds/pipelines. Importantly, if you don't want to notify every single build, you could uncheck the Notify for all builds checkbox in the Global Configuration and just add build steps to the builds you care about. Similarly, if there only a few builds that you want to mute, you could enable notifications globally and override specific builds to not run. Here's a look at what the configuration looks like for both pipelines and freestyle jobs:

Pipeline Configuration

  1. Navigate to your job and click Configure in the left sidebar
  2. Add an opsLevelNotifyParams post step with the desired parameter overrides: Jenkins Pipeline Configuration
  3. Here's an example of the parameters you can override:
  opsLevelNotifyParams(
    webhookUrl: "https://app.opslevel.com/integrations/deploy/3e06d761-0347-4741-a617-XXXXXXXXXXX",
    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
  2. Add our post-build action Publish successful build to OpsLevel
  3. You can override notification parameters here: Jenkins Configuration

Developer Instructions

Refer to jenkins plugin guidelines: contribution guidelines

Install Maven and JDK.

$ mvn -version | grep -v home
Apache Maven 3.8.1 (05c21c65bdfed0f71a2f2ada8b84da59348c4c5d)
Java version: 15.0.2, vendor: N/A, runtime: /usr/local/Cellar/openjdk/15.0.2/libexec/openjdk.jdk/Contents/Home
Default locale: en_CA, platform encoding: UTF-8
OS name: "mac os x", version: "10.15.7", arch: "x86_64", family: "mac"

Run unit tests

mvn test

Create plugin package

Create an HPI file to install in Jenkins

mvn clean package

Running Locally

Clone this repo, install Java & Maven, run this, and open http://localhost:8080/jenkins/ in your browser.

    env -i PATH=$PATH mvn hpi:run

That optional env -i PATH=$PATH removes all env vars except PATH.

LICENSE

Licensed under MIT, see LICENSE