Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-53276

removePrefix does not support Ant pattern


    • Icon: Bug Bug
    • Resolution: Incomplete
    • Icon: Blocker Blocker
    • 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:


          //alwaysPublishFromMaster: true,
          publishers: [
                 verbose: true,
                  configName: 'foo',
                  transfers: [
                          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]

            slide_o_mix Alex Earl
            gbosch Gerard Bosch
            0 Vote for this issue
            3 Start watching this issue