Skip to main content

Jenkins

CatalogScorecards

Summary

Jenkins is an open source automation server which enables developers to build, test, and deploy software. You can use Jenkins to drive insights into values such as:

  • Deploys

Cortex Deployer app

This integration uses the Cortex Deployer app which makes it easier for teams to push information about deploys to Cortex. This app leverages Cortex's flexible deploy REST endpoint and is open sourced and available here.

Setup

Jenkins secrets

In order to use the Deployer app, you will need the x-cortex-tag and a Cortex API token. In the example below, both are defined as Jenkins secrets.

Jenkinsfile

To push information to Cortex about a deploy event, add a step to your Jenkins pipeline. Below is a snippet of what a Jenkinsfile may look like.

pipeline {
agent any
environment {
CORTEX_TAG = credentials('CORTEX_TAG')
CORTEX_API_TOKEN = credentials('CORTEX_API_TOKEN')
}
stages {
stage('update-cortex') {
steps {
sh "docker run cortexapp/deployer:0.2 -i \"Jenkins deploy\" -k $CORTEX_API_TOKEN -s $GIT_COMMIT -t DEPLOY -e Prod -c '{\"cluster\": \"Prod\", \"Jenkins Job\": $BUILD_NUMBER }' -g $CORTEX_TAG"
}
}
}
}

For more details about the options passed to the Docker image, please refer to the Deployer repository.