-
Notifications
You must be signed in to change notification settings - Fork 830
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add path selection for gerrit trigger #749
Add path selection for gerrit trigger #749
Conversation
2838097
to
336134d
Compare
336134d
to
74b41d6
Compare
Thank you for this pull request! Please check this document for how the Jenkins project handles pull requests. |
I tried to do a review, but I figured out that I need a running Gerrit instance to test this. Can you confirm? Do you have a public instance that I can use for testing? |
Hi, But I have working configuration xml from jenkins: <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTrigger plugin="gerrit-trigger@2.13.0">
<gerritProjects>
<com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.GerritProject>
<compareType>ANT</compareType>
<pattern>projectX</pattern>
<branches>
<com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.Branch>
<compareType>ANT</compareType>
<pattern>**</pattern>
</com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.Branch>
</branches>
<filePaths>
<com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
<compareType>ANT</compareType>
<pattern>modules/module1/**</pattern>
</com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
</filePaths>
</com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.GerritProject>
</gerritProjects>
<triggerOnEvents>
<com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginPatchsetCreatedEvent>
<excludeDrafts>false</excludeDrafts>
<excludeTrivialRebase>false</excludeTrivialRebase>
<excludeNoCodeChange>false</excludeNoCodeChange>
</com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginPatchsetCreatedEvent>
<com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginChangeRestoredEvent/>
<com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginDraftPublishedEvent/>
<com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginChangeMergedEvent/>
</triggerOnEvents>
</com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTrigger> |
There is also available docker image with gerrit: https://hub.docker.com/r/openfrontier/gerrit/ |
I tried the Docker image, but got lost in authentication problems between Jenkins and Gerrit... I always do some manual testing for a new feature before merging to see if there are any typos or copy&paste error in the generated XML. If I can't do the testing, I'm not going to merge a feature. But there is a way out. This triggered me to take a look at the new Structs Plugin for generating DSLs. I plan to integrate generic DSL support for any plugin with the help of the Structs plugin, see #816. Support for the new This will enable the following generic Job DSL syntax for the Gerrit trigger, including path selection. job('example') {
triggers {
gerritTrigger {
gerritProjects {
gerritProject {
compareType('ANT')
pattern('projectX')
branches {
branch {
compareType('ANT')
pattern('**')
}
}
filePaths {
filePath {
compareType('ANT')
pattern('modules/module1/**')
}
}
disableStrictForbiddenFileVerification(false)
}
}
triggerOnEvents {
patchsetCreated {
excludeDrafts(false)
excludeTrivialRebase(false)
excludeNoCodeChange(false)
}
changeRestored()
draftPublished()
changeMerged()
}
}
}
} The syntax is a bit different from the built-in syntax, but all options of the Gerrit trigger are supported out-of-the-box. So the next Job DSL and Gerrit Trigger releases will enable the DSL above. Until then I keep this PR open for reference, but I will close it after the release. The built-in DSL support for the Gerrit trigger will be deprecated in favor for the generic DSL. |
The example above will work with Job DSL 1.46 and Gerrit Trigger 2.20.0, so I am closing this PR. |
No description provided.