Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Pipeline is running wrong branch

Hi,

I may have found a bug in the pipelines definition.

In my project, a specific build should run for the `feature/specific-feature` Branch, all other feature and testing branches should have the same steps. After reading the documentation (https://support.atlassian.com/bitbucket-cloud/docs/use-glob-patterns-on-the-pipelines-yaml-file/), I created a separate branch pipeline for this specific branch. But when pushing to this branch, the other pipeline runs.

I tried this with an example project and a very small bitbucket-pipelines.yml:

image: atlassian/default-image:2

pipelines:
default:
- step:
script:
- echo "default pipeline"
branches:
feature/specific-feature:
- step:
script:
- echo "specific feature pipeline"
'{feature/*,testing/*}':
- step:
script:
- echo "pipeline for all other feature and testing branches"

But, when pushing to the `feature/specific-feature` branch, the pipeline outputs "pipeline for all other feature and testing branches". I have attached a screenshot of the pipeline output:campaigningbureau___branch-test___Pipelines_—_Bitbucket.jpg

Could anyone help me?

1 answer

1 accepted

1 vote
Answer accepted

Hi @schind ,

I believe this may be a bug, as a pipeline for a specific branch should override a more generic expression that would match this branch.

I am going to reach out to the development team to confirm and will then raise a bug report.

Based on several attempts I made to reproduce and narrow down the scope of the issue, it looks that the problem is introduced when the curly brackets are used.

As a workaround, I would suggest using a yaml file like this instead:

image: atlassian/default-image:2

pipelines:
default:
- step:
script:
- echo "default pipeline"
branches:
feature/specific-feature:
- step:
script:
- echo "specific feature pipeline"
feature/*:
- step:
script:
- echo "pipeline for all other feature and testing branches"
testing/*:
- step:
script:
- echo "pipeline for all other feature and testing branches"

 

This should work as expected. If the script for feature/* and testing/* has a lot of commands, you can use yaml anchors to improve readability and be able to make changes for both pipelines at the same place:

 

image: atlassian/default-image:2

definitions:
steps:
- step: &feature-testing
script:
- echo "pipeline for all other feature and testing branches"

pipelines:
default:
- step:
script:
- echo "default pipeline"
branches:
feature/specific-feature:
- step:
script:
- echo "specific feature pipeline"
feature/*:
- step: *feature-testing
testing/*:
- step: *feature-testing

 

Please feel free to let me know if this works for you, I will follow up with you also regarding the bug report.

Kind regards,
Theodora

Hi @Theodora Boudale ,

thanks for your response. Yes, it seems to be an issue with the curly brackets. I can confirm, that the workaround does work for me.

Do you have any update regarding the bug report already?

 

Best regards,

Stefan

Hi Stefan,

You are very welcome, good to hear that the workaround works.

I got confirmation that this is indeed unintended behavior and I raised a public bug report in our issue tracker:

If you'd like to get notified via email you may add yourself as a watcher by selecting the Start watching this issue link in the bug report.

Bugs are fixed as per our policy here and when there is an update, it will get posted in that public ticket.

Please feel free to let me know if you need anything further.

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Trello

Taco Tuesday: Your favorite Trello blog takeaway

Hello friends! From the community that brought you Welcome Wednesday, Throwback Thursday and Friday Fun, welcome to Taco Tuesday, a weekly discussion about all things Trello. The best part? One Tac...

67 views 4 3
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you