Merge "Add support for multiple Gerrit servers in Gerrit trigger"
This commit is contained in:
commit
0bb2337d57
@ -197,6 +197,9 @@ def gerrit(parser, xml_parent, data):
|
||||
trigger configuration will be fetched from there on a regular interval
|
||||
:arg str custom-url: Custom URL for a message sent to Gerrit. Build
|
||||
details URL will be used if empty. (default '')
|
||||
:arg str server-name: Name of the server to trigger on, or ''__ANY__'' to
|
||||
trigger on any configured Gerrit server (default '__ANY__'). Requires
|
||||
Gerrit Trigger Plugin version >= 2.11.0
|
||||
|
||||
You may select one or more Gerrit events upon which to trigger.
|
||||
You must also supply at least one project and branch, optionally
|
||||
@ -210,7 +213,7 @@ def gerrit(parser, xml_parent, data):
|
||||
|
||||
Example:
|
||||
|
||||
.. literalinclude:: /../../tests/triggers/fixtures/gerrit003.yaml
|
||||
.. literalinclude:: /../../tests/triggers/fixtures/gerrit004.yaml
|
||||
"""
|
||||
|
||||
logger = logging.getLogger("%s:gerrit" % __name__)
|
||||
@ -302,6 +305,8 @@ def gerrit(parser, xml_parent, data):
|
||||
XML.SubElement(gtrig, 'buildUnstableMessage').text = str(
|
||||
data.get('unstable-message', ''))
|
||||
XML.SubElement(gtrig, 'customUrl').text = str(data.get('custom-url', ''))
|
||||
XML.SubElement(gtrig, 'serverName').text = str(
|
||||
data.get('server-name', '__ANY__'))
|
||||
|
||||
|
||||
def pollscm(parser, xml_parent, data):
|
||||
|
@ -43,6 +43,7 @@
|
||||
<buildSuccessfulMessage/>
|
||||
<buildUnstableMessage/>
|
||||
<customUrl/>
|
||||
<serverName>__ANY__</serverName>
|
||||
</com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTrigger>
|
||||
</triggers>
|
||||
</project>
|
||||
|
@ -47,6 +47,7 @@
|
||||
<buildSuccessfulMessage/>
|
||||
<buildUnstableMessage/>
|
||||
<customUrl/>
|
||||
<serverName>__ANY__</serverName>
|
||||
</com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTrigger>
|
||||
</triggers>
|
||||
</project>
|
||||
|
@ -63,6 +63,7 @@
|
||||
<buildSuccessfulMessage/>
|
||||
<buildUnstableMessage/>
|
||||
<customUrl/>
|
||||
<serverName>__ANY__</serverName>
|
||||
</com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTrigger>
|
||||
</triggers>
|
||||
</project>
|
||||
|
53
tests/triggers/fixtures/gerrit004.xml
Normal file
53
tests/triggers/fixtures/gerrit004.xml
Normal file
@ -0,0 +1,53 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<triggers class="vector">
|
||||
<com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTrigger>
|
||||
<spec/>
|
||||
<gerritProjects>
|
||||
<com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.GerritProject>
|
||||
<compareType>PLAIN</compareType>
|
||||
<pattern>test-project</pattern>
|
||||
<branches>
|
||||
<com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.Branch>
|
||||
<compareType>PLAIN</compareType>
|
||||
<pattern>master</pattern>
|
||||
</com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.Branch>
|
||||
<com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.Branch>
|
||||
<compareType>PLAIN</compareType>
|
||||
<pattern>stable</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>subdirectory/**</pattern>
|
||||
</com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
|
||||
</filePaths>
|
||||
</com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.GerritProject>
|
||||
</gerritProjects>
|
||||
<skipVote>
|
||||
<onSuccessful>true</onSuccessful>
|
||||
<onFailed>true</onFailed>
|
||||
<onUnstable>true</onUnstable>
|
||||
<onNotBuilt>true</onNotBuilt>
|
||||
</skipVote>
|
||||
<silentMode>false</silentMode>
|
||||
<escapeQuotes>false</escapeQuotes>
|
||||
<noNameAndEmailParameters>false</noNameAndEmailParameters>
|
||||
<dynamicTriggerConfiguration>True</dynamicTriggerConfiguration>
|
||||
<triggerConfigURL>http://myhost/mytrigger</triggerConfigURL>
|
||||
<triggerOnEvents>
|
||||
<com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginCommentAddedEvent>
|
||||
<verdictCategory>APRV</verdictCategory>
|
||||
<commentAddedTriggerApprovalValue>1</commentAddedTriggerApprovalValue>
|
||||
</com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginCommentAddedEvent>
|
||||
</triggerOnEvents>
|
||||
<buildStartMessage/>
|
||||
<buildFailureMessage/>
|
||||
<buildSuccessfulMessage/>
|
||||
<buildUnstableMessage/>
|
||||
<customUrl/>
|
||||
<serverName>my-server</serverName>
|
||||
</com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTrigger>
|
||||
</triggers>
|
||||
</project>
|
27
tests/triggers/fixtures/gerrit004.yaml
Normal file
27
tests/triggers/fixtures/gerrit004.yaml
Normal file
@ -0,0 +1,27 @@
|
||||
triggers:
|
||||
- gerrit:
|
||||
trigger-on-comment-added-event: true
|
||||
trigger-approval-category: 'APRV'
|
||||
trigger-approval-value: 1
|
||||
projects:
|
||||
- project-compare-type: 'PLAIN'
|
||||
project-pattern: 'test-project'
|
||||
branches:
|
||||
- branch-compare-type: 'PLAIN'
|
||||
branch-pattern: 'master'
|
||||
- branch-compare-type: 'PLAIN'
|
||||
branch-pattern: 'stable'
|
||||
file-paths:
|
||||
- compare-type: ANT
|
||||
pattern: subdirectory/**
|
||||
skip-vote:
|
||||
successful: true
|
||||
failed: true
|
||||
unstable: true
|
||||
notbuilt: true
|
||||
silent: false
|
||||
escape-quotes: false
|
||||
no-name-and-email: false
|
||||
dynamic-trigger-enabled: true
|
||||
dynamic-trigger-url: http://myhost/mytrigger
|
||||
server-name: my-server
|
@ -81,6 +81,7 @@
|
||||
<buildSuccessfulMessage/>
|
||||
<buildUnstableMessage/>
|
||||
<customUrl/>
|
||||
<serverName>__ANY__</serverName>
|
||||
</com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.GerritTrigger>
|
||||
</triggers>
|
||||
<builders>
|
||||
|
Loading…
x
Reference in New Issue
Block a user