推送到 GitLab 仓库不会触发 Jenkins 构建

Pushing to GitLab repo does not trigger the Jenkins build

gitlab插件版本:1.4.2

詹金斯版本:2.7.4

gitlab版本:GitLab社区版8.11.4

我已经遵循插件文档并相应地设置了 webhook

(https://github.com/jenkinsci/gitlab-plugin).

提前谢谢你。

天真

在 Jenkins 中安装和配置(全局和作业)Gitlab Hook Plugin

在你的 webhook 中你能做这个吗:

URL : http://your-jenkins-server/gitlab/notify_commit or http://your-jenkins-server/gitlab/build_now.

触发器:你检查推送事件

再试一次

要触发特定作业,URL 是: http://your-jenkins-server/gitlab/build_now/job_name

job_name是jenkins中创建的job的名字

我按照此处的说明操作,一切正常:https://github.com/jenkinsci/gitlab-plugin/wiki/Setup-Example。可以将 jenkins 作业的结果返回给 GitLab 管道。

您还可以使用 jenkins 管道推回结果:

node {
  gitlabBuilds(builds: ['Build', 'Test', 'QA']) {
    stage('Build') {
      gitlabCommitStatus(name: 'Build') {
          sh "your execution"
      }
    }
    // The rest of the stages here...
  }
}