jenkins使用Publish Over SSH中遇到的问题
在jenkins中想使用publish over ssh来在构建后发送XML或PNG文件至服务器,以便做其它的操作,安装完publish over ssh后,填加构建,发现在构建失败时,不传送文件,老提示:
SSH: Current build result is [FAILURE], not going to run.
一直不知道原因,按照stackoverflow也无法解决.https://stackoverflow.com/questions/31386012/jenkins-publish-over-ssh-after-failed-build
没办法,只有查看官网看看有没有线索
官网网站:https://wiki.jenkins.io/display/JENKINS/Publish+Over+SSH+Plugin
有这样一段说明:
Build wrappers
There will be two new options in the Build Environment section of the job configuration
- Send files or execute commands over SSH before the build starts
This allows SSH to be used before a build begins, but after the workspace has been configured and source checked out
Most useful for maven project types - Send files or execute commands over SSH after the build runs
As long as the build was attempted, this will run after the build finishes, and will run whether the build is successful or not
This allows cleanup or shutdown of services started before or during the build
Use the publisher (Send build artifacts over SSH in Post-build Actions) to publish build artifacts from succesful builds
原来问题在这里,什么意思呢?翻译一下吧
在构建环境选项中,也可以使用public by ssh,这里使用是无论构建成功与否都会执行public by ssh;然后如果使用publisher,在构建后操作就只能在构建成功时才会执行ssh
来图说明下吧
下图选择后,无论构建成功与否都会进行SSH发文件
如果在选择增加构建后操作步骤,就只能构建成功后才会SSH
看来多看官网才是正解
Email:362299908@qq.com