Igor Soloydenko
Igor Soloydenko

Reputation: 11775

How do I preinstall certain tools onto a Hosted Agent?

By default, the Hosted Agent I'm working with is not supporting yarn command but only npm. Sad, right?

Of course, I could have a step in my build pipeline that downloads and installs yarn via scoop or choco[latey] on each run, but I really don't like the idea of the build increase time for something that should be available to me out of the box.

So how do I preinstall the tools I need upfront?

Upvotes: 2

Views: 2056

Answers (3)

4c74356b41
4c74356b41

Reputation: 72151

You do not necessarily need to use a private agent -- you can run your builds in a prebuilt container. This way you can have control over a hosted agent.

resources:
  containers:
  - container: tests
    image: my/container:tests

jobs:
  - job: run_tests
    container: tests
    pool:
      vmImage: 'Ubuntu-16.04'
    steps:
    # actual build
    ...

Upvotes: 2

D.J.
D.J.

Reputation: 4034

Of course, I could have a step in my build pipeline that downloads and installs yarn via scoop or choco[latey] on each run, but I really don't like the idea of the build increase time for something that should be available to me out of the box.

This is the correct approach to install something on a build agent. If the increased time is a problem for you you could consider installing an agent on a machine of yours. But even if you use a private agent the approach to have some the installation done as a step of a build would be the correct approach

Upvotes: 0

Daniel Mann
Daniel Mann

Reputation: 58981

You don't. The hosted agent is fresh every time. There is nothing you can do to cache things on it.

If that's a requirement, you should install a private agent on a machine you control.

Upvotes: -1

Related Questions