简体   繁体   English

Jenkins:在不触发构建的情况下更新SCM?

[英]Jenkins: update SCM without triggering a build?

We have an SCM-controlled project that polls a repo every several minutes. 我们有一个由SCM控制的项目,每隔几分钟会轮询一次回购。 Overall the workflow is great but occasionally I need to push the new changes to the server's repository without triggering a build in Jenkins (for various reasons: long builds, minor changes, concurrent commits etc). 总体而言,工作流程很棒,但有时我需要将新更改推送到服务器的存储库,而无需触发Jenkins的构建(由于各种原因:长构建,较小更改,并发提交等)。

I have already set up a quiet period, and sometimes I just start and stop the build (which is awkward), so the Jenkins pulls the changes and does not trigger the build later. 我已经设置了一段安静的时间,有时我只是开始和停止构建(这很尴尬),因此Jenkins撤消了更改,以后不再触发构建。

So, is there a plugin of any sort that allows either: 因此,是否有任何一种插件可以允许:

  • Manually cancel the future build (before it's triggered by SCM poller) 手动取消将来的版本(在由SCM轮询器触发之前)
  • Manually update the project's SCM repo without triggering a build? 在不触发构建的情况下手动更新项目的SCM存储库?

You have many solutions to do this : 您有许多解决方案可以做到这一点:

  1. Instead of polling your SCM and trigger a build on change, you can do it another way. 您可以采用另一种方法来代替轮询SCM并触发基于变更的构建。 You can make your SCM decide if the commit should trigger a job or not. 您可以让SCM决定提交是否应该触发工作。 Have a look there for an example 看看那里的例子
  2. You could try to use the "Excluded Commit comments" property in Subversion extended properties of your job, this way, you could avoid to trigger builds on "useless commits". 您可以尝试在工作的Subversion扩展属性中使用“排除的提交注释”属性,这样就可以避免在“无用的提交”上触发构建。

Take a look at that: https://wiki.jenkins-ci.org/display/JENKINS/PollSCM+Plugin 看一看: https : //wiki.jenkins-ci.org/display/JENKINS/PollSCM+Plugin

you should configure the build trigger as "Build periodically" (without "Pool SCM" trigger) only and i think that might do the job 您应该只将构建触发器配置为“定期构建”(不使用“ Pool SCM”触发器),我认为这可能可以完成工作

Another idea (not necessarily a better one, but it may better suit your tastes): use Run Condition Plugin . 另一个想法(不一定是更好的想法,但是可能更适合您的口味):使用Run Condition Plugin Make the rest of your build conditional on a parameter (let's name it DO_BUILD ). 使其余的构建取决于参数(让我们将其命名为DO_BUILD )。 Set that parameter to TRUE by default. 默认情况下,将该参数设置为TRUE If you need to commit something without triggering the build set DO_BUILD default to FALSE . 如果您需要提交某些内容而不触发构建集,则DO_BUILD默认为FALSE

A variation on the same idea: you do your polling in one job ( Trigger ) that calls your main job via Parameterized Trigger Plugin in a build step. 相同想法的一种变体:您在一个作业中执行轮询( Trigger ),该作业在构建步骤中通过Parameterized Trigger Plugin调用主作业。 That build step is then can be conditioned upon a parameter. 该构建步骤然后可以以参数为条件。 Note that in this case you will either have to use the same custom workspace for both builds, or do a manual check out (say, in a shell build step) in the main job. 请注意,在这种情况下,您将必须对两个构建都使用相同的自定义工作区,或者在主要作业中进行手动检出(例如,在shell构建步骤中)。

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

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