Add GLOBAL configurable durability setting for pipelines

Prod related: PROD-21893 (PROD:21893)

Change-Id: Iffa3fa9b52a2494a9f08015f0ba3e9bb9f5c1b86
diff --git a/_states/jenkins_flowdurability.py b/_states/jenkins_flowdurability.py
new file mode 100644
index 0000000..2f261aa
--- /dev/null
+++ b/_states/jenkins_flowdurability.py
@@ -0,0 +1,35 @@
+import logging
+
+logger = logging.getLogger(__name__)
+
+def __virtual__():
+    '''
+    Only load if jenkins_common module exist.
+    '''
+    if 'jenkins_common.call_groovy_script' not in __salt__:
+        return (
+            False,
+            'The jenkins_flowdurability state module cannot be loaded: '
+            'jenkins_common not found')
+    return True
+
+
+def flowdurability(name, flowdurabilitylevel):
+    """
+    Jenkins workflow plugin flow durability level config state method
+
+    :flowdurabilitylevel: Flow Durability Level:
+    MAX_SURVIVABILITY
+    PERFORMANCE_OPTIMIZED
+    SURVIVABLE_NONATOMIC
+    :returns: salt-specified state dict
+    """
+
+    template = __salt__['jenkins_common.load_template'](
+        'salt://jenkins/files/groovy/flowdurability.template',
+        __env__)
+
+    return __salt__['jenkins_common.api_call'](name, template,
+                        ['CHANGED', 'EXISTS'],
+                        {'flowdurabilitylevel': flowdurabilitylevel},
+                        'FlowDurabilityLevel config')