Shared pipelines
Asked by Andrew McMorris:

Are there any working examples of Shared pipelines as the one here does not work.

<https://support.atlassian.com/bitbucket-cloud/docs/share-pipelines-configurations/>

I am getting this error:

There is an error in the imported bitbucket-pipelines.yml file. The error is at \[line 3, column 12\]. Mapping values are not allowed here

On shared:

export:true

definitions:  
pipelines:  
hello-world:  
- step:  
name: "hello world"  
script:  
- echo hello


Answers:
author: Theodora Boudale
body: Hi Andrew,

I believe the error occurs because there is no space between **export:** and **true**.

Could you please adjust it like below and let us know if the pipeline runs then?

```
export: true
```

I will reach out to the documentation team to fix the example.

Kind regards,  
Theodora

comments: author: Aron Gombas _Midori_
body: [@Theodora Boudale](/t5/user/viewprofilepage/user-id/818086) I also notice that, but please have a look at the [official example](https://support.atlassian.com/bitbucket-cloud/docs/share-pipelines-configurations/)! There is no extra space in that example, either. If this is the solution, then the doc should be updated, too.


author: Theodora Boudale
body: Hi Aron,

Yes, I saw that the official example is incorrect, which is why I said I would reach out to the documentation team to fix it. :)

Kind regards,  
Theodora


author: Andrew McMorris
body: Thanks both that got me further. I am now struggling to work out how to have import and steps working beside each other. where I am importing to is below:

default:  
import: shared-pipeline:main:hello-world  
- step: \*software_versions  
But does not like me mixing the two beside each other, any ideas of what to do?

comments: author: Theodora Boudale
body: Hi Andrew,

What you are trying to do is not possible, you cannot have an imported pipeline with additional steps.

Kind regards,  
Theodora


author: Andrew McMorris
body: Thanks Theodora, I raised with support and got the same answer. Makes this very limited and a all or nothing type solution, great start though and looking forward to seeing improvments.


author: Theodora Boudale
body: You are welcome, Andrew. We have a feature request for the ability to export and share individual steps (and also combine an imported step with a local step):

* <https://jira.atlassian.com/browse/BCLOUD-22855>

You can add your vote and feedback to this feature request to express your interest.

Please feel free to reach out if you need anything further.

Kind regards,  
Theodora


author: Caterina Curti
body: Hi [@Andrew McMorris](/t5/user/viewprofilepage/user-id/4590201) ,  

If you are still looking for this, I wanted to let you know that we recently introduced [Dynamic Pipelines](https://bitbucket.org/blog/introducing-dynamic-pipelines-a-new-standard-in-ci-cd-flexibility) which allows you to add a single step (or a few) to multiple pipelines..

I just published [this article](https://community.atlassian.com/t5/Forge-for-Bitbucket-Cloud/Share-a-step-across-pipelines-Dynamic-Pipelines/ba-p/2712403) explaining how to add a step.  

Hope you'll find this useful,  
Caterina


author: Andrew McMorris
body: Thanks [@Caterina Curti](/t5/user/viewprofilepage/user-id/551009) will take a look, not sure we are sold with Dynamic Pipelines tbh, as it feels a rather over complicated solution as we don't want to spend lots of Dev effort into maintaining our pipelines.


author: Caterina Curti
body: Thanks for sharing , [@Andrew McMorris](/t5/user/viewprofilepage/user-id/867362). Dynamic Pipelines provide a lot of flexibility, and that's key to managing pipelines at scale for most customers. We realized that this wouldn't be possible with configuration options.  

It should be pretty easy to get started, I'm also available for a 1:1 session if you like to spend some time with me setting them up. Just reply here.


author: Aron Gombas _Midori_
body: You may want to show also the other pipeline where you import and reuse it.


author: Veeresh
body: Is this issue resolved? I am still unable to import the share-pipeline-1 to import repository, I dont see the pipeline being triggered at import repository. Please advise on how to import the share-pipeline or yaml anchor steps from export repo to import repository in bitbucket. Below example doesn't seems to work.

**Export repository:**

export: true

definitions:  
pipelines:  
share-pipeline-1:  
- step:  
name: "hello world"  
script:  
- echo hello

<br />

**Import repository:**

pipelines:  
custom:  
import-pipeline:  
import: shared-pipeline:main:share-pipeline-1

comments: author: Caterina Curti
body: Hi [@Veeresh](/t5/user/viewprofilepage/user-id/5585844)

Let me start by welcoming you to the community.  

To achieve this, you'll need to use [Dynamic Pipelines](https://bitbucket.org/blog/introducing-dynamic-pipelines-a-new-standard-in-ci-cd-flexibility) which allow you to add a single step (or a few) to multiple pipelines.

Here is an [article](https://community.atlassian.com/t5/Forge-for-Bitbucket-Cloud/Share-a-step-across-pipelines-Dynamic-Pipelines/ba-p/2712403) explaining how to add a step, hopefully this will help you get started.  

Caterina


Tags: bitbucket-cloud

cloud