We have a repository where we created dev, qa and uat as branches under main. I want to setup CI/CD pipeline for deployment process and our's is hybrid environment. Database server is on-prem and repo on bitbucket cloud. Help me configure bitbucket-pipelines.yml for different these branches.
Hi Mohan and welcome to the community!
It is possible to configure a different pipeline for each branch. The start conditions of pipelines are documented here, what you're looking for is in the branches section:
You could use a bitbucket-pipelines.yml like the following to configure a different build for each branch:
image: node:lts
pipelines:
branches:
dev:
- step:
script:
- echo "This script runs only on commit to the dev branch."
qa:
- step:
image: openjdk:8 # This step uses its own image
script:
- echo "This script runs only on commit to the qa branch."
uat:
- step:
image: openjdk:8 # This step uses its own image
script:
- echo "This script runs only on commit to the uat branch."
Each of these pipelines will get triggered automatically when there are new commits on the respective branch. This bitbucket-pipelines.yml will need to exist on all the branches you want to run pipelines for.
If you use Pipelines on Atlassian's infrastructure, the image parameter defines your build environment. Each step of a Pipelines build runs in a Docker container based on the image you specify in your bitbucket-pipelines.yml file. You can read more here:
The same applies if you use a self-hosted Linux Docker runner on your own server. Exceptions to that are builds running with a self-hosted Linux Shell, MacOS, or Windows runner, which run directly on the host machine and not in a Docker container:
If you run your builds on Atlassian's infrastructure and you need to connect to your on-prem server, and that server is behind a firewall restricting access, you can find the IPs used by Pipelines builds environments here:
If you have any questions, please feel free to reach out!
Kind regards,
Theodora
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.