Allow configuration of Topics for Gerrit trigger
Gerrit trigger in addition to project name, branch and file-path also supports when-to-trigger limitation based on topic of the change, this adds support for that. Change-Id: Icfcb3f02903a61294d23dd53308287a67927c777
This commit is contained in:
parent
0268581fca
commit
7fc8758441
|
@ -175,6 +175,14 @@ def gerrit(parser, xml_parent, data):
|
||||||
* **pattern** (`str`) -- File path pattern to
|
* **pattern** (`str`) -- File path pattern to
|
||||||
match
|
match
|
||||||
|
|
||||||
|
* **topics** (`list`) -- List of topics to match
|
||||||
|
(optional)
|
||||||
|
|
||||||
|
:File Path: * **compare-type** (`str`) -- ''PLAIN'', ''ANT''
|
||||||
|
or ''REG_EXP'' (optional) (default ''PLAIN'')
|
||||||
|
* **pattern** (`str`) -- Topic name pattern to
|
||||||
|
match
|
||||||
|
|
||||||
:arg dict skip-vote: map of build outcomes for which Jenkins must skip
|
:arg dict skip-vote: map of build outcomes for which Jenkins must skip
|
||||||
vote. Requires Gerrit Trigger Plugin version >= 2.7.0
|
vote. Requires Gerrit Trigger Plugin version >= 2.7.0
|
||||||
|
|
||||||
|
@ -274,6 +282,19 @@ def gerrit(parser, xml_parent, data):
|
||||||
XML.SubElement(fp_tag, 'compareType').text = \
|
XML.SubElement(fp_tag, 'compareType').text = \
|
||||||
file_path.get('compare-type', 'PLAIN')
|
file_path.get('compare-type', 'PLAIN')
|
||||||
XML.SubElement(fp_tag, 'pattern').text = file_path['pattern']
|
XML.SubElement(fp_tag, 'pattern').text = file_path['pattern']
|
||||||
|
|
||||||
|
topics = project.get('topics', [])
|
||||||
|
if topics:
|
||||||
|
topics_tag = XML.SubElement(gproj, 'topics')
|
||||||
|
for topic in topics:
|
||||||
|
topic_tag = XML.SubElement(topics_tag,
|
||||||
|
'com.sonyericsson.hudson.plugins.'
|
||||||
|
'gerrit.trigger.hudsontrigger.data.'
|
||||||
|
'Topic')
|
||||||
|
XML.SubElement(topic_tag, 'compareType').text = \
|
||||||
|
topic.get('compare-type', 'PLAIN')
|
||||||
|
XML.SubElement(topic_tag, 'pattern').text = topic['pattern']
|
||||||
|
|
||||||
build_gerrit_skip_votes(gtrig, data)
|
build_gerrit_skip_votes(gtrig, data)
|
||||||
XML.SubElement(gtrig, 'silentMode').text = str(
|
XML.SubElement(gtrig, 'silentMode').text = str(
|
||||||
data.get('silent', False)).lower()
|
data.get('silent', False)).lower()
|
||||||
|
|
|
@ -23,6 +23,12 @@
|
||||||
<pattern>subdirectory/**</pattern>
|
<pattern>subdirectory/**</pattern>
|
||||||
</com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
|
</com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
|
||||||
</filePaths>
|
</filePaths>
|
||||||
|
<topics>
|
||||||
|
<com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.Topic>
|
||||||
|
<compareType>ANT</compareType>
|
||||||
|
<pattern>refactor-xy**</pattern>
|
||||||
|
</com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.Topic>
|
||||||
|
</topics>
|
||||||
</com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.GerritProject>
|
</com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.GerritProject>
|
||||||
</gerritProjects>
|
</gerritProjects>
|
||||||
<skipVote>
|
<skipVote>
|
||||||
|
|
|
@ -14,6 +14,9 @@ triggers:
|
||||||
file-paths:
|
file-paths:
|
||||||
- compare-type: ANT
|
- compare-type: ANT
|
||||||
pattern: subdirectory/**
|
pattern: subdirectory/**
|
||||||
|
topics:
|
||||||
|
- compare-type: ANT
|
||||||
|
pattern: refactor-xy**
|
||||||
skip-vote:
|
skip-vote:
|
||||||
successful: true
|
successful: true
|
||||||
failed: true
|
failed: true
|
||||||
|
|
Loading…
Reference in New Issue