Branch Trigger Type & Path Trigger Type in CI Pipeline

 

Continuous integration: as soon as the changes hits the remote repository and if we have integrated pipelines with that branch then your pipeline should run automatically.

Firstly build triggers trigger the build of the project for continuous integration and continuous deployment.

 

 

General Behavior of Branch Triggers:

  • Purpose: Branch triggers are designed to automatically initiate a pipeline (build, test, deploy, etc.) when changes are made to a specific branch in your Git repository.
  • Events: These triggers typically respond to events like:
    • Pushing commits: When new commits are pushed directly to a branch.
    • Pull Requests (PRs): When a new PR is created, updated, or merged into the target branch.
  • Triggering Deployments: 
    • PR By default, Pipeline can trigger a new deployment for an application when a new pull request is merged and touches the application's configuration.
    • onCommit Configuration: Pipeline allows you to control deployment triggering on new Git commits touching the application using the onCommit setting in the application configuration. This suggests that normal commits can trigger deployments your Pipeline .

 

 

When Run Automatically 

  • If we have a pipeline with our develop branch. If a developer commits modifications to the develop branch, This pipeline should execute automatically for new development in the develop branch.

 

How to Enable

  • Enable Trigger Pipeline in Classic Pipeline
    • Edit our existing  classic pipeline
    • At the top there is a option of triggers. Click on triggers.

 

  • Branch Trigger: Select Branch Filter
    • Check “Enable Continues Integration”

 

  • Path Filter:
    • It might possible that a single branch can have multiple project
    • Each project in a branch have its own build pipeline
    • if we didn't specify path- all the pipelines related to the develop branch will start running, means for all projects
    • Define Path / Project inside Develop Branch
      • copy file path: 
      • Path Filter in Triggers
        • If there is a changes in that project, this particular pipeline should not run.
        • We can exclude few folder using second option for exclude 

 

  • Save the pipeline
  • Being a developer do some change in your feature branch and create PR to merge in develop branch -
    • lets create ft01 branch from develop branch
    • create a new file file01.txt in ft01 branch and push to repository
    • Generate PR to merge ft01 into develop branch
      • Lets approve and complete the PR
  • Check if Pipeline is working or not
    • Our Pipeline not working as file01 is created out side the Path
  • Lets create another file (file02.txt) inside the folder and complete PR 
    • Our pipeline is starting
    • A New Commit as well

 

Path

  • Already used above with Branch Trigger

 


Related Question