geeklearningio / gl-vsts-tasks-yarn

Yarn Package Manager Visual Studio Team Services Build and Release Management extensions
MIT License
52 stars 18 forks source link

[Mitigated] Yarn Install adds npm as demand #47

Closed AStoker closed 5 years ago

AStoker commented 6 years ago

Are you reporting a bug or a 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:

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:

Agent:

OS:

Yarn version: 2.4.999 Node version: 8.11.1

sandorfr commented 6 years ago

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.

AStoker commented 6 years ago

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?

sandorfr commented 6 years ago

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

AStoker commented 6 years ago

Any idea on a work around until this is resolved?

sandorfr commented 6 years ago

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

sandorfr commented 6 years ago

FYI I've asked vsts tools team how to handle such case https://github.com/Microsoft/vsts-task-lib/issues/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.

sandorfr commented 6 years ago

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