How can i do a pipeline pull request trigger on branch that match release/* where * can be anything
Asked by Huxley Goh:

I need to trigger a series of steps when PR is raised for branch that name as "release/\*" where \* can be any string value


Answers:
author: Syahrul
body: G'day, [@Huxley Goh](/t5/user/viewprofilepage/user-id/5493447)

Could you give me more context on this I am not sure I understand the \* asterisk string value.

That said, I suggest checking our pipeline trigger documentation to get more details about how pipeline triggers work:

<https://support.atlassian.com/bitbucket-cloud/docs/pipeline-start-conditions/>

Regards,  
Syahrul

comments: author: Huxley Goh
body: Apologies let me give more context.

I am intending to invoke a series of steps that does code scanning upon pull request triggered. However, I only wish to set the condition whereby only selected branches that starts with "release/\*" will trigger this.  

++**I have the below branches to cover:**++

* release/prd
* release/dev
* release/qa
* release/\<any future release version number\>  

**Invalid** example below that does not work but indicating my intentions:  

pipelines:  
pull-requests:  
'feature/release/\*':  
- step: \*code-quality-scan  
- step: \*sast-scan

Hope that clarifies. Thanks


author: Syahrul
body: Hi [@Huxley Goh](/t5/user/viewprofilepage/user-id/5493447)

Thanks for the info. I believe the following examples are the best options:

```
definitions:   steps:    - step: &build        name: Build        script:          - echo 'test'        pull-requests:    feature/release/*:      - step: *build
```

This will trigger pipeline builds for PR when the source is from "feature/release/\*."

Regards,  
Syahrul


author: Huxley Goh
body: Hi Syahrul,

We did this "feature/release/\*:" but it does not work for us for some reason. When we attempt to submit a PR to the release/production branch it does not trigger the pipeline.

Best Regards,  
Huxley


author: Huxley Goh
body: Hi Syahrul,

Apologies. I did not see the last sentence.  

This will trigger pipeline builds for PR when the source is from "feature/release/\*."  
\>\> ++Then what about we want it to be destination branch instead from source to trigger this pipeline?++

<br />

Best Regards,  
Huxley


author: Syahrul
body: Hi [@Huxley Goh](/t5/user/viewprofilepage/user-id/5493447)

I understand that you would like to trigger a pipeline build based on the destination branch, but currently, we only support triggering builds from the source branch. Unfortunately, we don't have a feature to trigger builds based on the current destination. However, we have an existing feature request that you can watch at:

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

Regards,  
Syahrul


author: Huxley Goh
body: Hi Syahrul,

Thank you for the information and the quick response. We will proceed to test this and revert back if required.

Best Regards,  
Huxley


author: Huxley Goh
body: Hi Syahrul,

I did a quick test. But did not work as expected. Details as followed

1. I updated branch "feature.187" with the new changes as shown above by you with the PR pipeline condition
2. I created a feature branch name "release/testing.pr" from branch above
3. I updated some files to commit and push to "release/testing.pr"
4. I submit a PR from source "release/testing.pr" to destination "feature.187". But the PR pipeline steps are not executed as expected
5. It proceed to trigger the steps that I have configured on branches: "release/\*" condition


author: Syahrul
body: Hi [@Huxley Goh](/t5/user/viewprofilepage/user-id/5493447)

Understood; if that's the case, I suggest you create a support ticket through our [Support portal](https://support.atlassian.com/contact) so that we can review your YAML and provide better guidance.

Regards,  
Syahrul


author: Huxley Goh
body: Hi Syahrul,

Ok will do that. Thank you for the assistance for far.


author: Saxea _Flowie_
body: Hi [@Huxley Goh](/t5/user/viewprofilepage/user-id/5493447)

Flowie has very [flexible support for triggering pipelines](https://flowie.app/docs/en/plugins/pipelines), including based on the destination branch.

If you have any questions, you can contact our support team, who can help you set up your workflow.


Tags: bitbucket-cloud

cloud