def managed_script(registry, xml_parent, data):
 step_type = data.get('type', 'script').lower()
 if (step_type == 'script'):
  step = 'ScriptBuildStep'
  script_tag = 'buildStepId'
 elif (step_type == 'batch'):
  step = 'WinBatchBuildStep'
  script_tag = 'command'
 else:
  raise InvalidAttributeError('type', step_type, ['script', 'batch'])
 ms = XML.SubElement(xml_parent, ('org.jenkinsci.plugins.managedscripts.' + step))
 try:
  script_id = data['script-id']
 except KeyError:
  raise MissingAttributeError('script-id')
 XML.SubElement(ms, script_tag).text = script_id
 args = XML.SubElement(ms, 'buildStepArgs')
 for arg in data.get('args', []):
  XML.SubElement(args, 'string').text = arg

def managed_script ( registry , xml_parent , data ) : step_type = data . get ( 'type' , 'script' ) . lower ( ) if ( step_type == 'script' ) : step = 'ScriptBuildStep' script_tag = 'buildStepId' elif ( step_type == 'batch' ) : step = 'WinBatchBuildStep' script_tag = 'command' else : raise InvalidAttributeError ( 'type' , step_type , [ 'script' , 'batch' ] ) ms = XML . SubElement ( xml_parent , ( 'org.jenkinsci.plugins.managedscripts.' + step ) ) try : script_id = data [ 'script-id' ] except KeyError : raise MissingAttributeError ( 'script-id' ) XML . SubElement ( ms , script_tag ) . text = script_id args = XML . SubElement ( ms , 'buildStepArgs' ) for arg in data . get ( 'args' , [ ] ) : XML . SubElement ( args , 'string' ) . text = arg
yaml: managed-script this step allows to reference and execute a centrally managed script within your build .