Implement bzr SCM module.
Change-Id: Iee9c42a742b4062cb4756d16e5978905e115f13f
This commit is contained in:
parent
3765657ec6
commit
860f6ffec5
@ -1102,6 +1102,66 @@ def openshift_img_streams(parser, xml_parent, data):
|
||||
convert_mapping_to_xml(scm, data, mapping)
|
||||
|
||||
|
||||
def bzr(parser, xml_parent, data):
|
||||
"""yaml: bzr
|
||||
Specifies the bzr SCM repository for this job.
|
||||
Requires the Jenkins :jenkins-wiki:`Bazaar Plugin <Bazaar+Plugin>`.
|
||||
|
||||
:arg str url: URL of the bzr branch
|
||||
:arg bool clean-tree: Clean up the workspace (using bzr) before pulling
|
||||
the branch (default: false)
|
||||
:arg bool lightweight-checkout: Use a lightweight checkout instead of a
|
||||
full branch (default: false)
|
||||
:arg str browser: The repository browser to use.
|
||||
|
||||
:browsers supported:
|
||||
* **auto** - (default)
|
||||
* **loggerhead** - as used by Launchpad
|
||||
* **opengrok** - https://opengrok.github.io/OpenGrok/
|
||||
|
||||
:arg str browser-url:
|
||||
URL for the repository browser (required if browser is set).
|
||||
|
||||
:arg str opengrok-root-module:
|
||||
Root module for OpenGrok (required if browser is opengrok).
|
||||
|
||||
Example:
|
||||
|
||||
.. literalinclude:: /../../tests/scm/fixtures/bzr001.yaml
|
||||
"""
|
||||
if 'url' not in data:
|
||||
raise JenkinsJobsException('Must specify a url for bzr scm')
|
||||
mapping = [
|
||||
# option, xml name, default value (text), attributes (hard coded)
|
||||
('url', 'source', ''),
|
||||
('clean-tree', 'cleantree', False),
|
||||
('lightweight-checkout', 'checkout', False),
|
||||
]
|
||||
scm_element = XML.SubElement(
|
||||
xml_parent, 'scm', {'class': 'hudson.plugins.bazaar.BazaarSCM'})
|
||||
convert_mapping_to_xml(scm_element, data, mapping)
|
||||
|
||||
browser_name_to_class = {
|
||||
'loggerhead': 'Loggerhead',
|
||||
'opengrok': 'OpenGrok',
|
||||
}
|
||||
browser = data.get('browser', 'auto')
|
||||
if browser == 'auto':
|
||||
return
|
||||
if browser not in browser_name_to_class:
|
||||
raise InvalidAttributeError('browser', browser,
|
||||
browser_name_to_class.keys())
|
||||
browser_element = XML.SubElement(
|
||||
scm_element,
|
||||
'browser',
|
||||
{'class': 'hudson.plugins.bazaar.browsers.{0}'.format(
|
||||
browser_name_to_class[browser])})
|
||||
XML.SubElement(browser_element, 'url').text = data['browser-url']
|
||||
if browser == 'opengrok':
|
||||
XML.SubElement(browser_element, 'rootModule').text = (
|
||||
data['opengrok-root-module'])
|
||||
|
||||
|
||||
class SCM(jenkins_jobs.modules.base.Base):
|
||||
sequence = 30
|
||||
|
||||
|
8
tests/scm/fixtures/bzr001.xml
Normal file
8
tests/scm/fixtures/bzr001.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<scm class="hudson.plugins.bazaar.BazaarSCM">
|
||||
<source>lp:test_project</source>
|
||||
<cleantree>false</cleantree>
|
||||
<checkout>false</checkout>
|
||||
</scm>
|
||||
</project>
|
3
tests/scm/fixtures/bzr001.yaml
Normal file
3
tests/scm/fixtures/bzr001.yaml
Normal file
@ -0,0 +1,3 @@
|
||||
scm:
|
||||
- bzr:
|
||||
url: lp:test_project
|
8
tests/scm/fixtures/bzr002.xml
Normal file
8
tests/scm/fixtures/bzr002.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<scm class="hudson.plugins.bazaar.BazaarSCM">
|
||||
<source>lp:test_project</source>
|
||||
<cleantree>true</cleantree>
|
||||
<checkout>true</checkout>
|
||||
</scm>
|
||||
</project>
|
5
tests/scm/fixtures/bzr002.yaml
Normal file
5
tests/scm/fixtures/bzr002.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
scm:
|
||||
- bzr:
|
||||
url: lp:test_project
|
||||
lightweight-checkout: True
|
||||
clean-tree: True
|
11
tests/scm/fixtures/bzr003.xml
Normal file
11
tests/scm/fixtures/bzr003.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<scm class="hudson.plugins.bazaar.BazaarSCM">
|
||||
<source>lp:test_project</source>
|
||||
<cleantree>false</cleantree>
|
||||
<checkout>false</checkout>
|
||||
<browser class="hudson.plugins.bazaar.browsers.Loggerhead">
|
||||
<url>http://browser.example.com</url>
|
||||
</browser>
|
||||
</scm>
|
||||
</project>
|
5
tests/scm/fixtures/bzr003.yaml
Normal file
5
tests/scm/fixtures/bzr003.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
scm:
|
||||
- bzr:
|
||||
url: lp:test_project
|
||||
browser: loggerhead
|
||||
browser-url: http://browser.example.com
|
12
tests/scm/fixtures/bzr004.xml
Normal file
12
tests/scm/fixtures/bzr004.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<scm class="hudson.plugins.bazaar.BazaarSCM">
|
||||
<source>lp:test_project</source>
|
||||
<cleantree>false</cleantree>
|
||||
<checkout>false</checkout>
|
||||
<browser class="hudson.plugins.bazaar.browsers.OpenGrok">
|
||||
<url>http://browser.example.com</url>
|
||||
<rootModule>root/module</rootModule>
|
||||
</browser>
|
||||
</scm>
|
||||
</project>
|
6
tests/scm/fixtures/bzr004.yaml
Normal file
6
tests/scm/fixtures/bzr004.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
scm:
|
||||
- bzr:
|
||||
url: lp:test_project
|
||||
browser: opengrok
|
||||
browser-url: http://browser.example.com
|
||||
opengrok-root-module: root/module
|
Loading…
Reference in New Issue
Block a user