简体   繁体   English

Jenkins 可以在每次任何 svn 用户提交代码时检测到吗?

[英]can Jenkins detect everytime any svn-user commit the code?

can Jenkins detect everytime any svn-user commit the code? Jenkins 可以在每次任何 svn 用户提交代码时检测到吗? I want to know everytime the svn-user commit by Jenkins, is there any way or jenkins plugin?我想知道每次 Jenkins 提交 svn-user 时,有什么办法或 jenkins 插件吗? now I use svn update cmd in Jenkins to update svn.现在我在 Jenkins 中使用svn update cmd 来更新 svn。

You can follow either of following approaches to get what you want您可以按照以下任一方法来获得您想要的

  1. Poll SVN for changes from Jenkins轮询 SVN 以获取 Jenkins 的更改
  2. Configure SVN (using post commit hook) to trigger a build on Jenkins配置 SVN(使用提交后挂钩)以在 Jenkins 上触发构建

For polling, go to job properties -> "Build Triggers" heading and select "Poll SCM Schedule".对于轮询,go 到作业属性 ->“构建触发器”标题和 select“轮询 SCM 计划”。 You can specify how often do you want SVN to poll the repository.您可以指定希望 SVN 轮询存储库的频率。 You can keep this value as low as 1 minute.您可以将此值保持为低至 1 分钟。

For SVN post commit hook, take a look at Subversion Plugin Documentation .对于 SVN 提交后挂钩,请查看Subversion Plugin Documentation This is explained in detail in "Post-commit hook" section.这在“提交后挂钩”部分中有详细说明。 Please read through this section carefully as it explains all the options including what/when to include which svn information in jenkins REST call from the trigger script.请仔细阅读本节,因为它解释了所有选项,包括从触发脚本调用 jenkins REST 中包含哪些 svn 信息的内容/时间。

If you build is dependent on multiple repositories (say every solution is in repository of it's own) then SVN post commit is the best option since you'll be able to trigger a single job from all the repository post commit by providing/tweaking parameters in the post commit hook script.如果您构建依赖于多个存储库(例如每个解决方案都在它自己的存储库中),那么 SVN 提交后是最好的选择,因为您可以通过提供/调整参数从所有存储库提交后触发单个作业提交后挂钩脚本。

On a side note, I can understand why someone downvoted your question.在旁注中,我可以理解为什么有人对您的问题投了反对票。 I'll strongly recommend you to add full information in your questions and show that you have done the research yourself before posting a question.我强烈建议您在问题中添加完整信息,并表明您在发布问题之前已经自己完成了研究。 A quick google on "jenkins trigger build on svn commit" lead me to this stackoverflow question as the first result which precisely explains what you are trying to do.快速谷歌上的“jenkins trigger build on svn commit”让我想到了这个stackoverflow问题,这是第一个结果,它准确地解释了你想要做什么。 The question (and it's answers) are very old (asked 8 years back, active till last year) but every bit of information is still very helpful for this question.这个问题(及其答案)已经很老了(8 年前问过,直到去年才有效),但每一点信息对这个问题仍然非常有帮助。 " How do I ask a good question " from stackoverflow help section further explains what does stackoverflow community expects in general in every question. stackoverflow 帮助部分中的“我如何提出一个好问题”进一步解释了 stackoverflow 社区对每个问题的总体期望。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM