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 multiple property references: Enter as a single, comma separated, expression. Example: [art1.1.2,art2.5.5,art2.6.1]

    To use a composite string constructed from multiple properties: Use /javascript format. Example: Two pipeline input parameters, v1 and v2. $[/javascript "art1:$[v1],art2:$[v2]"].

  11. Configure a task hook command or procedure to execute as the last step of the task. Example: log processing or extracting third-party tool data.

    • Configure a task hook command.

      1. Select the Command as the Post execution option.

      2. Enter ec-groovy in the Shell field.

      3. Enter shell command in groovy format. Refer to Task Hook examples for a sample command.

    • Configure a task hook procedure.

      1. Select the Procedure as the Post execution option.

      2. Select the project name from the menu or enter a new one.

      3. Select the name of an existing hook procedure or enter the name of a new procedure.

      4. Define hook procedure parameters. Refer to Task Hook examples for the sample hook procedure.

  12. Select Save changes.

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:

IPV6 addresses are supported on the Kubernetes platform only. Enclose an IPV6 address in square brackets. Example: [<IPv6-ADDRESS>]
{ "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.