adding support for the custom tools plugin

Change-Id: I9a85a88927c7fc37bbf443295c3ef7a5f6feda50
Signed-off-by: Kyle Rockman <kyle.rockman@mac.com>
This commit is contained in:
Kyle Rockman 2014-11-12 11:16:42 -06:00
parent 445c73a298
commit ae38846af5
4 changed files with 61 additions and 0 deletions

View File

@ -1173,6 +1173,44 @@ def credentials_binding(parser, xml_parent, data):
credential_xml.text = params.get('credential-id')
def custom_tools(parser, xml_parent, data):
"""yaml: custom-tools
Requires the Jenkins Custom Tools Plugin.
<https://wiki.jenkins-ci.org/display/JENKINS/Custom+Tools+Plugin>`_
:arg list tools: List of custom tools to add
(optional)
:arg bool skip-master-install: skips the install in top level matrix job
(default 'false')
:arg bool convert-homes-to-upper: Converts the home env vars to uppercase
(default 'false')
Example:
.. literalinclude:: /../../tests/wrappers/fixtures/custom-tools001.yaml
"""
base = 'com.cloudbees.jenkins.plugins.customtools'
wrapper = XML.SubElement(xml_parent,
base + ".CustomToolInstallWrapper")
wrapper_tools = XML.SubElement(wrapper, 'selectedTools')
tools = data.get('tools', [])
tool_node = base + '.CustomToolInstallWrapper_-SelectedTool'
for tool in tools:
tool_wrapper = XML.SubElement(wrapper_tools, tool_node)
XML.SubElement(tool_wrapper, 'name').text = str(tool)
opts = XML.SubElement(wrapper,
'multiconfigOptions')
skip_install = str(data.get('skip-master-install', 'false'))
XML.SubElement(opts,
'skipMasterInstallation').text = skip_install
convert_home = str(data.get('convert-homes-to-upper', 'false'))
XML.SubElement(wrapper,
'convertHomesToUppercase').text = convert_home
class Wrappers(jenkins_jobs.modules.base.Base):
sequence = 80

View File

@ -198,6 +198,7 @@ jenkins_jobs.wrappers =
config-file-provider=jenkins_jobs.modules.wrappers:config_file_provider
copy-to-slave=jenkins_jobs.modules.wrappers:copy_to_slave
credentials-binding=jenkins_jobs.modules.wrappers:credentials_binding
custom-tools=jenkins_jobs.modules.wrappers:custom_tools
delivery-pipeline=jenkins_jobs.modules.wrappers:delivery_pipeline
env-file=jenkins_jobs.modules.wrappers:env_file
env-script=jenkins_jobs.modules.wrappers:env_script

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<buildWrappers>
<com.cloudbees.jenkins.plugins.customtools.CustomToolInstallWrapper>
<selectedTools>
<com.cloudbees.jenkins.plugins.customtools.CustomToolInstallWrapper_-SelectedTool>
<name>my_custom_tool</name>
</com.cloudbees.jenkins.plugins.customtools.CustomToolInstallWrapper_-SelectedTool>
</selectedTools>
<multiconfigOptions>
<skipMasterInstallation>True</skipMasterInstallation>
</multiconfigOptions>
<convertHomesToUppercase>True</convertHomesToUppercase>
</com.cloudbees.jenkins.plugins.customtools.CustomToolInstallWrapper>
</buildWrappers>
</project>

View File

@ -0,0 +1,6 @@
wrappers:
- custom-tools:
tools:
- my_custom_tool
skip-master-install: true
convert-homes-to-upper: true