[JIRA] (JENKINS-58778) [ sshPut ] unable to copy only contents inside folder. put always copying full folder

25 views
Skip to first unread message

kiran.gangadi@gmail.com (JIRA)

unread,
Aug 2, 2019, 4:07:02 AM8/2/19
to jenkinsc...@googlegroups.com
Kiran Kumar Gangadi created an issue
 
Jenkins / Bug JENKINS-58778
[ sshPut ] unable to copy only contents inside folder. put always copying full folder
Issue Type: Bug Bug
Assignee: Naresh Rayapati
Components: ssh-steps-plugin
Created: 2019-08-02 08:06
Labels: plugin
Priority: Major Major
Reporter: Kiran Kumar Gangadi

I am trying to copy contents inside of a folder(whcih is Jenkins workspace) to another reomte location using sshPut. put always copying full folder instead of contents. 

In below example it always trying to copy test folder to destination location.

if the same command executes for the second time it giving below error.
Failed SFTP MKDIR: <host address>:$SERVER_PATH/test
example code:

sshPut remote: remote, from: "$BUILD_NUMBER/test/",into: "$SERVER_PATH"

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

kiran.gangadi@gmail.com (JIRA)

unread,
Aug 2, 2019, 4:12:01 AM8/2/19
to jenkinsc...@googlegroups.com
Kiran Kumar Gangadi updated an issue
Change By: Kiran Kumar Gangadi
I am trying to copy contents inside of a folder(whcih is Jenkins workspace) to another reomte location using sshPut. put always copying full folder instead of contents. 

In below example it always trying to copy test folder to destination location.

if the same command executes for the second time it giving below error.
Failed SFTP MKDIR: <host address>:$SERVER_PATH/test

example code:

*sshPut remote: remote, from: "$BUILD_NUMBER/test/",into: "$SERVER_PATH"*


