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?

          [JENKINS-59343] Trigger when changes in a specific directory

          TJ Hoo created issue -
          TJ Hoo made changes -
          Description Original: I pushed the code changes directly to the master branch, by passing the code review.

          I have a repository which contains multiple directories.
          {code}
          dummy
            +----- foo
            +----- bar
          {code}

          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:
          {code:groovy}
            triggers {
              gerrit(
                customUrl: '',
                gerritProjects: [[
                  branches: [[
                    compareType: 'PLAIN',
                    pattern: 'master'
                  ]],
                  filePaths: [[ compareType: 'ANT', pattern: "foo/**" ]],
                  compareType: 'PLAIN',
                  disableStrictForbiddenFileVerification: false,
                  pattern: 'dummy'
                ]],
                serverName: 'dummy-gerrit',
                triggerOnEvents: [
                  changeMerged()
                ]
              )
            }
          {code}

          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?
          New: I pushed the code changes directly to the master branch, by passing the code review.

          I have a repository which contains multiple directories.
          {code}
          dummy
            +----- foo
            +----- bar
          {code}

          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:
          {code:groovy}
            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()
                ]
              )
            }
          {code}

          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?

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

              Created:
              Updated: