Chaim Eliyah
Chaim Eliyah

Reputation: 2962

`npm install` times out on TFS 2015 build | dependencies are TFS-hosted Git repos

In a TFS 2015 ("XPlat") build, the npm install step hangs until timeout. Timeouts of 10, 20, and 30 minutes have been tried.

npm install fetches local dependencies defined in the package.json files as commit-ish references, e.g.,

"ui-core": "git+http://tfs:8080/tfs/DefaultCollection/etc/_git/ui-core"

I believe it is those dependencies that are causing the problem, because sometimes when I log into the build server (as the service account) and manually type npm install (in the directory of the build that timed out), the Git Credential Manager prompts me for authentication. However, the dependencies are not optional.

(No other errors are present in the event log, nor in the build log.)

We are using TFS-hosted Git, which requires domain-level authentication (Kerberos). This is handled in most of our environments by the Git Credential Manager (some people have suggested using winstore instead; please note that git-credential-manager is the replacement for winstore and wincred is not an option because TFS). However, authentication is also not optional (business requirement).

Also, note: We are running TFS 2015 Update 3, so the npm install issues solved by that update are probably not the cause (yes, all of the build agents have been updated). Edit: There was an answer here that suggested using SSH, which I fully support as a viable solution in general, but it was removed. I think that in our case the problem is that then all the developers would have to create and upload SSH publickey authentication tokens.

Has anyone else run into this issue? Is there an easy resolution I'm not finding? I'm not aware of any other credential managers that would do a better job, I don't know why the authentication gets dropped in the first place (or if there's a hack for that I'm missing), and short of keeping a copy of the repositories on another share that is manually updated (not preferable!) I can't see a good solution.

Upvotes: 0

Views: 465

Answers (1)

Chaim Eliyah
Chaim Eliyah

Reputation: 2962

Basic (re)statement of the problem: TFS 2015 builds involving npm install don't finish, because the Git Credential Manager I've configured regularly asks the service user to re-authenticate in order to access the repositories specified by the commit-ish.

Simplest solution: Remove the Git Credential Manager and use the store instead.

> git config --global --unset credential.manager
> git config credential.helper store
> git clone http://my-tfs-machine:8080/tfs/DefaultCollection/TeamProject/_git/some-repo
Username for etc.: domain\user
Password for etc.: password

...and voila, that particular error is gone.

Please note that this means the password for user is stored in plain text somewhere on the hard drive, and if that doesn't work as a solution in your domain, you'll have to find a different one.

Upvotes: 2

Related Questions