Added property for configuration of speed/durability setting of the job

Change-Id: Ic20aaa55a21fdd88ede95e15ce81c0c613493819
Task: #41581
This commit is contained in:
Igor Lakhtenkov 2021-01-13 17:36:51 +03:00
parent 2563ae4ef0
commit 5dd51be6e6
3 changed files with 38 additions and 0 deletions

View File

@ -1268,6 +1268,33 @@ def cachet_gating(registry, xml_parent, data):
XML.SubElement(resources, "string").text = str(resource)
def speed_durability(registry, xml_parent, data):
"""yaml: speed-durability
This setting allows users to change the default durability mode
for running Pipelines.
:arg str hint: speed durability hint to be used, can be performance-optimized,
survivable-non-atomic, max-survivability
Example:
.. literalinclude::
/../../tests/properties/fixtures/speed-durability.yaml
:language: yaml
"""
dhp = XML.SubElement(
xml_parent,
"org.jenkinsci.plugins.workflow.job.properties.DurabilityHintJobProperty",
)
choicedict = {
"performance-optimized": "PERFORMANCE_OPTIMIZED",
"survivable-non-atomic": "SURVIVABLE_NONATOMIC",
"max-survivability": "MAX_SURVIVABILITY",
}
mapping = [("hint", "hint", None, choicedict)]
helpers.convert_mapping_to_xml(dhp, data, mapping, fail_required=True)
class Properties(jenkins_jobs.modules.base.Base):
sequence = 20

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<properties>
<org.jenkinsci.plugins.workflow.job.properties.DurabilityHintJobProperty>
<hint>PERFORMANCE_OPTIMIZED</hint>
</org.jenkinsci.plugins.workflow.job.properties.DurabilityHintJobProperty>
</properties>
</project>

View File

@ -0,0 +1,3 @@
properties:
- speed-durability:
hint: performance-optimized