int128 / int128/gradle-ssh-plugin

'get from' copy task not respecting directory hierarchy with Gradle 5.1

Open
#321 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Groovy
Stars
325
Forks
59
Avg merge
5h 29m
Merged PRs (30d)
6

Description

Hi,

I am using your ssh plugin since quite a while and I really like it.
But with Gradle 5.1 I see a problem, when using the get from copy task to retrieve a whole directory structure from the remote host.
All files and directories are copied, but the directory structure is lost, so all files are copied to the top level of the target directory and all the subdirectories from the remote host are copied here too, but they are empty.
More information below.
Please note that using the same build with Gradle 4.10.2 does not lead to the described problem.

Can you have a look and provide a fix for the problem?

Environment info

gradle-ssh-plugin-2.9.0 (groovy-ssh-2.9.0, jsch-0.1.53, groovy-2.5.4, java-1.8.0_191)

Steps to reproduce
  1. Create a simple build file, containing the snippets shown below, including the doCopy task.

  2. When using the doCopy task the contents of the remote folder should be copied to the build directory on the local host, including the directory hierarchy. But the hierarchy is lost. The build directory contains just all files and empty directories from the target host.

ssh.settings {
        fileTransfer = 'scp'
        jschLog = true
        logging = 'stdout'
}
remotes {
        bla {
                host = "targethost"
                user = "targetuser"
                identity = file("${System.getProperty('user.home')}/.ssh/id_rsa")
        }
}
task doCopy {
        doLast 
                file("${buildDir}").mkdirs()
                ssh.run {
                        session(remotes['bla']) 
                                get from: '/home/targetuser/integrationtest', into: "${buildDir}/"
                        }
                }
        }
}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the supplied doCopy task and the remote /home/targetuser/integrationtest directory, comparing Gradle 5.1 with 4.10.2. Trace the get from copy path and verify that the remote directory hierarchy is preserved in the build directory, including nested files and directories.

Written by the indexing model from the issue text.

Assessment

Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.