提交到存储库后构建Jenkins Job [英] Build Jenkins Job after commit to repository

查看:169
本文介绍了提交到存储库后构建Jenkins Job的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的存储库和Jenkins Job之间建立一个集成.想法是,在将某些内容提交或推送到指定的存储库后,指定的jenkins作业应立即开始构建.有类似的主题点击,但我不明白.如何正确配置? 我的存储库位于RhodeCode Enterprise 4.3.1 Community Edition上 我想,我需要在存储库中创建webhook,然后配置我的jenkins作业.这是我在存储库中看到的内容: 这是詹金斯工作的构建触发器"部分: 因此,我想令牌应该是相同的,并且webhook网址应该是jenkins工作的网址?我说的对吗?

I want to have a integration between my repository and Jenkins Job. The idea is that, after commit or push something into specified repository, the specified jenkins job should immediately starts build. There was similar topic click, but i don't get it. How to configure this correctly? My repository is on RhodeCode Enterprise 4.3.1 Community Edition I guess, that I need to create webhook in my repository and then configure my jenkins job. Here is what I see in my repository: And here is, section "Build Triggers" of the jenkins job: So, i guess that token should be the same, and the webhook url should be url to jenkins job? Am I right?

推荐答案

是的,您必须选择push event,并输入Jenkins构建的URL. 必须在Jenkins中进行配置,例如,构建网址可以是: http://server/job/ourProjectName/build

Yes you have to select push event, and enter the url for Jenkins build. The has to be configured in Jenkins, eg build url can be: http://server/job/ourProjectName/build

自RhodeCode 4.5.X起,在构建网址中就有模板,因此您可以使用 http://server/job/ $ {repo_name}/build?

Since RhodeCode 4.5.X there are templates in the build url, so you can create a catch-all webhooks, in the format of http://server/job/${repo_name}/build?

甚至提交分支机构:

http://server/job/ $ {repo_name}/buildWithParameters?token = TOKEN& BRANCH = $ {branch}

http://server/job/${repo_name}/buildWithParameters?token=TOKEN&BRANCH=${branch}

在您的Jenkins安装中需要TOKEN.

TOKEN is required from your Jenkins installation.

因此,通过这种方式,您可以为不同的分支机构提供不同的工作

So in this way you can have different jobs for different branches

在此处详细了解如何在詹金斯方面配置参数: https://wiki.jenkins-ci.org/display/JENKINS/Parameterized+Build

Check more here how to configure parameters on Jenkins side: https://wiki.jenkins-ci.org/display/JENKINS/Parameterized+Build

这篇关于提交到存储库后构建Jenkins Job的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