Adding support for Sidebar Plugin
<https://wiki.jenkins-ci.org/display/JENKINS/Sidebar+Plugin
You can find the original version of this patch here:
c5ea266856
Update to the original author's patch is limited to moving the one line
from setup.py to setup.cfg, fixing some pep8 errors, and adding a unit test.
It is being submitted upstream with Holger's approval, because he doesn't
have the time available to do it himself.
Change-Id: I75ffedeaafab3aea4eb1b172a980d625669fdacc
Co-Authored-By: Philip Hands <phil@hands.com>
This commit is contained in:
parent
9e0ef50a18
commit
d1e4168594
@ -202,6 +202,32 @@ def throttle(parser, xml_parent, data):
|
||||
XML.SubElement(throttle, 'configVersion').text = '1'
|
||||
|
||||
|
||||
def sidebar(parser, xml_parent, data):
|
||||
"""yaml: sidebar
|
||||
Allows you to add links in the sidebar.
|
||||
Requires the Jenkins :jenkins-wiki:`Sidebar Plugin <Sidebar+Plugin>`.
|
||||
|
||||
:arg str url: url to link to (optional)
|
||||
:arg str text: text for the link (optional)
|
||||
:arg str icon: path to icon (optional)
|
||||
|
||||
Example:
|
||||
|
||||
.. literalinclude:: /../../tests/properties/fixtures/sidebar02.yaml
|
||||
"""
|
||||
sidebar = xml_parent.find('hudson.plugins.sidebar__link.ProjectLinks')
|
||||
if sidebar is None:
|
||||
sidebar = XML.SubElement(xml_parent,
|
||||
'hudson.plugins.sidebar__link.ProjectLinks')
|
||||
links = XML.SubElement(sidebar, 'links')
|
||||
else:
|
||||
links = sidebar.find('links')
|
||||
action = XML.SubElement(links, 'hudson.plugins.sidebar__link.LinkAction')
|
||||
XML.SubElement(action, 'url').text = str(data.get('url', ''))
|
||||
XML.SubElement(action, 'text').text = str(data.get('text', ''))
|
||||
XML.SubElement(action, 'icon').text = str(data.get('icon', ''))
|
||||
|
||||
|
||||
def inject(parser, xml_parent, data):
|
||||
"""yaml: inject
|
||||
Allows you to inject environment variables into the build.
|
||||
|
@ -100,6 +100,7 @@ jenkins_jobs.properties =
|
||||
priority-sorter=jenkins_jobs.modules.properties:priority_sorter
|
||||
promoted-build=jenkins_jobs.modules.properties:promoted_build
|
||||
raw=jenkins_jobs.modules.general:raw
|
||||
sidebar=jenkins_jobs.modules.properties:sidebar
|
||||
slave-utilization=jenkins_jobs.modules.properties:slave_utilization
|
||||
throttle=jenkins_jobs.modules.properties:throttle
|
||||
zeromq-event=jenkins_jobs.modules.properties:zeromq_event
|
||||
|
14
tests/properties/fixtures/sidebar01.xml
Normal file
14
tests/properties/fixtures/sidebar01.xml
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<properties>
|
||||
<hudson.plugins.sidebar__link.ProjectLinks>
|
||||
<links>
|
||||
<hudson.plugins.sidebar__link.LinkAction>
|
||||
<url>https://jenkins.debian.net/userContent/about.html</url>
|
||||
<text>About jenkins.debian.net</text>
|
||||
<icon>/userContent/images/debian-swirl-24x24.png</icon>
|
||||
</hudson.plugins.sidebar__link.LinkAction>
|
||||
</links>
|
||||
</hudson.plugins.sidebar__link.ProjectLinks>
|
||||
</properties>
|
||||
</project>
|
5
tests/properties/fixtures/sidebar01.yaml
Normal file
5
tests/properties/fixtures/sidebar01.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
properties:
|
||||
- sidebar:
|
||||
icon: /userContent/images/debian-swirl-24x24.png
|
||||
text: About jenkins.debian.net
|
||||
url: 'https://jenkins.debian.net/userContent/about.html'
|
20
tests/properties/fixtures/sidebar02.xml
Normal file
20
tests/properties/fixtures/sidebar02.xml
Normal file
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<properties>
|
||||
<hudson.plugins.sidebar__link.ProjectLinks>
|
||||
<links>
|
||||
<hudson.plugins.sidebar__link.LinkAction>
|
||||
<url>https://jenkins.debian.net/userContent/about.html</url>
|
||||
<text>About jenkins.debian.net</text>
|
||||
<icon>/userContent/images/debian-swirl-24x24.png</icon>
|
||||
</hudson.plugins.sidebar__link.LinkAction>
|
||||
<hudson.plugins.sidebar__link.LinkAction>
|
||||
<url>https://jenkins.debian.net/view/reproducible</url>
|
||||
<text>reproducible builds jobs</text>
|
||||
<icon>/userContent/images/debian-jenkins-24x24.png</icon>
|
||||
</hudson.plugins.sidebar__link.LinkAction>
|
||||
</links>
|
||||
</hudson.plugins.sidebar__link.ProjectLinks>
|
||||
</properties>
|
||||
</project>
|
||||
|
9
tests/properties/fixtures/sidebar02.yaml
Normal file
9
tests/properties/fixtures/sidebar02.yaml
Normal file
@ -0,0 +1,9 @@
|
||||
properties:
|
||||
- sidebar:
|
||||
url: https://jenkins.debian.net/userContent/about.html
|
||||
text: About jenkins.debian.net
|
||||
icon: /userContent/images/debian-swirl-24x24.png
|
||||
- sidebar:
|
||||
url: https://jenkins.debian.net/view/reproducible
|
||||
text: reproducible builds jobs
|
||||
icon: /userContent/images/debian-jenkins-24x24.png
|
Loading…
Reference in New Issue
Block a user