Duplicate globbing pattern match?

This question is in reference to Atlassian Documentation: Configure bitbucket-pipelines.yml

The document describes I can use globbing patterns to choose a pipeline for branches, tags, and Mercurial bookmarks. What happens if more than one globbing pattern match to a branch, tag, or bookmarks?

I read any exact match always has precedence over non-exact matches but nothing about precedence among globbing patterns. Is there a way to add an anything else pipeline without using default?

1 answer

1 accepted

0 vote

Hi Kaz,

We match the most specific pattern. So if you have multiple globbing patterns, the most specific one to match your branch/tag/bookmark will be selected. For example:

pipelines:
  branches:
    my-branch-a:
      - step:
          script:
            - echo "branch 1"
    my-branch-*:
      - step:
          script:
            - echo "branch 2"
    my-*:
      - step:
          script:
            - echo "branch 3"
    '*':
      - step:
          script:
            - echo "branch 4"


With the above YAML. If I push a commit to the branch my-branch-b, it will build against the configuration for "my-branch-*". Running the 'echo "branch 2"' command.

If I push a commit to the branch my-awesome-branch, it will build against the configuration for "my-*". Running the 'echo "branch 3"' command.

All branches that don't match my-branch-a, my-branch-*, or my-* (in that order of priority) will build against the '*' configuration. Running the 'echo "branch 4"' command. Acting as the "anything else" without needing a default section.

Does that make sense? smile

Thanks,

Phil

Thank you. That makes sense.

Suggest an answer

Log in or Sign up to answer
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

1,750 views 1 5
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you