Flatten attribute for publish plugins

plus move examples to tests

Change-Id: Ia785afe40da81c77abe643f3c788e5d4faefbf5d
This commit is contained in:
Tomas Bezdek 2014-09-26 10:51:50 +01:00
parent 686265a404
commit d1bfc8e4e3
7 changed files with 157 additions and 28 deletions

View File

@ -745,16 +745,14 @@ def ftp(parser, xml_parent, data):
:arg str remove-prefix: prefix to remove from uploaded file paths
(optional)
:arg bool fail-on-error: fail the build if an error occurs (default false).
:arg bool flatten: only create files on the server, don't create
directories (default false).
Example::
Example:
.. literalinclude:: /../../tests/publishers/fixtures/ftp001.yaml
:language: yaml
publishers:
- ftp:
site: 'ftp.example.com'
target: 'dest/dir'
source: 'base/source/dir/**'
remove-prefix: 'base/source/dir'
excludes: '**/*.excludedfiletype'
"""
console_prefix = 'FTP: '
plugin_tag = 'jenkins.plugins.publish__over__ftp.BapFtpPublisherPlugin'
@ -1145,6 +1143,7 @@ def scp(parser, xml_parent, data):
Example:
.. literalinclude:: /../../tests/publishers/fixtures/scp001.yaml
"""
site = data['site']
scp = XML.SubElement(xml_parent,
@ -1191,19 +1190,14 @@ def ssh(parser, xml_parent, data):
:arg bool fail-on-error: fail the build if an error occurs (default false).
:arg bool always-publish-from-master: transfer the files through the master
before being sent to the remote server (defaults false)
:arg bool flatten: only create files on the server, don't create
directories (default false).
Example::
Example:
.. literalinclude:: /../../tests/publishers/fixtures/ssh001.yaml
:language: yaml
publishers:
- ssh:
site: 'server.example.com'
target: 'dest/dir'
source: 'base/source/dir/**'
remove-prefix: 'base/source/dir'
excludes: '**/*.excludedfiletype'
use-pty: true
command: 'rm -r jenkins_$BUILD_NUMBER'
timeout: 1800000
"""
console_prefix = 'SSH: '
plugin_tag = 'jenkins.plugins.publish__over__ssh.BapSshPublisherPlugin'
@ -1720,7 +1714,8 @@ def base_publish_over(xml_parent, data, console_prefix,
data.get('remove-prefix', '')
XML.SubElement(transfersset, 'remoteDirectorySDF').text = \
str(data.get('target-is-date-format', False)).lower()
XML.SubElement(transfersset, 'flatten').text = 'false'
XML.SubElement(transfersset, 'flatten').text = \
str(data.get('flatten', False)).lower()
XML.SubElement(transfersset, 'cleanRemote').text = \
str(data.get('clean-remote', False)).lower()
@ -1754,16 +1749,14 @@ def cifs(parser, xml_parent, data):
:arg str remove-prefix: prefix to remove from uploaded file paths
(optional)
:arg bool fail-on-error: fail the build if an error occurs (default false).
:arg bool flatten: only create files on the server, don't create
directories (default false).
Example::
Example:
.. literalinclude:: /../../tests/publishers/fixtures/cifs001.yaml
:language: yaml
publishers:
- cifs:
site: 'cifs.share'
target: 'dest/dir'
source: 'base/source/dir/**'
remove-prefix: 'base/source/dir'
excludes: '**/*.excludedfiletype'
"""
console_prefix = 'CIFS: '
plugin_tag = 'jenkins.plugins.publish__over__cifs.CifsPublisherPlugin'

View File

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<publishers>
<jenkins.plugins.publish__over__cifs.CifsPublisherPlugin>
<consolePrefix>CIFS: </consolePrefix>
<delegate>
<publishers>
<jenkins.plugins.publish__over__cifs.CifsPublisher>
<configName>cifs.share</configName>
<verbose>true</verbose>
<transfers>
<jenkins.plugins.publish__over__cifs.CifsTransfer>
<remoteDirectory>dest/dir</remoteDirectory>
<sourceFiles>base/source/dir/**</sourceFiles>
<excludes>**/*.excludedfiletype</excludes>
<removePrefix>base/source/dir</removePrefix>
<remoteDirectorySDF>false</remoteDirectorySDF>
<flatten>true</flatten>
<cleanRemote>false</cleanRemote>
</jenkins.plugins.publish__over__cifs.CifsTransfer>
</transfers>
<useWorkspaceInPromotion>false</useWorkspaceInPromotion>
<usePromotionTimestamp>false</usePromotionTimestamp>
</jenkins.plugins.publish__over__cifs.CifsPublisher>
</publishers>
<continueOnError>false</continueOnError>
<failOnError>false</failOnError>
<alwaysPublishFromMaster>false</alwaysPublishFromMaster>
<hostConfigurationAccess class="jenkins.plugins.publish_over_cifs.CifsPublisherPlugin" reference="../.."/>
</delegate>
</jenkins.plugins.publish__over__cifs.CifsPublisherPlugin>
</publishers>
</project>

View File

@ -0,0 +1,9 @@
publishers:
- cifs:
site: 'cifs.share'
target: 'dest/dir'
source: 'base/source/dir/**'
remove-prefix: 'base/source/dir'
excludes: '**/*.excludedfiletype'
flatten: true

View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<publishers>
<jenkins.plugins.publish__over__ftp.BapFtpPublisherPlugin>
<consolePrefix>FTP: </consolePrefix>
<delegate>
<publishers>
<jenkins.plugins.publish__over__ftp.BapFtpPublisher>
<configName>ftp.example.com</configName>
<verbose>true</verbose>
<transfers>
<jenkins.plugins.publish__over__ftp.BapFtpTransfer>
<remoteDirectory>dest/dir</remoteDirectory>
<sourceFiles>base/source/dir/**</sourceFiles>
<excludes>**/*.excludedfiletype</excludes>
<removePrefix>base/source/dir</removePrefix>
<remoteDirectorySDF>false</remoteDirectorySDF>
<flatten>true</flatten>
<cleanRemote>false</cleanRemote>
<asciiMode>false</asciiMode>
</jenkins.plugins.publish__over__ftp.BapFtpTransfer>
</transfers>
<useWorkspaceInPromotion>false</useWorkspaceInPromotion>
<usePromotionTimestamp>false</usePromotionTimestamp>
</jenkins.plugins.publish__over__ftp.BapFtpPublisher>
</publishers>
<continueOnError>false</continueOnError>
<failOnError>false</failOnError>
<alwaysPublishFromMaster>false</alwaysPublishFromMaster>
<hostConfigurationAccess class="jenkins.plugins.publish_over_ftp.BapFtpPublisherPlugin" reference="../.."/>
</delegate>
</jenkins.plugins.publish__over__ftp.BapFtpPublisherPlugin>
</publishers>
</project>

View File

@ -0,0 +1,9 @@
publishers:
- ftp:
site: 'ftp.example.com'
target: 'dest/dir'
source: 'base/source/dir/**'
remove-prefix: 'base/source/dir'
excludes: '**/*.excludedfiletype'
flatten: true

View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<publishers>
<jenkins.plugins.publish__over__ssh.BapSshPublisherPlugin>
<consolePrefix>SSH: </consolePrefix>
<delegate>
<publishers>
<jenkins.plugins.publish__over__ssh.BapSshPublisher>
<configName>server.example.com</configName>
<verbose>true</verbose>
<transfers>
<jenkins.plugins.publish__over__ssh.BapSshTransfer>
<remoteDirectory>dest/dir</remoteDirectory>
<sourceFiles>base/source/dir/**</sourceFiles>
<execCommand>rm -r jenkins_$BUILD_NUMBER</execCommand>
<execTimeout>1800000</execTimeout>
<usePty>true</usePty>
<excludes>**/*.excludedfiletype</excludes>
<removePrefix>base/source/dir</removePrefix>
<remoteDirectorySDF>false</remoteDirectorySDF>
<flatten>true</flatten>
<cleanRemote>false</cleanRemote>
</jenkins.plugins.publish__over__ssh.BapSshTransfer>
</transfers>
<useWorkspaceInPromotion>false</useWorkspaceInPromotion>
<usePromotionTimestamp>false</usePromotionTimestamp>
</jenkins.plugins.publish__over__ssh.BapSshPublisher>
</publishers>
<continueOnError>false</continueOnError>
<failOnError>false</failOnError>
<alwaysPublishFromMaster>false</alwaysPublishFromMaster>
<hostConfigurationAccess class="jenkins.plugins.publish_over_ssh.BapSshPublisherPlugin" reference="../.."/>
</delegate>
</jenkins.plugins.publish__over__ssh.BapSshPublisherPlugin>
</publishers>
</project>

View File

@ -0,0 +1,12 @@
publishers:
- ssh:
site: 'server.example.com'
target: 'dest/dir'
source: 'base/source/dir/**'
remove-prefix: 'base/source/dir'
excludes: '**/*.excludedfiletype'
use-pty: true
command: 'rm -r jenkins_$BUILD_NUMBER'
timeout: 1800000
flatten: true