VSTS私人代理Git设置Ubuntu 16.04

时间:2018-02-07 02:52:09

标签: git azure-devops azure-pipelines

我已使用个人访问令牌在Ubuntu 16.04计算机上成功安装了私有代理。我还将其设置为服务,并可以在代理池视图中在线查看。

我有一个简单的构建过程,它从VSTS git repo获取源代码并运行npm install。

我遇到的问题是,每次我排队构建时,构建都会在获取具有以下日志的源时失败:

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

我也尝试过安装git-credential-manager,但似乎没有解决问题。我还仔细检查了PAT是否具有正确的权限(All for now)。

我错过了什么吗?不太清楚为什么代理人甚至无法克隆回购?

任何帮助都将不胜感激。

1 个答案:

答案 0 :(得分:0)

您可以通过以下方面解决问题:

  1. 安装git-lfs

    VSTS代理所需的Git-lfs id,因此您可以根据installation document安装git-lfs。

    安装git-lfs后,您可以在代理功能中添加已安装的目录:

    代理商池页面(https://account.visualstudio.com/_admin/_AgentPool) - &gt;选择代理 - &gt; Capabilites标签 - &gt;增加能力。

    enter image description here

  2. 添加变量以获取详细构建日志

    您可以在构建定义中添加值system.debug的变量true,然后您将获得更多详细信息构建信息以调试问题。

    enter image description here

  3. 如果在“获取来源”步骤中将clean设置为false,则清理构建目录

    您可以在“获取源”步骤中清除所有构建目录,然后重试:

    enter image description here

  4. 将您的座席更新为最新版本

    根据您的日志,代理版本为2.127.0,而最新版本为2.129.0。因此,您可以从VSTS网页下载最新的代理,然后重新配置。

相关问题