• 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:

      ```

      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]

          [JENKINS-53276] removePrefix does not support Ant pattern

          Gerard Bosch created issue -
          Gerard Bosch made changes -
          Description Original: [As per documentation|https://jenkins.io/doc/pipeline/steps/publish-over-ssh/], 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'
                      ]
                  )
               ]
           )

          ```
          New: [As per documentation|https://jenkins.io/doc/pipeline/steps/publish-over-ssh/], 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]
          Gerard Bosch made changes -
          Description Original: [As per documentation|https://jenkins.io/doc/pipeline/steps/publish-over-ssh/], 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]
          New: [As per documentation|https://jenkins.io/doc/pipeline/steps/publish-over-ssh/], 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]
          Alex Earl made changes -
          Resolution New: Incomplete [ 4 ]
          Status Original: Open [ 1 ] New: Closed [ 6 ]

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

              Created:
              Updated:
              Resolved: