简体   繁体   English

Jenkins Git插件轮询

[英]Jenkins Git plugin polling

I have an issue which I think is due to the Git plugin. 我有一个问题,我认为是由于Git插件引起的。

I have a set of jobs which are to be run only when triggered remotely. 我有一组作业, 只有在远程触发时才能运行。 To achieve this, under the build triggers section I selected only the "Trigger builds remotely" option, leaving everything else is turned off (even the "Poll SCM" option). 为了实现这一点,在构建触发器部分下,我仅选择了“远程构建触发器”选项,而其他所有选项均处于关闭状态(甚至是“轮询SCM”选项)。 However this is not working, as I have some jobs that keep starting up without any apparent reason. 但是,这是行不通的,因为我有一些工作在没有任何明显原因的情况下继续启动。 Moreover, when I look at "false" build logs, the very first line says "Started by an SCM change". 此外,当我查看“假”构建日志时,第一行显示“开始于SCM更改”。

I guess that this is due to the Git plugin which is polling for changes on the repo. 我猜这是由于Git插件正在轮询仓库中的更改。 Here is my question: why would the Git plugin keep polling the repo when I explicitly said that the job should NOT be triggered by Polling the SCM? 这里是我的问题:为什么Git的插件保持轮询回购时,我明确地说,这项工作不应由轮询SCM被触发?

You can also check your job scripts, which uses git plugin: there is parameter poll: false for disabling polling for an SCM checkout 您还可以检查使用git插件的作业脚本:有参数poll: false用于禁用针对SCM签出的轮询

Examples: 例子:

  • If you are using Git : 如果您使用的是Git

git branch: 'your_branch_name', changelog: false, credentialsId: 'your_git_credentials_in_jenkins', poll: false, url: 'http://localhost:7990/scm/test/your_repo.git'

  • If you are using GitSCM : 如果您使用的是GitSCM

checkout changelog: false, poll: false, scm: [$class: 'GitSCM', branches: [[name:'*/your_branch_name']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'your_git_credentials_in_jenkins', url: 'http://localhost:7990/scm/test/your_repo.git']]]

You can use snippet generator to get example of parameters and their default values for your SCM 您可以使用代码片段生成器获取SCM的参数示例及其默认值

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

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