Track events from Jenkins pipelines using the OpsTrails shared library.
opstrails and repository URL https://github.com/OpsTrails/jenkins-shared-library.gitopstrails-api-key@Library('opstrails') _
pipeline {
agent any
environment {
OPSTRAILS_API_KEY = credentials('opstrails-api-key')
}
stages {
stage('Deploy') {
steps {
sh './deploy.sh'
}
post {
success {
opstrailsTrackEvent(
type: 'deployment',
source: "//jenkins/${env.JOB_NAME}",
subject: 'production',
version: env.BUILD_TAG
)
}
}
}
}
}| Parameter | Required | Description |
|---|---|---|
type | required | Event type |
source | optional | Event source URI (defaults to job name) |
subject | optional | Target environment |
version | optional | Release version or build tag |