Add support for Parameterized Scheduler Plugin
Change-Id: I159d2379e316a7ed037ed24b379c519deb1b22ea Signed-off-by: Fatih Degirmenci <fatih.degirmenci@ericsson.com>
This commit is contained in:
parent
0b8c110fb4
commit
29b8249042
@ -1700,6 +1700,36 @@ def rabbitmq(registry, xml_parent, data):
|
||||
raise MissingAttributeError(e.arg[0])
|
||||
|
||||
|
||||
def parameterized_timer(parser, xml_parent, data):
|
||||
"""yaml: parameterized-timer
|
||||
Trigger builds with parameters at certain times.
|
||||
Requires the Jenkins :jenkins-wiki:`Parameterized Scheduler Plugin
|
||||
<Parameterized+Scheduler+Plugin>`.
|
||||
|
||||
:arg str cron: cron syntax of when to run and with which parameters
|
||||
(required)
|
||||
|
||||
Example:
|
||||
|
||||
.. literalinclude::
|
||||
/../../tests/triggers/fixtures/parameterized-timer001.yaml
|
||||
:language: yaml
|
||||
"""
|
||||
|
||||
param_timer = XML.SubElement(
|
||||
xml_parent,
|
||||
'org.jenkinsci.plugins.parameterizedscheduler.'
|
||||
'ParameterizedTimerTrigger')
|
||||
|
||||
XML.SubElement(param_timer, 'spec').text = ''
|
||||
|
||||
try:
|
||||
XML.SubElement(param_timer, 'parameterizedSpecification').text = str(
|
||||
data.get('cron'))
|
||||
except KeyError as e:
|
||||
raise MissingAttributeError(e)
|
||||
|
||||
|
||||
class Triggers(jenkins_jobs.modules.base.Base):
|
||||
sequence = 50
|
||||
|
||||
|
9
tests/triggers/fixtures/parameterized-timer001.xml
Normal file
9
tests/triggers/fixtures/parameterized-timer001.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<triggers class="vector">
|
||||
<org.jenkinsci.plugins.parameterizedscheduler.ParameterizedTimerTrigger>
|
||||
<spec/>
|
||||
<parameterizedSpecification>@midnight % PARAM=value</parameterizedSpecification>
|
||||
</org.jenkinsci.plugins.parameterizedscheduler.ParameterizedTimerTrigger>
|
||||
</triggers>
|
||||
</project>
|
3
tests/triggers/fixtures/parameterized-timer001.yaml
Normal file
3
tests/triggers/fixtures/parameterized-timer001.yaml
Normal file
@ -0,0 +1,3 @@
|
||||
triggers:
|
||||
- parameterized-timer:
|
||||
cron: "@midnight % PARAM=value"
|
11
tests/triggers/fixtures/parameterized-timer002.xml
Normal file
11
tests/triggers/fixtures/parameterized-timer002.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<triggers class="vector">
|
||||
<org.jenkinsci.plugins.parameterizedscheduler.ParameterizedTimerTrigger>
|
||||
<spec/>
|
||||
<parameterizedSpecification>0 * * * * % param1=value1;param2=value2
|
||||
30 * * * * % param1=value3;param2=value4
|
||||
</parameterizedSpecification>
|
||||
</org.jenkinsci.plugins.parameterizedscheduler.ParameterizedTimerTrigger>
|
||||
</triggers>
|
||||
</project>
|
5
tests/triggers/fixtures/parameterized-timer002.yaml
Normal file
5
tests/triggers/fixtures/parameterized-timer002.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
triggers:
|
||||
- parameterized-timer:
|
||||
cron: |
|
||||
0 * * * * % param1=value1;param2=value2
|
||||
30 * * * * % param1=value3;param2=value4
|
Loading…
Reference in New Issue
Block a user