本文介绍了TFS2015.2对Jenkins的服务挂钩:代码签入时触发作业,如何传递参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我们的TFS 2015更新2的前提下,我设置了一个服务钩子,当有代码签入时触发Jenkins工作。

From our TFS 2015 update 2 on premise, i setup a service hook that trigger a Jenkins job when there is a code checkin.

工作正常并被触发当代码签入时。在作业运行之后,我查看该作业的实例,并在"更改"中查看变更集信息。选项卡,但我不知道如何获取该信息。我想将Changeset
信息传递给Jenkins工作,有办法吗?从服务挂钩,有传递参数的选项,但我找不到任何文件显示如何。在这种特殊情况下,我想将ChangesetId和Changeset注释传递给Jenkins作业,因此我可以解析并且
使用该信息执行其他操作。

The job works fine and get triggered when code check in. After the job run, I view the instance of that job and see the changeset information in the "Changes" tab but i don't know how to get that information. I would like to pass the Changeset information to Jenkins job, is there a way? From the service hook, there is option to pass parameters but I couldn't find any document show how to. In this particular case, i want to pass ChangesetId and Changeset comment to Jenkins job, so I can parse and do other things with that info.

有人可以告诉我如何?

Thkx

推荐答案

由于变更集ID可以显示在消息中。您可以使用
TFS REST API
在Jenkins方面使用此ID获取changset信息。 API如下:

As the changeset id could show in the message. You could use TFS REST API to get changset information with this id on Jenkins side. The API is as below:

GET
http://({server:port})/ DefaultCollection / _apis / tfvc / changesets / {id}?api-version = 1.0

最好的问候


这篇关于TFS2015.2对Jenkins的服务挂钩:代码签入时触发作业,如何传递参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 00:29