Add support for URL scm plugin
Allows for watching for changes in an artifact from a given url Change-Id: I4debc2c6589962497a746f951a54857c8507ea02
This commit is contained in:
parent
915a36f449
commit
c50171b1b9
@ -1189,6 +1189,38 @@ def bzr(parser, xml_parent, data):
|
||||
data['opengrok-root-module'])
|
||||
|
||||
|
||||
def url(parser, xml_parent, data):
|
||||
"""yaml: url
|
||||
|
||||
Watch for changes in, and download an artifact from a particular url.
|
||||
Requires the Jenkins :jenkins-wiki:`URL SCM <URL+SCM>`.
|
||||
|
||||
:arg list url-list: List of URLs to watch. (required)
|
||||
:arg bool clear-workspace: If set to true, clear the workspace before
|
||||
downloading the artifact(s) specified in url-list. (default false)
|
||||
|
||||
Examples:
|
||||
|
||||
.. literalinclude:: ../../tests/scm/fixtures/url001.yaml
|
||||
:language: yaml
|
||||
.. literalinclude:: ../../tests/scm/fixtures/url002.yaml
|
||||
:language: yaml
|
||||
"""
|
||||
|
||||
scm = XML.SubElement(xml_parent, 'scm', {'class':
|
||||
'hudson.plugins.URLSCM.URLSCM'})
|
||||
urls = XML.SubElement(scm, 'urls')
|
||||
try:
|
||||
for data_url in data['url-list']:
|
||||
url_tuple = XML.SubElement(
|
||||
urls, 'hudson.plugins.URLSCM.URLSCM_-URLTuple')
|
||||
XML.SubElement(url_tuple, 'urlString').text = data_url
|
||||
except KeyError as e:
|
||||
raise MissingAttributeError(e.args[0])
|
||||
XML.SubElement(scm, 'clearWorkspace').text = str(
|
||||
data.get('clear-workspace', False)).lower()
|
||||
|
||||
|
||||
class SCM(jenkins_jobs.modules.base.Base):
|
||||
sequence = 30
|
||||
|
||||
|
11
tests/scm/fixtures/url001.xml
Normal file
11
tests/scm/fixtures/url001.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<scm class="hudson.plugins.URLSCM.URLSCM">
|
||||
<urls>
|
||||
<hudson.plugins.URLSCM.URLSCM_-URLTuple>
|
||||
<urlString>http://jenkins.domain.local/jnlpJars/jenkins-cli.jar</urlString>
|
||||
</hudson.plugins.URLSCM.URLSCM_-URLTuple>
|
||||
</urls>
|
||||
<clearWorkspace>false</clearWorkspace>
|
||||
</scm>
|
||||
</project>
|
4
tests/scm/fixtures/url001.yaml
Normal file
4
tests/scm/fixtures/url001.yaml
Normal file
@ -0,0 +1,4 @@
|
||||
scm:
|
||||
- url:
|
||||
url-list:
|
||||
- 'http://jenkins.domain.local/jnlpJars/jenkins-cli.jar'
|
14
tests/scm/fixtures/url002.xml
Normal file
14
tests/scm/fixtures/url002.xml
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<scm class="hudson.plugins.URLSCM.URLSCM">
|
||||
<urls>
|
||||
<hudson.plugins.URLSCM.URLSCM_-URLTuple>
|
||||
<urlString>http://jenkins.domain.local/jnlpJars/jenkins-cli.jar</urlString>
|
||||
</hudson.plugins.URLSCM.URLSCM_-URLTuple>
|
||||
<hudson.plugins.URLSCM.URLSCM_-URLTuple>
|
||||
<urlString>http://code.jquery.com/jquery-1.11.3.min.js</urlString>
|
||||
</hudson.plugins.URLSCM.URLSCM_-URLTuple>
|
||||
</urls>
|
||||
<clearWorkspace>true</clearWorkspace>
|
||||
</scm>
|
||||
</project>
|
6
tests/scm/fixtures/url002.yaml
Normal file
6
tests/scm/fixtures/url002.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
scm:
|
||||
- url:
|
||||
url-list:
|
||||
- 'http://jenkins.domain.local/jnlpJars/jenkins-cli.jar'
|
||||
- 'http://code.jquery.com/jquery-1.11.3.min.js'
|
||||
clear-workspace: true
|
Loading…
Reference in New Issue
Block a user