-
Type:
Bug
-
Resolution: Incomplete
-
Priority:
Blocker
-
Component/s: publish-over-ssh-plugin
-
Environment:Jenkins for windows (Jenkins ver. 2.138)
publish-over-ssh plugin version 1.19.1
As per documentation, both `sourceFiles`and `excludes` support Ant patterns to remote publish artifacts such as:
Â
`sourceFiles: '*/target/*jar'`
Â
But the `removePrefix` is not compatible with such patterns. So it seems not to be possible to strip a prefix (e.g. `**/target/`) in that situation.
Â
I would like to publish a set of JARs to a remote server without the full path (or prefix).
How to handle this situation? I have the following:
```
sshPublisher(
   //alwaysPublishFromMaster: true,
   publishers: [
       sshPublisherDesc(
        verbose: true,
        configName: 'foo',
         transfers: [
             sshTransfer(
              sourceFiles: '*/target/*jar',
             removePrefix: '**/target/',
             remoteDirectory: '/tmp/testpublish'
           )
         ],
         sshCredentials: [
           //TODO - replace with placeholder ${user}
            username : 'myuser',
            // key: '''----BEGIN RSA PRIVATE KEY----
// (Insert private key here or use keyPath instead)
// ----END RSA PRIVATE KEY----'''
            keyPath: 'c:/users/userFoo/.ssh/id_rsa'
        ]
      )
    ]
)
```
And I get the following error:
SSH: Connecting from host [XXXXXX]
SSH: Connecting with configuration [foo] ...
SSH: Creating session: username [fooUser], hostname [XXXXXXXXXXX], port [22]
SSH: Connecting session ...
SSH: Connected
SSH: Opening SFTP channel ...
SSH: SFTP channel open
SSH: Connecting SFTP channel ...
SSH: Connected
SSH: cd [/tmp]
SSH: OK
SSH: Disconnecting configuration [foo] ...
ERROR: Exception when publishing, exception message [Failed to remove prefix from file named [foovar/target/fooArtifact.jar]. Prefix [**/target/] must be present in all file paths]