Module
Harness CI , Harness CD
Environment
Infrastructure: Kubernetes
OS: Linux
Issue
I am trying to trigger the pipeline only when there’s a change in a specific subfolder of the Git repository. I have the below repository structure and I only want to trigger the pipeline when changes are made in the Subfolder*
path.
Main
|- Subfolder1
|- file1.yaml
|- file2.yaml
|- Subfolder2
|- file1.yaml
|- file2.yaml
Resolution
A path-based trigger can be achieved by using regex conditions in your trigger definition. To set a regex condition go to Pipeline > pipeline_name > triggers > trigger_name > Conditions
. Now select the regex operator in Changed files and pass a regex expression. Use the following regex expression to identify changes in a specific subfolder subFolder($|\/.*)