As a Automation Pipelines administrator, you can share pipelines so that users within an organization can run them on any other project or add them as nested tasks within a pipeline on another project.

Why is a shared pipeline useful

When you share a pipeline, you eliminate the need to create the same pipeline for different projects within an organization. And if you update a shared pipeline, all pipeline users will have the same update.

A shared pipeline can also be used in Automation Service Broker. A Automation Service Broker administrator can add your shared pipeline as catalog item for users to request and run on multiple projects.

Only Automation Pipelines administrators can share or stop sharing pipelines.

How do I share a pipeline

To share a pipeline, click Pipeline and select the pipeline that you want to share.

  1. Click Actions > Share across projects
  2. If the pipeline is deactivated, click Actions > Enable.
  3. (Optional) To make your shared pipeline available in Automation Service Broker, click Actions > Release.

    After you release the pipeline, an Automation Service Broker administrator can add it to Automation Service Broker. See Add pipelines to the Automation Service Broker catalog.

How do I run a shared pipeline

To run a shared pipeline, you select the pipeline and select a project.

The pipeline is run in the context of the project you select and only the pipeline model is shared. Any infrastructure such as endpoints or variables used in the pipeline is not shared. If a shared pipeline that uses endpoints or variables is run on a different project, then those endpoints and variables must be available on that project.

For example, let's say that jenkinsPipeline uses projectA and includes a task with an endpoint named jenkinsEndpoint.

Before you run a shared pipeline, check to see if the pipeline includes content needed to run the pipeline in a different project.

If you share jenkinsPipeline and want to run it in the context of projectB, then there must be a jenkinsEndpoint on projectB. If there is no jenkinsEndpoint, create the endpoint on projectB before running the shared pipeline.

The following procedure shows how to duplicate an endpoint on another project. You follow similar steps for a variable.

  1. Click Endpoints. On the endpoint that you want to duplicate, for example jenkinsEndpoint, click Actions > Export.
  2. Click the Import button, and select the YAML file for jenkinsEndpoint.
  3. Edit the file to change the project, such as projectB in the following sample YAML code.
    ---
    project: projectB
    kind: ENDPOINT
    name: jenkinsEndpoint
    ...
  4. Click Import.

To run jenkinsPipeline on projectB, click Run on the pipeline card, and select projectB as the project.

Note: To run the shared pipeline on projectB, you must have the Automation Pipelines role of administrator, developer, or executor. If you are a Automation Pipelines viewer or user, you can not run the pipeline unless a Automation Pipelines administrator makes you a project administrator or project member in projectB. For more information about roles in Automation Pipelines, see How do I manage user access and approvals in Automation Pipelines.

How do I add a shared pipeline to another pipeline

Using shared pipelines as nested tasks within another pipeline enables you to extend pipeline functionality beyond the pipelines that are included in one project. The shared pipelines can be on different projects from each other and from the pipeline where they are included as nested tasks.

The following example shows a pipeline named master-shared-pipeline-demo with two nested pipeline tasks.

When creating a pipeline with nested shared pipelines, select the shared pipeline and if there are two pipelines with the same name, use the project name to select the one you want.

To specify the pipeline for Task0, select from a list of shared pipelines. Every pipeline name includes the project name. If several shared pipelines have the same name, you can use the project name to select the one you want.

Note: To run a pipeline that includes nested pipelines, the pipeline must be able to access any endpoints or variables that are used in the nested pipelines. If it cannot, you must create the content on the project for the pipeline.

How do I use a shared pipeline for rollback

To use a shared pipeline for rollback, you select it from a list of pipelines when you configure rollback for the task. Automation Pipelines filters the list to display only pipelines on the same project or shared pipelines on different projects.

When adding a shared pipeline for rollback, select the shared pipeline and if there are two pipelines with the same name, use the project name to select the one you want.

How do I use a shared template in a pipeline

You can use a template shared in Automation Assembler as a template source for a task in a pipeline. Using shared templates provides access to more templates than those included in one project.

Before defining the task in Automation Pipelines, verify that the template is shared in Automation Assembler and that you know the name and version. When a template is shared, an icon next to the project name appears on the list of cloud templates.

Before you add a shared template as source in your pipeline, verify that the template is shared in Automation Assembler.

To use an Automation Assembler template in your shared pipeline:
  • For Task type, select Automation Template.
  • For Action, select Create Deployment or Update Deployment.
  • If you are updating a deployment, select the Deployment name.
  • For Cloud template source, select Automation Template.
  • For Cloud template name, you either select from the list of templates or type a name. If you do not see the template listed, that is because the template is in a different project from the pipeline and Automation Pipelines only lists the templates that are in the same project.
  • For Cloud template version, type the version of the template.

In the following example, shared-bp is the shared template that you verified in Automation Assembler and want to use but it is not listed as a selection, so you type the name.

When defining a task with a shared template, verify that the template is shared in Automation Assembler, then enter the name and the version in Automation Pipelines.
Note: If the template that you specify is not shared and you try to use it in a pipeline on a different project, the pipeline will fail to run with a message indicating that the selected template is not shared.

How do I delete or stop sharing a pipeline

If you add a shared pipeline as a nested task or to rollback a task, that pipeline is referenced by the pipeline in which it is used. If you want to delete or stop sharing the pipeline, you must remove it from any pipeline that references it.

For example, if master-shared-pipeline-demo includes Shared-Pipeline as a nested task, then Shared-Pipeline is referenced. You cannot delete or stop sharing Shared-Pipeline until you remove it from master-shared-pipeline-demo.

Or if TestRollback uses Shared-Pipeline to rollback a task, then Shared-Pipeline is referenced. You cannot delete or stop sharing Shared-Pipeline until you remove it from rollback on the task in TestRollback.

The following procedure shows how to check a pipeline's references and remove it from the pipeline that references it before you delete or stop sharing it.

  1. Check for references and update pipeline references if found.
    1. Click Pipelines. On the shared pipeline that you want to check, click Actions > View references.
    2. Note the names of any Referred Pipelines.Before removing a shared pipeline, check to see if it is used as a nested pipeline or for rollback by other pipelines.
    3. Open the pipelines that reference the shared pipeline. Remove the shared pipeline that is being used as a nested task or to rollback a task, and save the pipeline.
  2. Delete or stop sharing a pipeline.
    • On the pipeline that you want to delete, click Actions > Delete.
    • On the pipeline that you want to stop sharing, click Actions > Stop Sharing.