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.
- Click
- If the pipeline is deactivated, click .
- (Optional) To make your shared pipeline available in Automation Service Broker, click .
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
.
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.
- Click Endpoints. On the endpoint that you want to duplicate, for example
jenkinsEndpoint
, click . - Click the Import button, and select the YAML file for
jenkinsEndpoint
. - Edit the file to change the project, such as
projectB
in the following sample YAML code.--- project: projectB kind: ENDPOINT name: jenkinsEndpoint ...
- Click Import.
To run jenkinsPipeline
on projectB
, click Run on the pipeline card, and select projectB
as the project.
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.
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.
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.
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.
- 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.
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.
- Check for references and update pipeline references if found.
- Click Pipelines. On the shared pipeline that you want to check, click .
- Note the names of any Referred Pipelines.
- 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.
- Delete or stop sharing a pipeline.
- On the pipeline that you want to delete, click .
- On the pipeline that you want to stop sharing, click .