diff --git a/jenkins_jobs/modules/properties.py b/jenkins_jobs/modules/properties.py index ffd78f821..212c2724f 100644 --- a/jenkins_jobs/modules/properties.py +++ b/jenkins_jobs/modules/properties.py @@ -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 diff --git a/tests/properties/fixtures/speed-durability.xml b/tests/properties/fixtures/speed-durability.xml new file mode 100644 index 000000000..10c794057 --- /dev/null +++ b/tests/properties/fixtures/speed-durability.xml @@ -0,0 +1,8 @@ + + + + + PERFORMANCE_OPTIMIZED + + + diff --git a/tests/properties/fixtures/speed-durability.yaml b/tests/properties/fixtures/speed-durability.yaml new file mode 100644 index 000000000..1c1e24bca --- /dev/null +++ b/tests/properties/fixtures/speed-durability.yaml @@ -0,0 +1,3 @@ +properties: + - speed-durability: + hint: performance-optimized