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

How can i do a pipeline pull request trigger on branch that match release/* where * can be anything

Huxley Goh May 8, 2024

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

2 answers

1 vote
Syahrul
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 9, 2024

G'day, @Huxley Goh 

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

Huxley Goh May 10, 2024

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

Syahrul
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 12, 2024

Hi @Huxley Goh 

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

Huxley Goh May 12, 2024

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

 

Huxley Goh May 12, 2024

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?


Best Regards,
Huxley

Syahrul
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 12, 2024

Hi @Huxley Goh 

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: 

Regards,
Syahrul

 

Huxley Goh May 12, 2024

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

Like Syahrul likes this
Huxley Goh May 13, 2024

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
Syahrul
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 13, 2024

Hi @Huxley Goh 

Understood; if that's the case, I suggest you create a support ticket through our Support portal so that we can review your YAML and provide better guidance.

Regards,
Syahrul

Huxley Goh May 13, 2024

Hi Syahrul,

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

Like Syahrul likes this
0 votes
Saxea _Flowie_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 14, 2024

Hi @Huxley Goh

Flowie has very flexible support for triggering 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.

 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events