Search code examples
jenkinsjenkins-pipelinemultibranch-pipeline

How to run jenkins job via changes in specific git folder?


I have one git repository where I have multiple folders, I want the Jenkins pipeline trigger when a specific folder gets changed.

How can I achieve this?


Solution

  • You can configure your Jenkinsfile to do that.

    Take a look on Jenkins Built-in Conditions. You need "changeset" here.

    e.g.

    stages {
    stage('yourStage') {
        when { changeset "FOLDERNAME/*"}
        steps {
         //.... what to do...
        }
    }
    

    }

    Jenkins Built In Conditions