Create a deployment task to trigger third-party tools

3 minute readReferenceAutomation

The CloudBees CD/RO third-party deployment feature allows you to perform deployments using your own deployment tools and still enjoy the benefits of CloudBees CD/RO application modeling. CloudBees CD/RO simplified the process for using third-party tools for deployment by introducing Deploy and Undeploy options in pipeline tasks. If application and/or component versions are included in the task definition, environment inventory, path to production, and deployment analytics data will be updated with these values when the task runs.

With this approach, CloudBees CD/RO delegates deployment to the third-party tool and CloudBees CD/RO uses the version values directly without knowledge of what the third party tool actually does. In principle, the version values can be passed to the third party tool to direct its actions. This requires additional configuration. It is also possible to update environment inventory, path to production, and analytics based on the response from the third party deployment tool.

To demonstrate CloudBees CD/RO third-party deployments via a plugin, a demo plugin is available in the CloudBees community plugins that implements the Deploy and Undeploy options. For more information on this demo plugin, refer to the BringYourOwnDeployerPlugin.
Third-party Deployments in CloudBees CD/RO

See how to use the third-party deployment capability in CloudBees CD/RO to track external deployments.

Watch tutorial

Create a deployment task that triggers a third-party tool to perform a deployment

The following steps create a deployment task definition. As part of the definition, you must specify the name and project name for an external application and environment. The external application and environment are used to associate inventory and analytics data. When the task is run, if the application or environment do not exist, the application and environment models are created, and the versions supplied are used to update the inventory. The new external application and environment are used to associate inventory and analytics data. When the task is run, the application and environment models will be created and the versions supplied will be used to update the inventory.

  1. Navigate to the release or pipeline that you want to add a deployment task using a third-party tool.

  2. Select Add Task from the stage’s three-dots menu.

  3. Enter a task identifier in the New Task field, then click Select Task Type. The Task Type dialog displays.

  4. Select one of the following task types:

    • CI Job

    • Procedure

    • Command

    • Plugin

  5. Select or enter the required details for the selected task type.

  6. Select Deploy task.

  7. Select the project for the external application.

  8. Select or add the external application name.

    Third-party applications shown or created here are assigned the External application type.
  9. Select or add an environment name.

  10. Enter the application and/or artifact versions.

    To use property references in the artifact version field, it is necessary to provide a single expression such as $[artifacts] for the entire entry. This property reference should resolve to a valid comma-separated list, such as art1:1.2,art2:2.5. A composite string can be constructed from multiple properties, but it requires the use of the /javascript form of property evaluation. For example, given the two pipeline input parameters, v1 and v2, $[/javascript "art1:$[v1],art2:$[v2]"] produces a valid artifact versions string if v1 and v2 are valid version strings.
  11. Select OK.

Create a deployment task that triggers a third-party tool to perform an undeployment

  1. Create a pipeline task of the following type.

    Only the pipeline task types below support undeploy as a sub-task type:
    • Plugin procedure

    • Project procedure

    • CI job

    • Command

  2. Flag the task to indicate that it is an undeploy task.

  3. Enter the application, environment, and version details.

Use the third party deployment response for inventory and analytics updates

Upon successful completion of the Deploy sub-task type, if the ec_deployment_artifacts property exists for the job, the CloudBees CD/RO server reads the properties to update the inventory and sends the deployment data to the CloudBees Analytics server.

The property value should be in the following JSON format:

{
	"deploymentSystem": "name of the 3rd-party tool",
	"deploymentUrl": "URL for this deployment job in the 3rd-party tool",
	"applicationVersion": "your-applicationVersion-optional",
	"artifacts": [
	  {
		"artifactName": "your-artifactName-1-required",
		"artifactVersion": "your-artifactVersion-1-required",
		"artifactUrl": "your-artifactUrl-1-optional",
		"additionalDetails": {
		  "deploymentTargets": "deploymentTarget-1-optional, deploymentTarget-2-optional",
		  "detail1": "value1",
		  "detail2": "value2"
		}
	  },
	  {
		"artifactName": "your-artifactName-2-required",
		"artifactVersion": "your-artifactVersion-2-required",
		"artifactUrl": "your-artifactUrl-2-optional",
		"additionalDetails": {
		  "deploymentTargets": "deploymentTarget-3-optional, deploymentTarget-4-optional",
		  "detail1": "value1",
		  "detail2": "value2"
		}
	  }
	]
}

The example at Third party deploy parse response illustrates how to accomplish this.