一看必会系列:Jenkins Publish over SSH 路径写法

https://stackoverflow.com/questions/27051543/transferring-0-files-using-publish-over-ssh-plugin-in-jenkins

 

Publish over SSH  

———–Source files

源目录  是当前workspace 的目录路径

 

例 :

/var/lib/jenkins/workspace/xxx/这里就是目录/1/2/3/文件1.jar

 

相对路径写法   Source files   ./1/2/3/文件1.jar

如果多个文件 可通知 “,” 隔开

 

———记得移出这个目录,不然会在远端生成一样的目录

Remove prefix

 

例写法 

------中间广告---------

Remove prefix   ./1/2/3/

 

———–Remote directory

 

例写法  Remote directory   /tmp

 

这样会生成 /home/xxx/tmp/

 

解决方法, 新建ssh的时候,   remote directory    写  /

Source files

Files to upload to a server.

The string is a comma separated list of includes for an Ant fileset eg. ‘**/*.jar’ (see Patterns in the Ant manual).
The base directory for this fileset is the workspace.

具体看这里

http://ant.apache.org/manual/dirtasks.html#patterns

 

实际执行步骤是

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

发表评论