Adds support for the Config File Provider Plugin
See https://wiki.jenkins-ci.org/display/JENKINS/Config+File+Provider+Plugin Change-Id: Ie61bc6c4f934baf7e96bf943efcd66b138ef8edd
This commit is contained in:
parent
5b71cb8ff4
commit
5ed6db1986
@ -57,6 +57,48 @@ def ci_skip(parser, xml_parent, data):
|
||||
})
|
||||
|
||||
|
||||
def config_file_provider(parser, xml_parent, data):
|
||||
"""yaml: config-file-provider
|
||||
Provide configuration files (i.e., settings.xml for maven etc.)
|
||||
which will be copied to the job's workspace.
|
||||
Requires the Jenkins `Config File Provider Plugin.
|
||||
<https://wiki.jenkins-ci.org/display/JENKINS/Config+File+Provider+Plugin>`_
|
||||
|
||||
:arg list files: List of managed config files made up of three\
|
||||
parameters
|
||||
|
||||
:Parameter: * **file-id** (`str`)\
|
||||
The identifier for the managed config file
|
||||
:Parameter: * **target** (`str`)\
|
||||
Define where the file should be created (optional)
|
||||
:Parameter: * **variable** (`str`)\
|
||||
Define an environment variable to be used (optional)
|
||||
|
||||
Example:
|
||||
|
||||
.. literalinclude:: \
|
||||
/../../tests/wrappers/fixtures/config-file-provider003.yaml
|
||||
:language: yaml
|
||||
"""
|
||||
top = XML.SubElement(xml_parent, 'org.jenkinsci.plugins.configfiles.'
|
||||
'buildwrapper.ConfigFileBuildWrapper')
|
||||
xml_files = XML.SubElement(top, 'managedFiles')
|
||||
|
||||
files = data.get('files', [])
|
||||
for file in files:
|
||||
xml_file = XML.SubElement(xml_files, 'org.jenkinsci.plugins.'
|
||||
'configfiles.buildwrapper.ManagedFile')
|
||||
file_id = file.get('file-id')
|
||||
if file_id is None:
|
||||
raise JenkinsJobsException("file-id is required for each "
|
||||
"managed configuration file")
|
||||
XML.SubElement(xml_file, 'fileId').text = str(file_id)
|
||||
XML.SubElement(xml_file, 'targetLocation').text = \
|
||||
file.get('target', '')
|
||||
XML.SubElement(xml_file, 'variable').text = \
|
||||
file.get('variable', '')
|
||||
|
||||
|
||||
def logfilesize(parser, xml_parent, data):
|
||||
"""yaml: logfilesize
|
||||
Abort the build if its logfile becomes too big.
|
||||
|
@ -188,6 +188,7 @@ jenkins_jobs.wrappers =
|
||||
build-name=jenkins_jobs.modules.wrappers:build_name
|
||||
build-user-vars=jenkins_jobs.modules.wrappers:build_user_vars
|
||||
ci-skip=jenkins_jobs.modules.wrappers:ci_skip
|
||||
config-file-provider=jenkins_jobs.modules.wrappers:config_file_provider
|
||||
copy-to-slave=jenkins_jobs.modules.wrappers:copy_to_slave
|
||||
delivery-pipeline=jenkins_jobs.modules.wrappers:delivery_pipeline
|
||||
env-file=jenkins_jobs.modules.wrappers:env_file
|
||||
|
14
tests/wrappers/fixtures/config-file-provider001.xml
Normal file
14
tests/wrappers/fixtures/config-file-provider001.xml
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<buildWrappers>
|
||||
<org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper>
|
||||
<managedFiles>
|
||||
<org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
|
||||
<fileId>org.jenkinsci.plugins.configfiles.custom.CustomConfig1409250932722</fileId>
|
||||
<targetLocation>tmp/bar.txt</targetLocation>
|
||||
<variable>varname</variable>
|
||||
</org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
|
||||
</managedFiles>
|
||||
</org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper>
|
||||
</buildWrappers>
|
||||
</project>
|
6
tests/wrappers/fixtures/config-file-provider001.yaml
Normal file
6
tests/wrappers/fixtures/config-file-provider001.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
wrappers:
|
||||
- config-file-provider:
|
||||
files:
|
||||
- file-id: org.jenkinsci.plugins.configfiles.custom.CustomConfig1409250932722
|
||||
target: tmp/bar.txt
|
||||
variable: varname
|
14
tests/wrappers/fixtures/config-file-provider002.xml
Normal file
14
tests/wrappers/fixtures/config-file-provider002.xml
Normal file
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<buildWrappers>
|
||||
<org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper>
|
||||
<managedFiles>
|
||||
<org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
|
||||
<fileId>org.jenkinsci.plugins.configfiles.custom.CustomConfig1234</fileId>
|
||||
<targetLocation/>
|
||||
<variable/>
|
||||
</org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
|
||||
</managedFiles>
|
||||
</org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper>
|
||||
</buildWrappers>
|
||||
</project>
|
4
tests/wrappers/fixtures/config-file-provider002.yaml
Normal file
4
tests/wrappers/fixtures/config-file-provider002.yaml
Normal file
@ -0,0 +1,4 @@
|
||||
wrappers:
|
||||
- config-file-provider:
|
||||
files:
|
||||
- file-id: org.jenkinsci.plugins.configfiles.custom.CustomConfig1234
|
19
tests/wrappers/fixtures/config-file-provider003.xml
Normal file
19
tests/wrappers/fixtures/config-file-provider003.xml
Normal file
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<buildWrappers>
|
||||
<org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper>
|
||||
<managedFiles>
|
||||
<org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
|
||||
<fileId>org.jenkinsci.plugins.configfiles.custom.CustomConfig1234</fileId>
|
||||
<targetLocation/>
|
||||
<variable/>
|
||||
</org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
|
||||
<org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
|
||||
<fileId>org.jenkinsci.plugins.configfiles.custom.CustomConfig5678</fileId>
|
||||
<targetLocation>/foo.txt</targetLocation>
|
||||
<variable>varName</variable>
|
||||
</org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
|
||||
</managedFiles>
|
||||
</org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper>
|
||||
</buildWrappers>
|
||||
</project>
|
7
tests/wrappers/fixtures/config-file-provider003.yaml
Normal file
7
tests/wrappers/fixtures/config-file-provider003.yaml
Normal file
@ -0,0 +1,7 @@
|
||||
wrappers:
|
||||
- config-file-provider:
|
||||
files:
|
||||
- file-id: org.jenkinsci.plugins.configfiles.custom.CustomConfig1234
|
||||
- file-id: org.jenkinsci.plugins.configfiles.custom.CustomConfig5678
|
||||
target: /foo.txt
|
||||
variable: varName
|
Loading…
Reference in New Issue
Block a user