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
- In the OpsLevel app, Click Integrations in the left sidebar.
- Click on the + New Integration button.
- Add the Jenkins Integration.
Install the Jenkins plugin
- From your Jenkins home page, navigate to Manage Jenkins.
- Navigate to Manage Plugins.
- Change the tab to Available.
- Search for ‘opslevel’.
- Check the box next to install & install the plugin.
Jenkins Configuration
Global Configuration
- From your Jenkins home page, navigate to Manage Jenkins.
- Navigate to Configure System.
- Find the Global OpsLevel Integration section.
- In the OpsLevel App, copy the webhook URL from the Jenkins Integration we made:
- paste it into the Deploy Webhook URL box:
- 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
- Navigate to your job and click Configure in the left sidebar.
- Add an opsLevelNotifyParams post step with the desired parameter overrides:
- 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
- Navigate to your job and click Configure in the left sidebar.
- Add our post-build action Publish successful build to OpsLevel.
- You can override notification parameters here:
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.
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:
For pipelines:
{
...
post {
always {
opsLevelNotifyParams run: false
}
}
}
Updated over 1 year ago