Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-59343

Trigger when changes in a specific directory

    Details

    • Similar Issues:

      Description

      I pushed the code changes directly to the master branch, by passing the code review.

      I have a repository which contains multiple directories.

      dummy
        +----- foo
        +----- bar 
      

      I want to trigger the build only when there are changes in the foo directory, and here is how my trigger looks like in the Jenkinsfile:

        triggers {
          gerrit(
            customUrl: '',
            gerritProjects: [[
              branches: [[
                compareType: 'PLAIN',
                pattern: 'master'
              ]],
              filePaths: [[ compareType: 'ANT', pattern: "foo/**" ]],
              compareType: 'PLAIN',
              disableStrictForbiddenFileVerification: false,
              pattern: 'dummy'
            ]],
            serverName: 'dummy-gerrit',
            triggerOnEvents: [
              refUpdated()
            ]
          )
        }
      

      Unfortunately the above doesn't work, the build is still triggered for all the files including the one changed in bar directory.

      Am I missing anything here?

        Attachments

          Activity

          There are no comments yet on this issue.

            People

            • Assignee:
              rsandell rsandell
              Reporter:
              tjhoo TJ Hoo
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: