jenkinsci / jenkinsci/gerrit-trigger-plugin
[JENKINS-59343] Trigger when changes in a specific directory
- Dominant language
- Java
- Stars
- 226
- Forks
- 289
- PR merge metrics
- No merged PRs in 30d
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?
---
Originally reported by tjhoo, imported from: Trigger when changes in a specific directory
rsandell
Raw content of original issue
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
+----- barI 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?
Contributor guide
Research direction
Reproduce the reported Jenkinsfile configuration with separate foo and bar directories, using the gerrit trigger's filePaths and refUpdated() settings. Trace the gerrit-trigger-plugin handling of file path filters and compare the observed trigger behavior with the expected foo-only behavior; done means changes under bar no longer trigger the build while changes under foo do.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- ci-cd
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100