From 5dd51be6e6ad1a9b073df1c038155ad1cc6e864c Mon Sep 17 00:00:00 2001 From: Igor Lakhtenkov Date: Wed, 13 Jan 2021 17:36:51 +0300 Subject: [PATCH] Added property for configuration of speed/durability setting of the job Change-Id: Ic20aaa55a21fdd88ede95e15ce81c0c613493819 Task: #41581 --- jenkins_jobs/modules/properties.py | 27 +++++++++++++++++++ .../properties/fixtures/speed-durability.xml | 8 ++++++ .../properties/fixtures/speed-durability.yaml | 3 +++ 3 files changed, 38 insertions(+) create mode 100644 tests/properties/fixtures/speed-durability.xml create mode 100644 tests/properties/fixtures/speed-durability.yaml 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