Merge "Add regexp option to conditional publisher"
This commit is contained in:
commit
b96d18a9ba
@ -4512,6 +4512,11 @@ def conditional_publisher(parser, xml_parent, data):
|
||||
executed by cmd, under Windows
|
||||
|
||||
:condition-command: Command to execute
|
||||
regexp Run the action if a regular expression matches
|
||||
|
||||
:condition-expression: Regular Expression
|
||||
:condition-searchtext: Text to match against
|
||||
the regular expression
|
||||
file-exists Run the action if a file exists
|
||||
|
||||
:condition-filename: Check existence of this file
|
||||
@ -4590,6 +4595,12 @@ def conditional_publisher(parser, xml_parent, data):
|
||||
ctag.set('class',
|
||||
class_pkg + '.contributed.BatchFileCondition')
|
||||
XML.SubElement(ctag, "command").text = cdata['condition-command']
|
||||
elif kind == "regexp":
|
||||
ctag.set('class',
|
||||
class_pkg + '.core.ExpressionCondition')
|
||||
XML.SubElement(ctag,
|
||||
"expression").text = cdata['condition-expression']
|
||||
XML.SubElement(ctag, "label").text = cdata['condition-searchtext']
|
||||
elif kind == "file-exists":
|
||||
ctag.set('class',
|
||||
class_pkg + '.core.FileExistsCondition')
|
||||
|
21
tests/publishers/fixtures/conditional-publisher004.xml
Normal file
21
tests/publishers/fixtures/conditional-publisher004.xml
Normal file
@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<publishers>
|
||||
<org.jenkins__ci.plugins.flexible__publish.FlexiblePublisher>
|
||||
<publishers>
|
||||
<org.jenkins__ci.plugins.flexible__publish.ConditionalPublisher>
|
||||
<condition class="org.jenkins_ci.plugins.run_condition.core.ExpressionCondition">
|
||||
<expression>^(origin\/)?master$</expression>
|
||||
<label>$GIT_BRANCH</label>
|
||||
</condition>
|
||||
<runner class="org.jenkins_ci.plugins.run_condition.BuildStepRunner$Fail"/>
|
||||
<publisher class="hudson.tasks.ArtifactArchiver">
|
||||
<artifacts>**/**</artifacts>
|
||||
<latestOnly>false</latestOnly>
|
||||
<allowEmptyArchive>true</allowEmptyArchive>
|
||||
</publisher>
|
||||
</org.jenkins__ci.plugins.flexible__publish.ConditionalPublisher>
|
||||
</publishers>
|
||||
</org.jenkins__ci.plugins.flexible__publish.FlexiblePublisher>
|
||||
</publishers>
|
||||
</project>
|
10
tests/publishers/fixtures/conditional-publisher004.yaml
Normal file
10
tests/publishers/fixtures/conditional-publisher004.yaml
Normal file
@ -0,0 +1,10 @@
|
||||
publishers:
|
||||
- conditional-publisher:
|
||||
- condition-kind: regexp
|
||||
condition-expression: ^(origin\/)?master$
|
||||
condition-searchtext: $GIT_BRANCH
|
||||
action:
|
||||
- archive:
|
||||
artifacts: '**/**'
|
||||
allow-empty: 'true'
|
||||
|
Loading…
Reference in New Issue
Block a user