The Deployment Build Marker can be used to mark a build as a deployment to a specific environment.
Pipelines
In a pipeline job, mark a build using the jiraDeploymentInfo step. It takes three arguments: environmentId,
environmentName, and environmentType. Both environmentId and environmentName are strings where the id is limited to 40
characters and the name to 255 characters, whereas environmentType can have any of the following values, development, testing,
staging, production and unmapped. The last is also used in case a different value is provided.
Only environmentType is required. When environmentName is omitted, it defaults to the environment type, and when environmentId
is omitted, it is generated from the environment name. Both environmentId and environmentName support environment-variable
expansion, so values such as environmentType: env.TARGET_ENVIRONMENT resolve at build time.
pipeline {
agent any
stages {
stage('Deploy to Staging') {
steps {
echo 'Build and deploy to staging'
}
post {
always {
jiraDeploymentInfo environmentId: 'eu-staging-1', environmentName: 'Staging', environmentType: 'staging'
}
}
}
}
}
At a bare minimum only the environmentType is needed. Take the snippet below.
pipeline {
agent any
stages {
stage('Deploy to Production') {
steps {
echo 'Build and deploy to production'
}
post {
always {
jiraDeploymentInfo environmentType: 'production'
}
}
}
}
}
In this case the environmentName will be set to production, and the environmentId will be generated using the environmentName as
input.
jiraDeploymentInfo step can be used multiple times within a single build execution.The step was previously invoked through the generic step declaration using the DeploymentBuildMarker class. That form still works
and remains supported for backward compatibility:
step([$class: 'DeploymentBuildMarker', environmentId: 'eu-staging-1', environmentName: 'Staging', environmentType: 'staging'])
If using DeploymentBuildMarker as the value for the $class argument is giving issues, then try the fully qualified class value
org.marvelution.jji.marker.DeploymentBuildMarker. New pipelines should prefer the jiraDeploymentInfo step.
Traditional Jobs
In a traditional Jenkins job, like a free style job, builds can be marked using the Deployment Build Marker as post build action, simply
add the action and specify the environment id, name and type using the action form.
environmentId is specified in the configuration, then one is generated using the environmentName as input.Development Panel Integration
Builds that represent a deployment to an environment are also listed as a deployment within Jira through the Development Status panel and related Jenkins data dialog.
Previous: Search by Build
Next: Trigger a Build