Now a days, everywhere you may come up with the word ‘automation’. Yes, the term automation has revolutionized the entire universe. During the software development process, instead of doing the repeated process by manual, transition to automation can helps to reduce labor cost, manual work and more importantly, it saves time.
When managing complex software projects or interconnected repositories, it may be necessary to coordinate actions across multiple repositories. By setting up a pipeline trigger between repositories, you can automate the execution of tasks or workflows in response to specific events. It can ensures consistency, efficiency, and synchronization between repositories, allowing for streamlined development, testing, and deployment processes.
There are various tools available to do the above process. Among all, we have preferred Bitbucket tool to trigger the pipeline on one of the repo when the changes pushed on the another repo and it significantly results in higher productivity rate.
Let’s have a look on how to do this!
We also have a youtube tutorial published below. If you want a video-based tutorial please follow.
Requirement:
We currently have two repositories: one that contains the source repo of our configuration files, and another that contains scripts to build and deploy the application to our environment. Hence, I want to trigger the Pipeline when changes happen in source repo to trigger another repository Pipeline.az
Prerequisites :
Bitbucket account
You have to already configure the pipeline in your destination(another) repo.
Procedure
Please follow the below step to configure when changes happen in a particular repository to trigger destination(another) repo pipeline.
Step1 :
Navigate through your source repo of Bitbucket, if any changes happen in this repo it should trigger destination(another) repository’s Bitbucket pipelines.
Step:2
Create a bitbucket-pipelines.yml file in that source repository.
Note: You need to mention your Bitbucket username and password in Bitbucket repository variables, workspace ID in account and destination repository name, and branch name details to trigger pipeline kindly reference the below scripts for example
image: atlassian/default-image:3 definitions: services: docker: memory: 2048 #increasing docker service memory steps: - step: &bitbucket-pipeline-trigger-internal-api name: pipeline trigger another repos internal-api script: - pipe: atlassian/trigger-pipeline:5.1.0 variables: BITBUCKET_USERNAME: $BITBUCKET_USERNAME BITBUCKET_APP_PASSWORD: $BITBUCKET_APP_PASSWORD #BITBUCKET_ACCESS_KEY: bitbucket-trigger REPOSITORY: '<your-destination-repo-name>' ACCOUNT: '<your-workspace-name>' REF_TYPE: 'branch' REF_NAME: '<your-branch-name>' # WAIT: "true" # DEBUG: 'true' # Optional pipelines: branches: <your-branch-name-of-source-repo>: - step: *bitbucket-pipeline-trigger-internal-api
once you updated the above details in the bitbucket-pipelines.yml file commit the changes which you have updated and it will trigger the pipeline of your source and destination bitbucket repo pipeline.
Below screenshot example of the outputs pipeline source and destination.
Now we successfully configured to trigger the pipeline when changes happen in a particular repo to trigger another repository pipeline.