Transferring 0 files using publishing via SSH plugin in Jenkins

I already read this and this and this answers, but none of them helped me. I am using a windows machine for jenkins

In my workspace there are only the following files

C: \ Jenkins \ workspace \ Copy_file \ DevOps \ resource \ file1.txt C: \ Jenkins \ workspace \ Copy_file \ DevOps \ resource \ file2.txt

I would like to publish on top of ssh only file1.txt

I added a plugin for publishing via SSH:

Source files DevOps\resource\file1.txt Remove prefix DevOps\resource Remote directory /tmp/ 

However, I see the result:

 C:\Jenkins\workspace\Copy_file\DevOps\resource\file1.txt SSH: Connecting from host [hhhhh] SSH: Connecting with configuration [Redhat1] ... SSH: Creating session: username [hhhh], hostname [iiiiii], port [22] SSH: Connecting session ... SSH: Connected SSH: Opening SFTP channel ... SSH: SFTP channel open SSH: Connecting SFTP channel ... SSH: Connected SSH: Remote root is not absolute, getting absolute directory from PWD SSH: Disconnecting configuration [Redhat1] ... SSH: Transferred 0 file(s) Build step 'Send files or execute commands over SSH' changed build result to SUCCESS Finished: SUCCESS 
  • Why is it sending 0 files?
  • How can I make the path absolute so that it puts it in / tmp / and not in / home / user / tmp?

UPDATED

enter image description here

+7
ssh jenkins
source share
3 answers

I had the same problem and I ended up looking for a solution in this post.

  • In particular, what happened to me is that the user we are using in the plugin configuration did not have access to the "root path" ("/"), which forces the default connection to be in "/ home / usery /" .

  • Make sure that the user you are using has access to the absolute path "/ tmp /", because when I tried with the same configuration that you have, this user created this path (/ home / usery / tmp and not in the path / tmp /):

SSH: remote root is not absolute, getting an absolute directory from PWD SSH: cd [/ home / usery] SSH: OK SSH: mkdir [tmp] SSH: OK SSH: cd [tmp] SSH: OK SSH: put [myjar.jar ]

The user may not have permission to create a new directory.

  • Try using the user's home path, for example, try creating the path / home / usery / localdir / anotherDir, then change the Remote Directory configuration to localdir / anotherDir.

  • Finally, we installed Jenkins on a Windows computer, and then move it to a Linux machine, you have to be careful with the path separator "\" and "/", remember this:

    source files and also remove the prefix

Hope my comments help you.

+4
source share

I studied this plugin, but I can not find the reason why it does not work.

The QA team in my company uses this plugin and it works fine.

Try to answer your question, I will try to explain the configuration of this new plugin:

  • In the global configuration: Example global configuration

    • host name: is-bvt-rh-01.XXXXX.com
    • port: 22
    • Root repository path: / (To allow files to be placed in / tmp / instead of / home / user / tmp. The root repository path must exist before you can link to it and must be accessible to the user who is publishing the files.)
    • Username: bvtuser
    • Password: [YOUR_SSH_PASSWORD]
  • In the configuration of your work: Example job configuration

    • SCP Website: is-bvt-rh-01.XXXXX.com
    • Source: DevOps \ resource \ file1.txt (the path is built from the root of the workspace.)
    • Destination: tmp /

Hope this helps!

+1
source share

I ended up using

  • Run a shell shell to transfer the file.

  • Then use the post on the SSH plugin to execute the mysql command for my RDS instance using the SQL script contained in the downloaded file.

0
source share

All Articles