def gen_xml(self, xml_parent, data):
definition = data.get(self.component_type, {})
scm_definition = 'scm' in definition
definition_type = 'CpsScmFlowDefinition' if scm_definition else 'CpsFlowDefinition'
xml_definition = XML.SubElement(
xml_parent,
'definition',
{
'plugin': 'workflow-cps',
'class': 'org.jenkinsci.plugins.workflow.cps.' + definition_type
}
)
if scm_definition:
scm_module = next(module for module in self.registry.modules if isinstance(module, SCM))
scm_module.gen_xml(xml_definition, definition)
XML.SubElement(xml_definition, 'scriptPath').text = definition.get('script-path', 'Jenkinsfile')
else:
XML.SubElement(xml_definition, 'script').text = definition.get('script', '')
XML.SubElement(xml_definition, 'sandbox').text = str(definition.get('sandbox', False)).lower()
definition.py 文件源码
python
阅读 32
收藏 0
点赞 0
评论 0
评论列表
文章目录