简体   繁体   English

Jenkins使用Gitlab Webhook构建触发器

[英]Jenkins Build Trigger with Gitlab Webhook

I am able to generate build trigger url and able to call build operation via Gitlab Web hook. 我能够生成构建触发器URL,并能够通过Gitlab Web挂钩调用构建操作。

But the build operation is calling in each commit irrespective of any branch. 但是构建操作正在调用每个提交,而与任何分支无关。 But I want to trigger build operation for a specific branch commit. 但是我想触发特定分支提交的构建操作。 Means want to execute build only if any code pushed to a specific branch. 意味着仅在将任何代码推送到特定分支时才执行构建。

In Gitlab yaml you can specify each job to trigger on certain branches or excluding branches 在Gitlab Yaml中,您可以指定要在某些分支或排除分支上触发的每个作业

https://docs.gitlab.com/ee/ci/yaml/#only-and-except https://docs.gitlab.com/ee/ci/yaml/#only-and-except

job_name:
  script:
    - rake spec
    - coverage
  stage: test
  only:
    - master
  tags:
    - ruby
    - postgres
  allow_failure: true

The above yaml would only execute on master 上面的yaml仅在master上执行

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

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