Jenkins - 如果我在本地计算机上提交代码,我该如何自动更新SVN Production Copy?

时间:2017-07-13 04:20:47

标签: curl svn jenkins

我是詹金斯的新手。我正在尝试一个简单的连接,我的工作副本在Windows服务器上,我将代码提交到充当主存储库的远程Linux服务器。

我的部署代码位于不同的服务器上,我安装了Jenkins,并且希望SVN UPDATE在我的工作副本上提交任何内容后立即运行。我已经完成了post-commit连接,并且Jenkins也通过正确的修订和代码更新得到了更新,但物理SVN UPDATE没有在该服务器上发生。我犯了什么错误?

# Working Copy - Windows
# Main Repo - Linux Machine
# Code Deployment Server - Another Linux Machine [Here I am getting intimation about what changes are committed with revision number but physical "SVN COMMIT" is not happening]

### post-commit code on Main Repo machine:
------------------------------------------------
#!/bin/sh

CRUMB=$(curl -s 'http://username:password@hostname:8080/crumbIssuer/api/xml?xpath=concat(//crumbRequestField,":",//crumb)')

curl -X POST -H "$CRUMB" "http://hostname:8080/job/title/build?token=svnwillbetriggeredremotely" --user username:password

一旦我在Windows机器上工作(工作副本),它就会让我在主要部署服务器上跟随我需要" SVN UPDATE"工作:

Workspace of titlename on master
[I get all the filenames as updated with proper content and revision number]

我想要的是" SVN UPDATE"在部署服务器目录上运行。

我的詹金斯配置:

Subversion URL - MainRepoHostname
Local module directory - Path for the local deployment directory where I need SVN UPDATE to work
Check-out Strategy - Use 'SVN Update' as much as possible.

1 个答案:

答案 0 :(得分:0)

我自己找到了解决方案。

实际上,它正在工作空间目录中更新,并且不能直接给出绝对路径。我们需要使用shell执行此操作。我这样做并将命令放入" Execute Shell"它起作用了。