I'm following this link for the Gitflow branching model:
In this diagram, commits flow as follows:
Scenario-1: Feature -> Dev -> Release -> Master
Scenario-2: Hotfix -> Master and Hotfix -> Dev
Scenario-3: Release -> Master and Release -> Dev
I'm looking to implement the bitbucket pipeline. Most of the ones recommended the below pipeline configurations.
image: your-preferred-docker-image
pipelines:
default:
- step:
name: Build and Test
script:
- echo "Build and test commands go here"
branches:
master:
- step:
name: Deploy to Production
script:
- echo "Deployment to production goes here"
develop:
- step:
name: Deploy to Staging
script:
- echo "Deployment to staging goes here"
release/*:
- step:
name: Build and Test Release
script:
- echo "Build and test release branch"
It will trigger a pipeline for every merge in the respective branch. I'm looking to trigger the pipeline once and it will wait for manual trigger to merge other environments.
For example,
Scenario-1: if anyone merge feature branch to dev, it will trigger pipeline and deploy it in dev and wait for manual trigger to deploy the same in release and master.
Scenario-2: if anyone merge hotfix branch to master, it will trigger pipeline and deploy it in master and wait for manual trigger to deploy the same in dev and it won't trigger scenario 1 again.
Scenario-3: if anyone commit directly to release, it will trigger pipeline and deploy it in release and wait for manual trigger to deploy the same in master and dev and it won't trigger scenario-1 and scenario-2 again.
Any guidance is much appreciated. Thanks in advance.

To implement the Bitbucket pipeline according to the Gitflow branching model, we need to define specific pipeline steps for each scenario, including manual triggers.
For Bitbucket pipelines, you can use
manualsteps to control when deployments should occur:That configuration makes sure deployments to
master,develop, andrelease/*branches require a manual trigger, not automatically deploying after each merge.Scenario-1: Merging a feature branch to develop will trigger the
Integrate Featurestep, but not deploy to staging. A manual step must be triggered for deployment to staging.Scenario-2: Merging a hotfix branch to master will trigger the
Deploy to Productionstep, but it will require a manual trigger to deploy. After deployment to master, a manual step must be triggered for deployment to develop.Scenario-3: Committing directly to a release branch will trigger the
Prepare Releasestep and then require a manual trigger to deploy to the release environment. Subsequent manual triggers are required to deploy to master and develop.Note that Bitbucket Pipelines also support the
custompipeline which can be triggered manually. That might be useful if you want to have even more control over the deployment process, especially for complex workflows like the one you are implementing.You can trigger the
deploy-to-stagingcustom pipeline manually whenever you want to deploy thedevelopbranch to the staging environment.When you want to deploy the
masterbranch to production, you manually trigger thedeploy-to-productioncustom pipeline.For a release branch, after preparing the release, you can manually trigger
deploy-release-to-envsto deploy to both staging and production.When you have a hotfix that needs to be deployed to
develop, after merging tomaster, you can manually triggerdeploy-hotfix-to-dev.To trigger a custom pipeline manually, you can go to the Bitbucket repository's
Pipelinessection, click on 'Run pipeline', select the branch, and then choose the custom pipeline you want to run.This setup allows your team to have full control over when to deploy to different environments, without the pipeline being triggered automatically on every push or merge. The manual steps will not run until someone triggers them, giving your team the opportunity to review changes before they are deployed.