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:
Adam Kaufman 2015-10-27 10:14:18 -04:00 committed by Dong Ma
parent 915a36f449
commit c50171b1b9
5 changed files with 67 additions and 0 deletions

View File

@ -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

View 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>

View File

@ -0,0 +1,4 @@
scm:
- url:
url-list:
- 'http://jenkins.domain.local/jnlpJars/jenkins-cli.jar'

View 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>

View 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