Deployment Build Marker

The Deployment Build Marker can be used to mark a build as a deployment to a specific environment.

The Deployment Build Marker is a requirement in order for the Development Panel Integration to show the deployment information.


Pipelines

In a pipeline job, builds can be marked using the generic step  declaration. The step takes three arguments, namely environmentIdenvironmentName, and environmentTypeenvironmentId and environmentName are both strings where the id is limited to 40 characters and the name to 255 characters, where as the type can have any of the following values, developmenttestingstagingproduction  and unmapped. The last is also used in case a different value is provided.

pipeline {
  agent any
  stages {
    stage('Deploy to Staging') {
      steps {
        echo 'Build and deploy to staging'
      }
      post {
        always {
          step([$class: 'DeploymentBuildMarker', environmentId: 'eu-staging-1', environmentName: 'Staging', environmentType: 'staging'])
        }
      }
    }
  }
}

At a bare minimum the Deployment Build Marker only needs the environmentType when it's executing as part of a pipeline. Take the snippet below.

pipeline {
  agent any
  stages {
    stage('Deploy to Staging') {
      steps {
        echo 'Build and deploy to staging'
      }
      post {
        always {
          step([$class: 'DeploymentBuildMarker', environmentType: 'production'])
        }
      }
    }
  }
}

In this case the environmentName will be set to production, and the environmentId will be generated using the name as input.

The pipeline step for the Deployment Build Marker can be used multiple times within a single build execution.

If using DeploymentBuildMarker as value for the $class argument is giving issues, then try the fully qualified class value org.marvelution.jji.marker.DeploymentBuildMarker 

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.

If no environment Id is specified in the configuration, then one is generated using the environment name as input.

Using the Deployment Build Marker as post build action has the limitation that the action can only be configured once per job.