Add display-name option to github plugin

- Rename test file to be more descriptive
- Add full test file
- Add plugin="github" attribute
- Update plugin to use convert xml

Change-Id: I579248edbab73bda8a5ab8afc11805ac61e049b4
Signed-off-by: Kien Ha <kienha9922@gmail.com>
This commit is contained in:
Kien Ha 2016-07-29 00:30:39 -04:00
parent 54f4e51b2c
commit b01fb482ce
5 changed files with 34 additions and 10 deletions

View File

@ -126,19 +126,29 @@ def github(registry, xml_parent, data):
Sets the GitHub URL for the project.
:arg str url: the GitHub URL (required)
:arg str display-name: This value will be used as context name for commit
status if status builder or status publisher is defined for this
project. (>= 1.14.1) (default '')
Example:
Minimal Example:
.. literalinclude:: /../../tests/properties/fixtures/github.yaml
.. literalinclude:: /../../tests/properties/fixtures/github-minimal.yaml
:language: yaml
Full Example:
.. literalinclude:: /../../tests/properties/fixtures/github-full.yaml
:language: yaml
"""
github = XML.SubElement(xml_parent,
'com.coravy.hudson.plugins.github.'
'GithubProjectProperty')
try:
XML.SubElement(github, 'projectUrl').text = data['url']
except KeyError as e:
raise MissingAttributeError(e)
github = XML.SubElement(
xml_parent, 'com.coravy.hudson.plugins.github.GithubProjectProperty')
github.set('plugin', 'github')
mapping = [
('url', 'projectUrl', None),
('display-name', 'displayName', ''),
]
helpers.convert_mapping_to_xml(github, data, mapping, fail_required=True)
def gitlab(registry, xml_parent, data):

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<properties>
<com.coravy.hudson.plugins.github.GithubProjectProperty plugin="github">
<projectUrl>https://github.com/openstack-infra/jenkins-job-builder/</projectUrl>
<displayName>foo</displayName>
</com.coravy.hudson.plugins.github.GithubProjectProperty>
</properties>
</project>

View File

@ -0,0 +1,4 @@
properties:
- github:
url: https://github.com/openstack-infra/jenkins-job-builder/
display-name: foo

View File

@ -1,8 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<properties>
<com.coravy.hudson.plugins.github.GithubProjectProperty>
<com.coravy.hudson.plugins.github.GithubProjectProperty plugin="github">
<projectUrl>https://github.com/openstack-infra/jenkins-job-builder/</projectUrl>
<displayName/>
</com.coravy.hudson.plugins.github.GithubProjectProperty>
</properties>
</project>