简体   繁体   English

如何关闭单个Jenkins作业的git notifyCommit Web挂钩触发器?

[英]How to turn off git notifyCommit web hook trigger for individual Jenkins jobs?

I have a couple of Jenkins jobs in a build pipeline. 我在构建管道中有几个Jenkins工作。 One of them is a performance test and takes a long time to run. 其中一项是性能测试,需要很长时间才能运行。 I would like it to run only once per day, or at least during a permitted time window at night. 我希望它每天只运行一次,或者至少在晚上允许的时间范围内运行。

Currently the job gets triggered by: 当前,作业是由以下人员触发的:

  • BuildResultTrigger plugin BuildResultTrigger插件
    • monitors previous job in pipeline (build phase) 监视管道中的先前作业(构建阶段)
    • status: SUCCESS or UNSTABLE 状态:成功或不稳定
    • schedule: @midnight 日程:@midnight
  • Git plugin : notifyCommit on push events, by a web hook in the GitLab server. Git插件 :通过GitLab服务器中的Web挂钩在推送事件上使用 notifyCommit

If it were only for the BuildResultTrigger, then it would be good enough for me. 如果仅用于BuildResultTrigger,那么对我来说就足够了。 However the notifyCommit web hook triggers every job that uses the same git repository as defined in the URL. 但是, notifyCommit Web挂钩会触发使用URL中定义的相同git存储库的每个作业。 And I can't not use the git repository, because obviously. 而且我不能使用git存储库,因为显然。 (unless there is a way?) (除非有办法?)

What I am looking for: 我在寻找什么:

  • Either a way to turn off the git notifyCommit web hook trigger for an individual job. 两种方法都可以关闭单个作业的git notifyCommit Web挂钩触发器。
  • Or a way to define a time window, like from 00:00 AM to 04:00 AM, which is the only time the job is allowed to run. 或定义时间窗口的方式,例如从00:00 AM到04:00 AM,这是唯一允许运行作业的时间。

I will use the Clone Workspace SCM plugin . 我将使用克隆工作区SCM插件

This plugin makes it possible to archive the workspace from builds of one project and reuse them as the SCM source for another project. 使用此插件可以从一个项目的构建中存档工作区,并将其用作另一项目的SCM源。

  • Job A builds the project 作业A建立项目
  • At the end of a successful build, the Clone Workspace SCM plugin archives the build workspace 成功构建结束时,克隆工作区SCM插件将构建工作区存档
  • Job B does not use Git SCM, so it won't get activated by the git notifyCommit web hook trigger. 作业B不使用Git SCM,因此它不会被git notifyCommit Web挂钩触发器激活。
  • Job B uses Clone Workspace SCM to retrieve the last successful build of Job A. 作业B使用克隆工作区SCM检索作业A的上一次成功构建。
  • Job B runs performance tests once per day, scheduled around @midnight . 作业B每天运行一次性能测试,预定于@midnight左右@midnight

I was also using the Shared Workspace plugin , but I will not use that any more. 我还使用了Shared Workspace插件 ,但是我将不再使用它。 Clone Workspace better fits my needs. 克隆工作区更适合我的需求。

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

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