Rediger

Del via


UseRubyVersion@0 - Use Ruby version v0 task

Use this task to select a version of Ruby to run on an agent. Optionally, the task can add the Ruby version to PATH.

Syntax

# Use Ruby version v0
# Use the specified version of Ruby from the tool cache, optionally adding it to the PATH.
- task: UseRubyVersion@0
  inputs:
    versionSpec: '>= 2.4' # string. Required. Version spec. Default: >= 2.4.
    #addToPath: true # boolean. Add to PATH. Default: true.
# Use Ruby Version v0
# Retrieves the specified version of Ruby from the tool cache. Optionally add it to PATH.
- task: UseRubyVersion@0
  inputs:
    versionSpec: '>= 2.4' # string. Required. Version spec. Default: >= 2.4.
    #addToPath: true # boolean. Add to PATH. Default: true.

Inputs

versionSpec - Version spec
string. Required. Default value: >= 2.4.

Specifies the version range or a version of a Ruby version to use.


addToPath - Add to PATH
boolean. Default value: true.

Optional. Prepends the retrieved Ruby version to the PATH environment variable to make it available in subsequent tasks or scripts without using the output variable.


Task control options

All tasks have control options in addition to their task inputs. For more information, see Control options and common task properties.

Output variables

This task defines the following output variables, which you can consume in downstream steps, jobs, and stages.

rubyLocation
The resolved folder of the Ruby distribution.

Remarks

Use this task to select a version of Ruby to run on an agent, and optionally add it to PATH.

Prerequisites

  • A Microsoft-hosted agent with side-by-side versions of Ruby installed, or a self-hosted agent with Agent.ToolsDirectory configured (see FAQ).

This task will fail if no Ruby versions are found in Agent.ToolsDirectory. See other available Ruby versions on Microsoft-hosted agents.

Where can I learn more about tool installers?

For an explanation of tool installers and examples, see Tool installers.

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 Tool Cache instructions. The tool name to use is Ruby.

Requirements

Requirement Description
Pipeline types YAML, Classic build, Classic release
Runs on Agent, DeploymentGroup
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command restrictions This task runs using the following command restrictions: restricted
Settable variables This task has permission to set the following variables: rubyLocation, PATH
Agent version 2.182.1 or greater
Task category Tool
Requirement Description
Pipeline types YAML, Classic build, Classic release
Runs on Agent, DeploymentGroup
Demands None
Capabilities This task does not satisfy any demands for subsequent tasks in the job.
Command restrictions Any
Settable variables Any
Agent version 2.115.0 or greater
Task category Tool

See also