将更改提交到TFS后,如何触发jenkins构建? [英] How to trigger jenkins build when changes are commited to TFS?

查看:387
本文介绍了将更改提交到TFS后,如何触发jenkins构建?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Jenkins中有一个maven项目(这是一个selenium-java项目),Web开发人员使用TFS,我希望在开发人员将代码更改推送到TFS后立即执行我的硒测试.

I have a maven project in Jenkins (which is a selenium- java project), web-Developers use TFS , I want to execute my selenium tests as soon as developers push their code change to TFS.

推荐答案

如果使用的是Visual Studio Team Services,则可以将代码存储在Visual Studio Team Services中,并继续使用Jenkins进行持续集成.当您将代码推送到团队项目的Git存储库中或将代码签入Team Foundation版本控制时,可以触发Jenkins构建:

If you are using Visual Studio Team Services, then you can store your code in Visual Studio Team Services and continue to use Jenkins for your continuous integration builds. You can trigger a Jenkins build when you push code to your team project's Git repository or when you check code in to Team Foundation version control:

  1. 如果尚未安装,请设置一个Jenkins服务器.如果要在本地设置Jenkins,请启用HTTPS.

  1. If you haven't already, set up a Jenkins server. If you're setting up Jenkins on-premises, enable HTTPS.

在Jenkins中,创建一个新项目.创建适合您项目的构建类型.

In Jenkins, create a new item. Create the type of build that's appropriate for your project.

在Visual Studio Team Services中设置Git存储库的URL. URL的格式为https://{VSTS account}.visualstudio.com/DefaultCollection/_git/{team project}.

Set the URL for your Git repository in Visual Studio Team Services. The URL is in the form https://{VSTS account}.visualstudio.com/DefaultCollection/_git/{team project}.

如果还没有,请在Visual Studio Team Services配置文件中启用备用凭据.请确保设置辅助用户名,因为您将无法使用电子邮件帐户将Visual Studio Team Services连接到Jenkins.

If you haven't already, enable alternate credentials in your Visual Studio Team Services profile. Be sure to set a secondary user name because you won't be able to use your email account to connect Visual Studio Team Services to Jenkins.

转到团队项目的管理页面.在服务挂钩"选项卡上,创建一个订阅.添加詹金斯.

Go to your team project's administration page. On the Service Hooks tab, create a subscription. Add Jenkins.

从Visual Studio Team Services中选择要触发Jenkins构建的事件.

Pick the event from Visual Studio Team Services that you want to trigger a Jenkins build.

配置要在Jenkins中执行的操作.现在,当该事件在Visual Studio Team Services中发生时,您的Jenkins构建将被触发.

Configure the action to take in Jenkins. Now, when that event occurs in Visual Studio Team Services, your Jenkins build will be triggered.

检查: https: //www.visualstudio.com/zh-CN/get-started/integrate/service-hooks/jenkins-and-vso-vs

这篇关于将更改提交到TFS后,如何触发jenkins构建?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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