Merge "fix default handling of script-file-path"
This commit is contained in:
@@ -1458,7 +1458,7 @@ def script(parser, xml_parent, data):
|
||||
|
||||
:arg str label: Restrict where the polling should run. (default '')
|
||||
:arg str script: A shell or batch script. (default '')
|
||||
:arg str script-file-path: A shell or batch script path. (default '')
|
||||
:arg str script-file-path: A shell or batch script path. (optional)
|
||||
:arg str cron: cron syntax of when to run (default '')
|
||||
:arg bool enable-concurrent: Enables triggering concurrent builds.
|
||||
(default false)
|
||||
@@ -1477,8 +1477,9 @@ def script(parser, xml_parent, data):
|
||||
label = data.get('label')
|
||||
|
||||
XML.SubElement(st, 'script').text = str(data.get('script', ''))
|
||||
XML.SubElement(st, 'scriptFilePath').text = str(
|
||||
data.get('script-file-path', ''))
|
||||
if 'script-file-path' in data:
|
||||
XML.SubElement(st, 'scriptFilePath').text = str(
|
||||
data.get('script-file-path'))
|
||||
XML.SubElement(st, 'spec').text = str(data.get('cron', ''))
|
||||
XML.SubElement(st, 'labelRestriction').text = str(bool(label)).lower()
|
||||
if label:
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
<triggers class="vector">
|
||||
<org.jenkinsci.plugins.scripttrigger.ScriptTrigger>
|
||||
<script>exit 0</script>
|
||||
<scriptFilePath/>
|
||||
<spec>H/15 * * * *</spec>
|
||||
<labelRestriction>true</labelRestriction>
|
||||
<triggerLabel>master</triggerLabel>
|
||||
14
tests/triggers/fixtures/script002.xml
Normal file
14
tests/triggers/fixtures/script002.xml
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<triggers class="vector">
|
||||
<org.jenkinsci.plugins.scripttrigger.ScriptTrigger>
|
||||
<script>exit 0</script>
|
||||
<scriptFilePath>$WORKSPACE/scripts</scriptFilePath>
|
||||
<spec>H/15 * * * *</spec>
|
||||
<labelRestriction>true</labelRestriction>
|
||||
<triggerLabel>master</triggerLabel>
|
||||
<enableConcurrentBuild>false</enableConcurrentBuild>
|
||||
<exitCode>0</exitCode>
|
||||
</org.jenkinsci.plugins.scripttrigger.ScriptTrigger>
|
||||
</triggers>
|
||||
</project>
|
||||
9
tests/triggers/fixtures/script002.yaml
Normal file
9
tests/triggers/fixtures/script002.yaml
Normal file
@@ -0,0 +1,9 @@
|
||||
triggers:
|
||||
- script:
|
||||
script: 'exit 0'
|
||||
script-file-path: '$WORKSPACE/scripts'
|
||||
cron: 'H/15 * * * *'
|
||||
enable-concurrent: False
|
||||
label: master
|
||||
exit-code: 0
|
||||
|
||||
Reference in New Issue
Block a user