简体   繁体   English

保存构建定义在Visual Studio Team Service中出错

[英]Saving build definition is giving error in Visual Studio Team Service

I have started build automation using vs team service. 我已经使用vs团队服务开始构建自动化。 I have linked my github repositories with Visual Studio Team Services through personal access token. 我已经通过个人访问令牌将我的github存储库与Visual Studio Team Services相关联。

Now I am able to select github repositories in Visual Studio Team Services. 现在我可以在Visual Studio Team Services中选择github存储库。 But while saving build definitions it is giving following error: 但是在保存构建定义时,它会给出以下错误:

Unable to configure a service on the selected GitHub repository. 无法在选定的GitHub存储库上配置服务。 This is likely caused by not having the necessary permission to manage hooks for the selected repository. 这可能是由于没有必要的权限来管理所选存储库的挂钩。

Can anyone please help me how to resolve this error. 任何人都可以帮我解决这个错误。 Do we need to buy any service for build automation? 我们是否需要为构建自动化购买任何服务?

Thanks in advance. 提前致谢。

There's another situation that also provokes this issue, specifically related to configuring the Continuous Integration trigger. 还有另一种情况也会引发此问题,特别是与配置持续集成触发器有关。

I have a github account with my own repos, but I'm also a collaborator on a different project (which is a personnel not an organization repo). 我有一个github帐户和我自己的回购,但我也是一个不同项目的合作者(这是一个人员而非组织回购)。

GH allows me to create a personal access token and VSO considers it valid for use when configuring the Repository options on the build definition but it does not have the appropriate rights to create a Continuous Integration trigger acting as collaborator to the other private repo. GH允许我创建个人访问令牌,VSO认为它在构建定义上配置存储库选项时有效,但它没有相应的权限来创建作为其他私有存储库的协作者持续集成触发器。

The reason is that triggering notification is performed using GitHub Web Hooks . 原因是使用GitHub Web Hooks执行触发通知。 It appears that when first creating the CI trigger, VSO initiates a request into the GH API to subscribe to the push event for the requested repo ... except that the personal access token includes the admin:repo_hook right for your own repo(s), not any for which you are a collaborator as this right cannot be delegated for a personal account. 看来,当第一次创建CI触发器时,VSO向GH API发起请求以订阅所请求的repo的push事件...除了个人访问令牌包括admin:repo_hook权限用于您自己的repo(s) ,不是您作为合作者的任何一方,因为此权利不能委托给个人帐户。

It took me a bit of experimentation to figure this out. 我花了一些实验来解决这个问题。 8-} 8}

Within this context, I think there are two possible solutions: 在这种情况下,我认为有两种可能的解决方案:

  1. Ask the repo owner to generate and provide you his personal access token with an appropriately narrow scope of rights; 要求回购所有者生成并提供他的个人访问令牌,其权利范围适当狭窄;
  2. Transfer ownership of the repo to an organization, be granted appropriate rights as a member of that organization, and then create your VSO endpoint using your GH user credentials instead of a PAT. 将回购的所有权转让给组织,作为该组织的成员授予适当的权利,然后使用GH用户凭证而不是PAT创建您的VSO端点。

HTH. HTH。

You can only build the github repositories hosted in VS Team Service which you are authorized to push to. 您只能构建您有权推送到的VS Team Service中托管的github存储库。

Two ways: 两种方式:

Connect using your GitHub user account 使用您的GitHub用户帐户进行连接

  1. On the Repository tab, next to the Connection drop-down, click the Manage link. 在“存储库”选项卡上的“连接”下拉列表旁边,单击“管理”链接。 The Services tab opens as a new tab in your browser. “服务”选项卡将作为浏览器中的新选项卡打开。

    a.Click New Service Endpoint and choose GitHub. a。单击New Service Endpoint并选择GitHub。

    b.In the Add New GitHub Service Connection dialog box, select Grant authorization, and then click Authorize. b。在“添加新GitHub服务连接”对话框中,选择“授予授权”,然后单击“授权”。

    c.In the new browser window, sign in to GitHub and follow the instructions to authorize Visual Studio Team Services to access your GitHub account. c。在新的浏览器窗口中,登录GitHub并按照说明授权Visual Studio Team Services访问您的GitHub帐户。

  2. On the Repository tab, select the Connection you created. 在“存储库”选项卡上,选择您创建的“连接”。

  3. Select the Repository that contains the code you want to build. 选择包含要构建的代码的存储库。

Connect using a personal access token 使用个人访问令牌进行连接

  1. Sign in to GitHub and make sure you have permission to read the repository. 登录GitHub并确保您有权读取存储库。
  2. In GitHub, create an access token. 在GitHub中,创建一个访问令牌。

    a.Select the repo, user, and admin:repo_hook scopes. a。选择repo,user和admin:repo_hook范围。

    b.Copy the token to your clipboard. b。将令牌复制到剪贴板。

  3. Sign on to Team Services and create a build definition. 登录Team Services并创建构建定义。

  4. On the Repository tab, next to the Connection drop-down, click the Manage link. 在“存储库”选项卡上的“连接”下拉列表旁边,单击“管理”链接。 The Services tab opens as a new tab in your browser. “服务”选项卡将作为浏览器中的新选项卡打开。

    a.Click New Service Endpoint and choose GitHub. a。单击New Service Endpoint并选择GitHub。

    b.In the Add New GitHub Service Connection dialog box, select Personal access token. b。在“添加新GitHub服务连接”对话框中,选择“个人访问令牌”。

    c.Paste the token and give the connection a name. c。粘贴令牌并为连接命名。

  5. On the Repository tab, select the Connection you created. 在“存储库”选项卡上,选择您创建的“连接”。

  6. Select the Repository that contains the code you want to build. 选择包含要构建的代码的存储库。

More details you can refer the link from MSDN: Specify the repository - GitHub 更多细节,您可以参考MSDN中的链接: 指定存储库 - GitHub

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Visual Studio Team Services构建定义-如何复制源文件夹 - Visual Studio Team Services Build Definition - How to Copy sources folder Visual Studio Team Services:为.netcore 1.1创建构建定义 - Visual Studio Team Services: create build definition for .netcore 1.1 Visual Studio Team Services:构建错误(无法解析程序集引用) - Visual Studio Team Services: Build Error (Assembly reference cannot be resolved) Visual Studio Team Services使用外部dll构建 - Visual Studio Team Services build with external dll MVC 5构建在Visual Studio Team Services上失败 - MVC 5 build failing on Visual Studio Team Services 代码约定 - Visual Studio Team Service脚本构建服务器单元测试失败 - Code Contracts - Visual Studio Team Service Scripted Build Server Unit Tests Fail “ System.Web.http”版本上的Visual Studio Team Services构建错误 - Visual Studio Team Services Build Error on “System.Web.http” version 在Visual Studio Team Services托管的构建代理上的.net v5.4项目中构建dapper时出错 - Error building dapper in a .net v5.4 project on visual studio team services hosted build agent Visual Studio构建错误 - Visual studio Build Error IIS的Visual Studio Team Services asp.net核心版本 - Visual Studio Team Services asp.net core build for IIS
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM