Details
-
Bug
-
Resolution: Timed out
-
Low
-
Severity 2 - Major
-
1
-
Description
Issue Summary
If a user specifies the exact name of a branch, a tag, or a bookmark in their yml file, the pipeline defined for the specific branch should override any more generic expressions that would match that branch.
This is not the case when the more generic expression is included in curly brackets.
Steps to Reproduce
- Create a Bitbucket Cloud repo
- Create and commit in the repo a bitbucket-pipelines.yml like the following
image: atlassian/default-image:2 pipelines: branches: feature/specific-feature: - step: script: - echo "specific feature pipeline" '{feature/*,testing/*}': - step: script: - echo "pipeline for all other feature and testing branches"
- Create from Bitbucket UI a branch named feature/specific-feature
Expected Results
The pipeline for feature/specific-feature runs
Actual Results
The pipeline for feature/* runs instead
Workaround
Since the issue occurs when curly brackets are used in the generic expression, you can work around this issue by adjusting the bitbucket-pipelines.yml file to not use curly brackets.
E.g. for the example bitbucket-pipelines.yml above, it could be as follows:
image: atlassian/default-image:2 pipelines: 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"
Or using yaml anchors as follows:
image: atlassian/default-image:2 definitions: steps: - step: &feature-testing script: - echo "pipeline for all other feature and testing branches" pipelines: branches: feature/specific-feature: - step: script: - echo "specific feature pipeline" feature/*: - step: *feature-testing testing/*: - step: *feature-testing