definition.py 文件源码

python
阅读 32 收藏 0 点赞 0 评论 0

项目:jenkins-job-builder-pipeline 作者: rusty-dev 项目源码 文件源码
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()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号