1
votes

I have successfully installed a private agent on an Ubuntu 16.04 machine using a Personal Access Token. 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.

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. I have also double checked the PAT has the correct permissions (All for now).

Is there something I missed? Not quite sure why the agent wouldnt be able to even clone the repo?

Any help would be appreciated.

1
Does your build service account has the permission to read the repository?Eddie Chen - MSFT

1 Answers

0
votes

You can trouble shooting the issue with below aspects:

  1. Install git-lfs

    Git-lfs id necessary for VSTS agent, so you can install git-lfs based on the installation document.

    After installing git-lfs, you can add the installed directory in your agent capability:

    Agent pools page (https://account.visualstudio.com/_admin/_AgentPool) -> select the agent -> Capabilites Tab -> add capability.

    enter image description here

  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.

    enter image description here

  3. Clean build directories if you are set clean as false in Get Sources step

    You can clean all build directories in Get sources step and try again:

    enter image description here

  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. So you can download the latest agent from VSTS web page, and config again.