配置Jenkins CI构建以使用Azure DevOps中托管的TFVC [英] Configure Jenkins CI build to use TFVC hosted in Azure DevOps
问题描述
我们最近从本地TFS服务器迁移到Azure DevOps。我们的团队使用TFVC进行源代码控制,当詹金斯(Jenkins)轮询新签入内容时,我得到以下异常:
We recently migrated from an on-premise TFS server to Azure DevOps. Our team uses TFVC for source control, and I'm getting the following exception when Jenkins polls for new check-ins:
FATAL:服务器需要联合身份验证,但是没有可用的机制来处理它。
com.microsoft.tfs.core.exceptions.TFSFederatedAuthException:该服务器需要联合身份验证,但是没有可用的机制来处理它。
FATAL: This server requires federated authentication but no mechanism was available to handle it. com.microsoft.tfs.core.exceptions.TFSFederatedAuthException: This server requires federated authentication but no mechanism was available to handle it.
鉴于异常类名称为 TFSFederatedAuthException
,我怀疑Azure期望进行某种OAuth集成,但Jenkins似乎不支持TFVC。
Given the exception class name is TFSFederatedAuthException
I suspect Azure is expecting some sort of OAuth integration, but Jenkins doesn't appear to support that for TFVC.
我所做的就是将Jenkins构建的 Collection URL 更改为 https://dev.azure.com/MyCompany
。 项目路径保持不变,我对此进行了验证,因为我能够通过指向不同的集合URL并保持相同的项目路径来重新映射Visual Studio中的所有TFVC分支。 Jenkins源代码管理配置的屏幕截图如下:
All I did was change the Collection URL for that Jenkins build to https://dev.azure.com/MyCompany
. The Project path remains the same, and I verified this, because I was able to re-map all of my TFVC branches in Visual Studio by just pointing to the different collection URL and keeping the same project path. A screenshot of the Jenkins source control config is below:
此Jenkins服务器是内部服务器,没有公开的IP地址或主机名。
This Jenkins server is internal with no public facing IP address or host name.
我如何允许Jenkins轮询托管的TFVC存储库
为什么在Azure DevOps中触发CI生成?为什么不使用Azure管道?目前,这是一项更大的迁移工作,我只是想解决一个短期问题。
Why not use Azure pipelines? That's a much bigger migration effort at the moment, and I'm just trying to solve a short term problem.
使用Azure管道是我的长期目标,但我需要弄清楚我们的自动化测试如何首先使用Oracle数据库,因为在使用Selenium执行每次测试之前,所有数据都已删除。
Using Azure pipelines is my long term goal, but I need to figure out how our automated tests can use an Oracle database first, because all data is deleted before each test is executed using Selenium.
推荐答案
Azure DevOps默认使用OAuth进行通信,因此输入用户名和密码将不起作用。相反,诀窍是生成一个个人访问令牌(我怀疑 Code | Read + Write
作用域应该这样做)并将其传递进来。
Azure DevOps uses OAuth to communicate by default, putting in your username and password won't work because of that. Instead, the trick is to generate a Personal Access Token (I suspect the Code|Read+Write
scope should do it) and pass that in.
对于用户名,输入。
,作为您生成的个人访问令牌的密码。给令牌命名一个好名字,以便您在收到电子邮件通知后知道哪个令牌即将过期。
For the username pass in .
, for the password your generated personal access token. Give the token a nice name so you know which one is about to expire once you get the email notification.
这篇关于配置Jenkins CI构建以使用Azure DevOps中托管的TFVC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!