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

4 views
Skip to first unread message

tze.jing.hoo@gmail.com (JIRA)

unread,
Sep 13, 2019, 3:11:02 AM9/13/19
to jenkinsc...@googlegroups.com
TJ Hoo created an issue
 
Jenkins / Bug JENKINS-59343
Trigger when changes in a specific directory
Issue Type: Bug Bug
Assignee: rsandell
Components: gerrit-trigger-plugin
Created: 2019-09-13 07:10
Priority: Minor Minor
Reporter: TJ Hoo

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: [
        changeMerged()
      ]
    )
  }

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?

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo

tze.jing.hoo@gmail.com (JIRA)

unread,
Sep 17, 2019, 4:18:04 AM9/17/19
to jenkinsc...@googlegroups.com
TJ Hoo updated an issue
Change By: TJ Hoo
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         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?
Reply all
Reply to author
Forward
0 new messages