Use Ruby Version task
Use this task in a build or release pipeline to select a version of Ruby to run on an agent, and optionally add it to PATH.
- A Microsoft-hosted agent with side-by-side versions of Ruby installed, or a self-hosted agent with Agent.ToolsDirectory configured (see Q&A).
This task will fail if no Ruby versions are found in Agent.ToolsDirectory. Available Ruby versions on Microsoft-hosted agents can be found here.
# Use Ruby version # Use the specified version of Ruby from the tool cache, optionally adding it to the PATH - task: UseRubyVersion@0 inputs: #versionSpec: '>= 2.4' #addToPath: true # Optional
|Version spec||Version range or exact version of a Ruby version to use.|
|Add to PATH||Whether to prepend the retrieved Ruby version to the PATH environment variable to make it available in subsequent tasks or scripts without using the output variable.|
If the task completes successfully, the task's output variable will contain the directory of the Ruby installation.
This task is open source on GitHub. Feedback and contributions are welcome.
Q & A
Where can I learn more about tool installers?
For an explanation of tool installers and examples, see Tool installers.
Do I need an agent?
You need at least one agent to run your build or release. Get an agent for Linux, macOS, or Windows.
I'm having problems. How can I troubleshoot them?
I can't select a default agent pool and I can't queue my build or release. How do I fix this?
See Agent pools.
How can I configure a self-hosted agent to use this task?
You can run this task on a self-hosted agent with your own Ruby versions. To run this task on a self-hosted agent, set up Agent.ToolsDirectory by following the instructions here. The tool name to use is "Ruby."