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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Can we use same branch name twice on a bitbucket pipeline file?

I have a bitbucket pipeline file as below;

pipelines:

    branches:

      dev:

        - step:

            name: Test1

            script:

              - echo "Test"  

      dev:

        - step:

            name: Test2

            script:

              - echo "Test"
 When the pipeline is triggered only first step runs i.e. Test1 but Test2 doesn't. Is there any way that I can use same branch name twice?

1 answer

1 accepted

0 votes
Answer accepted
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Dec 02, 2022

Hi @Aashish41 and welcome to the community!

I don't believe that this is possible, however, a pipeline for a certain branch can have multiple steps.

If you want to execute both steps when a commit is pushed to dev branch, you can modify your bitbucket-pipelines.yml file as follows:

pipelines:
branches:
dev:
- step:
name: Test1
script:
- echo "Test"
- step:
name: Test2
script:
- echo "Test"

Is this what you are looking for?

Kind regards,
Theodora

Hi @Theodora Boudale , Thank you for your response.

I have already opted using multiple steps for a single branch. I just wanted to know if it is possible to use same branch multiple times. Unfortunately, it is not possible.

Anyway your response was helpful for me. 

Have a great day !

Hi @Theodora Boudale

Is there an alternative other than you create a unique branch name for your pipeline?

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Oct 02, 2023

Hi Tridev,

You can create (multiple) custom pipelines:

Please keep in mind though that these can only be triggered manually or on a schedule, they don't run automatically on every push.

It is also possible to configure a default pipeline that will run automatically on every push if no branch-specific pipeline is defined:

The page I shared has all available options about Pipeline start conditions.

Kind regards,
Theodora

Thank you @Theodora Boudale for your quick response.

I will go through this and let you know if any confusion arises.

Like Theodora Boudale likes this

I had below requirements:

1. whenever the master/ hotfix branch is pushed it should be deployed in UAT environments.

2. After the QA team verifies the changes in UAT, the master branch should be deployed into production

 

since I couldn't use the same branch name in the pipelines. 

I used the custom pipeline to build and deploy in the production.

I also added a manual trigger in the deployment step and ensured it is only deployed by certain individuals.

 

Thanks @Theodora Boudale 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events