config-file-provider: Add tests

Change-Id: Id8e36d1745bd05527985d5ee9ddfba32c5fa197d
Signed-off-by: Tan Heng Yeow <E0032242@u.nus.edu>
This commit is contained in:
tanhengyeow 2018-08-19 14:41:05 +08:00
parent 4d5397c496
commit b76d4da653
12 changed files with 35 additions and 28 deletions

View File

@ -2154,10 +2154,16 @@ def config_file_provider(registry, xml_parent, data):
example "password: ${PYPI_JENKINS_PASS}" will be replaced with
the global variable configured in Jenkins.
Example:
Full Example:
.. literalinclude::
../../tests/builders/fixtures/config-file-provider01.yaml
../../tests/builders/fixtures/config-file-provider-full.yaml
:language: yaml
Minimal Example:
.. literalinclude::
../../tests/builders/fixtures/config-file-provider-minimal.yaml
:language: yaml
"""
cfp = XML.SubElement(xml_parent,

View File

@ -208,11 +208,15 @@ def config_file_provider(registry, xml_parent, data):
For example "password: ${PYPI_JENKINS_PASS}" will be replaced
with the global variable configured in Jenkins.
Example:
Full Example:
.. literalinclude:: \
/../../tests/wrappers/fixtures/config-file-provider003.yaml
:language: yaml
.. literalinclude::
/../../tests/wrappers/fixtures/config-file-provider-full.yaml
Minimal Example:
.. literalinclude::
/../../tests/wrappers/fixtures/config-file-provider-minimal.yaml
"""
cfp = XML.SubElement(xml_parent, 'org.jenkinsci.plugins.configfiles.'
'buildwrapper.ConfigFileBuildWrapper')

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<builders>
<org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep plugin="config-file-provider">
<managedFiles>
<org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
<fileId>org.jenkinsci.plugins.configfiles.maven.MavenSettingsConfig0123456789012</fileId>
<targetLocation/>
<variable/>
<replaceTokens>false</replaceTokens>
</org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
</managedFiles>
</org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
</builders>
</project>

View File

@ -0,0 +1,4 @@
builders:
- config-file-provider:
files:
- file-id: org.jenkinsci.plugins.configfiles.maven.MavenSettingsConfig0123456789012

View File

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<buildWrappers>
<org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper plugin="config-file-provider">
<managedFiles>
<org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
<fileId>org.jenkinsci.plugins.configfiles.custom.CustomConfig1409250932722</fileId>
<targetLocation>tmp/bar.txt</targetLocation>
<variable>varname</variable>
<replaceTokens>true</replaceTokens>
</org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
</managedFiles>
</org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper>
</buildWrappers>
</project>

View File

@ -1,7 +0,0 @@
wrappers:
- config-file-provider:
files:
- file-id: org.jenkinsci.plugins.configfiles.custom.CustomConfig1409250932722
target: tmp/bar.txt
variable: varname
replace-tokens: true