Installed [SSH Pipeline Steps|https://wiki.jenkins.io/display/JENKINS/SSH+Steps+Plugin] version is  [2.0.0|https://jenkins-test.basf.net/apdl/pluginManager/plugin/ssh-steps/thirdPartyLicenses]

 

naresh.rayapati@gmail.com (JIRA)

unread,
Aug 31, 2019, 8:50:02 PM8/31/19
to jenkinsc...@googlegroups.com
Naresh Rayapati commented on Bug JENKINS-58778
 
Re: [ sshPut ] unable to copy only contents inside folder. put always copying full folder

Please use filterBy, filterRegex options to copy contents of the folders instead of coping the entire folder, and also use 

override: true option to override the contents. 

naresh.rayapati@gmail.com (JIRA)

unread,
Aug 31, 2019, 8:50:04 PM8/31/19
to jenkinsc...@googlegroups.com
Naresh Rayapati closed an issue as Not A Defect
 
Change By: Naresh Rayapati
Status: Open Closed
Resolution: Not A Defect

naresh.rayapati@gmail.com (JIRA)

unread,
Aug 31, 2019, 8:53:01 PM8/31/19
to jenkinsc...@googlegroups.com
 
Re: [ sshPut ] unable to copy only contents inside folder. put always copying full folder

Okay override option is only available for sshGet but for the put you would need to delete the folder before we create it again.

naresh.rayapati@gmail.com (JIRA)

unread,
Aug 31, 2019, 8:54:01 PM8/31/19
to jenkinsc...@googlegroups.com
Naresh Rayapati edited a comment on Bug JENKINS-58778
Okay override option is only available for sshGet but for the put you would need to delete the folder before we create it again. or Use sshRemove step

luckyhk.lee@samsung.com (JIRA)

unread,
Dec 12, 2019, 4:44:02 AM12/12/19
to jenkinsc...@googlegroups.com

Naresh Rayapati

 

Hello.

Can you let me know more detail example for filterBy and filterRegex?

 

I want to scp some/folder/*.tar.gz to remote server's /output/ path.

 

In this case, how can I do that?

I can't find solution in docs and googling and so many test in my PC.

 

Many thanks,

This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo

christian.ciach@gmail.com (JIRA)

unread,
Mar 24, 2020, 10:04:02 AM3/24/20
to jenkinsc...@googlegroups.com

I second this request and I couldn't find a solution for this, too.

This message was sent by Atlassian Jira (v7.13.12#713012-sha1:6e07c38)
Atlassian logo

christian.ciach@gmail.com (JIRA)

unread,
Mar 24, 2020, 10:15:02 AM3/24/20
to jenkinsc...@googlegroups.com
Christian Ciach edited a comment on Bug JENKINS-58778
Maybe we could do something like that as a workaround:

 
{code:java}
findFiles(glob: 'Build/rpms/*.rpm').each { rpmFile ->
  sshPut remote: remote, from: rpmFile.path, into: '/data/mirror/rpm-repo'
}
{code}
This feels a bit dirty this probably has negative performance implications, because this establishes a new SSH-connection for each file.

It would be great if this plugin could provide a "flatten" parameter for the sshPut-step, like the publish-over-ssh plugin: [https://wiki.jenkins.io/display/JENKINS/Publish+Over#PublishOver-Flattenfiles]

Or, alternatively, allow a wildcard for the "from"-parameter of the sshPut-step, so we could use "Build/rpms/*" instead of "Build/rpms" as the source.

 

The underlying library allow many kinds of "from" parameters (like Iterables), not just Strings. Maybe this jenkins plugin could be modified so that not only Strings are permitted as the "from" parameter? At least maybe allow Iterables, too?

christian.ciach@gmail.com (JIRA)

unread,
Mar 24, 2020, 10:15:04 AM3/24/20
to jenkinsc...@googlegroups.com

Maybe we could do something like that as a workaround:

 

findFiles(glob: 'Build/rpms/*.rpm').each { rpmFile -> 
  sshPut remote: remote, from: rpmFile.path, into: '/data/mirror/rpm-repo'
}

This feels a bit dirty this probably has negative performance implications, because this establishes a new SSH-connection for each file.

It would be great if this plugin could provide a "flatten" parameter for the sshPut-step, like the publish-over-ssh plugin: https://wiki.jenkins.io/display/JENKINS/Publish+Over#PublishOver-Flattenfiles

Or, alternatively, allow a wildcard for the "from"-parameter of the sshPut-step, so we could use "Build/rpms/*" instead of "Build/rpms" as the source.

 

The underlying library allow many kinds of "from" parameters (like Iterables), not just Strings. Maybe this jenkins plugin could be modified so that not only Strings are permitted as the "from" parameter? At least maybe allow Iterables, too?

christian.ciach@gmail.com (JIRA)

unread,
Mar 24, 2020, 10:24:02 AM3/24/20
to jenkinsc...@googlegroups.com
Christian Ciach edited a comment on Bug JENKINS-58778
Maybe we could do something like that as a workaround:
{code:java}

findFiles(glob: 'Build/rpms/*.rpm').each { rpmFile ->
  sshPut remote: remote, from: rpmFile.path, into: '/data/mirror/rpm-repo'
}
{code}

This feels a bit dirty this probably has negative performance implications, because this establishes a new SSH-connection for each file.

It would be great if this plugin could provide a "flatten" parameter for the sshPut-step, like the publish-over-ssh plugin: [https://wiki.jenkins.io/display/JENKINS/Publish+Over#PublishOver-Flattenfiles]

Or, alternatively, allow a wildcard for the "from"-parameter of the sshPut-step, so we could use "Build/rpms/*" instead of "Build/rpms" as the source.

 

The underlying library allow many kinds of "from" parameters (like Iterables), not just Strings. Maybe this jenkins plugin could be modified so that not only Strings are permitted as the "from" parameter? At least maybe allow Iterables, too?

christian.ciach@gmail.com (JIRA)

unread,
Mar 24, 2020, 10:54:03 AM3/24/20
to jenkinsc...@googlegroups.com
Christian Ciach edited a comment on Bug JENKINS-58778
Maybe we could do something like that as a workaround:
{code:java}
findFiles(glob: 'Build/rpms/*.rpm').each { rpmFile ->
  sshPut remote: remote, from: rpmFile.path, into: '/data/mirror/rpm-repo'
}
{code}
This feels a bit dirty this probably has negative performance implications, because this establishes a new SSH-connection for each file.

It would be great if this plugin could provide a "flatten" parameter for the sshPut-step, like the publish-over-ssh plugin: [https://wiki.jenkins.io/display/JENKINS/Publish+Over#PublishOver-Flattenfiles]

Or, alternatively, allow a wildcard for the "from"-parameter of the sshPut-step, so we could use "Build/rpms/*" instead of "Build/rpms" as the source.

The underlying library allow allows many kinds of "from" parameters (like Iterables), not just Strings. Maybe this jenkins plugin could be modified so that not only Strings are permitted as the "from" parameter? At least maybe allow Iterables, too?
Reply all
Reply to author
Forward
0 new messages