geeklearningio / gl-vsts-tasks-yarn

Yarn Package Manager Visual Studio Team Services Build and Release Management extensions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Mitigated] Yarn Install adds npm as demand

AStoker opened this issue · comments

Are you reporting a bug or a feature request ?

  • Bug
  • Feature request

Description

When adding 'Yarn Task' to install dependencies using yarn, it adds npm as a demand the build agent must have. This doesn't seem right, since Yarn is not NPM, and it ultimately fails with the message

No agent found in pool Default which satisfies the specified demands:
msbuild
visualstudio
npm
Agent.Version -gtVersion 1.95.0

Everything exists on the server except npm. Our build steps include:

  • Use Node 8.x
  • Use Yarn 1.x
  • Yarn Install

As soon as the Yarn Install task is added, npm appears as a demand.

Expected behavior

NPM should not be listed as a demand if it's not being used

Reproduction

  1. Create a new build definition
  2. Add a Yarn task
  3. See npm as a demand

(No logs to report other than already mentioned)

System information

VSTS or TFS:

  • VSTS
  • TFS

Agent:

  • Hosted
  • Custom

OS:

  • Windows
  • Mac
  • Linux

Yarn version:
2.4.999
Node version:
8.11.1

It should be a Node demand indeed. However that would be breaking for the people relying on the node version that comes with hosted agents.

A Node demand, absolutely (that's why I have the use node task there). But npm isn't node, it's the node package manager, and what Yarn replaces.
Not entirely following the second part, what would be the breaking change?

Because the registered capability on hosted agents is Node.Js instead of Node

Any idea on a work around until this is resolved?

you have two options, install a version of node on your agent or manually add the capability npm to your agents.

FYI I've asked vsts tools team how to handle such case microsoft/azure-pipelines-task-lib#351

I'm afraid I'll have to remove any demands (and let it fail) or require people to use the Use Node task no matter if they have node installed already.

I forgot to update you, I removed the demand as there's no obvious solution to keep one that works for everyone.