Merge "Add regexp option to conditional publisher"

This commit is contained in:
Jenkins 2015-12-03 18:42:26 +00:00 committed by Gerrit Code Review
commit b96d18a9ba
3 changed files with 42 additions and 0 deletions

View File

@ -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')

View 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>

View 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'