简体   繁体   English

VSTS Private Agent Git设置Ubuntu 16.04

[英]VSTS Private Agent Git Setup Ubuntu 16.04

I have successfully installed a private agent on an Ubuntu 16.04 machine using a Personal Access Token. 我已经使用个人访问令牌在Ubuntu 16.04计算机上成功安装了私有代理。 I have also set it as a service and can see it online in the agent pool view. 我也将其设置为服务,并且可以在代理程序池视图中联机查看它。

I have a simple build process that gets the sources from the VSTS git repo and runs npm install. 我有一个简单的构建过程,该过程从VSTS git repo获取源并运行npm install。

The issue I am running into, is every time I queue up a build, the build fails when getting the sources with the following logs: 我遇到的问题是,每次我排队构建时,获取带有以下日志的源时构建都会失败:

2018-02-07T03:42:40.0138548Z ##[debug]Evaluating condition for step: 'Get Sources'
2018-02-07T03:42:40.0197241Z ##[debug]Evaluating: succeeded()
2018-02-07T03:42:40.0226326Z ##[debug]Evaluating succeeded:
2018-02-07T03:42:40.0287841Z ##[debug]=> (Boolean) True
2018-02-07T03:42:40.0337749Z ##[debug]Expanded: True
2018-02-07T03:42:40.0357650Z ##[debug]Result: True
2018-02-07T03:42:40.0437315Z ##[section]Starting: Get Sources
2018-02-07T03:42:40.0518369Z ##[debug]Sync source for endpoint: MyRepo
2018-02-07T03:42:40.0891895Z Syncing repository: MyRepo (TfsGit)
2018-02-07T03:42:40.1189244Z ##[debug]Get git version.
2018-02-07T03:42:40.1235446Z ##[command]git version
2018-02-07T03:42:40.1719354Z git version 2.16.1
2018-02-07T03:42:40.1739289Z ##[debug]Detect git version: 2.16.1.
2018-02-07T03:42:40.1868659Z ##[debug]Set git useragent to: git/2.16.1 (vsts-agent-git/2.127.0).
2018-02-07T03:42:40.1943157Z ##[debug]Checking if the repo on /home/ubuntu/mydns_agent/_work/1/s matches the expected repository origin URL. expected Url: https://mydns.visualstudio.com/_git/MyRepo
2018-02-07T03:42:40.1999272Z ##[debug]Inspect remote.origin.url for repository under /home/ubuntu/mydns_agent/_work/1/s
2018-02-07T03:42:40.2012659Z ##[command]git config --get remote.origin.url
2018-02-07T03:42:40.2201001Z ##[debug]Get remote origin fetch url from git config: https://mydns.visualstudio.com/_git/MyRepo
2018-02-07T03:42:40.2214867Z ##[debug]Repository remote origin fetch url is https://mydns.visualstudio.com/_git/MyRepo
2018-02-07T03:42:40.2228628Z ##[debug]URLs match.
2018-02-07T03:42:40.2281440Z ##[debug]Disable git auto garbage collection.
2018-02-07T03:42:40.2326193Z ##[command]git config gc.auto 0
2018-02-07T03:42:40.2477896Z ##[debug]Checking git config http.https://mydns.visualstudio.com/_git/MyRepo.extraheader exist or not
2018-02-07T03:42:40.2491462Z ##[command]git config --get-all http.https://mydns.visualstudio.com/_git/MyRepo.extraheader
2018-02-07T03:42:40.2617723Z ##[debug]Checking git config http.proxy exist or not
2018-02-07T03:42:40.2630997Z ##[command]git config --get-all http.proxy
2018-02-07T03:42:40.2836911Z ##[debug]Fetch git repository at: /home/ubuntu/mydns_agent/_work/1/s remote: origin.
2018-02-07T03:42:40.2887285Z ##[command]git -c http.extraheader="AUTHORIZATION: bearer ********" fetch --tags --prune --progress --no-recurse-submodules origin
2018-02-07T03:42:40.7397033Z remote: TF401019: The Git repository with name or identifier MyRepo does not exist or you do not have permissions for the operation you are attempting.
2018-02-07T03:42:40.7410924Z fatal: repository 'https://mydns.visualstudio.com/_git/MyRepo/' not found
2018-02-07T03:42:40.7632023Z ##[error]Git fetch failed with exit code: 128
2018-02-07T03:42:40.7705786Z ##[debug]System.InvalidOperationException: Git fetch failed with exit code: 128
   at Microsoft.VisualStudio.Services.Agent.Worker.Build.GitSourceProvider.<GetSourceAsync>d__22.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.Services.Agent.Worker.Build.BuildJobExtension.<GetSourceAsync>d__17.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.Services.Agent.Worker.JobExtensionRunner.<RunAsync>d__20.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.Services.Agent.Worker.StepsRunner.<RunStepAsync>d__1.MoveNext()
2018-02-07T03:42:40.7734543Z ##[section]Finishing: Get Sources

I have tried installing the git-credential-manager as well but that did not seem to fix the issue. 我也尝试安装git-credential-manager,但这似乎无法解决问题。 I have also double checked the PAT has the correct permissions (All for now). 我还仔细检查了PAT是否具有正确的权限(目前全部)。

Is there something I missed? 有什么我想念的吗? Not quite sure why the agent wouldnt be able to even clone the repo? 不太确定为什么代理甚至无法克隆回购协议?

Any help would be appreciated. 任何帮助,将不胜感激。

You can trouble shooting the issue with below aspects: 您可以从以下几个方面解决问题:

  1. Install git-lfs 安装git-lfs

    Git-lfs id necessary for VSTS agent, so you can install git-lfs based on the installation document . VSTS代理所需的Git-lfs ID,因此您可以根据安装文档安装git-lfs。

    After installing git-lfs, you can add the installed directory in your agent capability: 安装git-lfs之后,您可以在代理功能中添加已安装的目录:

    Agent pools page ( https://account.visualstudio.com/_admin/_AgentPool ) -> select the agent -> Capabilites Tab -> add capability. 代理程序池页面( https://account.visualstudio.com/_admin/_AgentPool )->选择代理程序-> Capabilites选项卡->添加功能。

    在此处输入图片说明

  2. Add a variable to get detail build logs 添加变量以获取详细的构建日志

    You can add the variable system.debug with the value true in your build definition, then you will get more detail build information to debug the issue. 您可以在构建定义中添加值为true的变量system.debug ,然后您将获得更多详细的构建信息以调试问题。

    在此处输入图片说明

  3. Clean build directories if you are set clean as false in Get Sources step 如果在“获取源代码”步骤中将clean设置为false,则清理构建目录

    You can clean all build directories in Get sources step and try again: 您可以在“获取源代码”步骤中清理所有构建目录,然后重试:

    在此处输入图片说明

  4. Update your agent to latest version 将您的代理更新到最新版本

    Based on your log, the agent version is 2.127.0, while the latest for now is 2.129.0. 根据您的日志,代理版本为2.127.0,而目前的最新版本为2.129.0。 So you can download the latest agent from VSTS web page, and config again. 因此,您可以从VSTS网页下载最新的代理,然后再次进行配置。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM