Tool Versions

kind: toolversions

sourceconditiontarget

Description

source

The ToolVersions "source" retrieves an information from a .tool-versions file.

condition

The ToolVersions "condition" tests that an information exist in a .tool-versions file.

target

The ToolVersions "target" ensures that a .tool-versions file content a specific value at specific location.

Parameters

NameTypeDescriptionRequired
createmissingkeyboolean[t] CreateMissingKey allows non-existing keys. If the key does not exist, the key is created if AllowsMissingKey is true, otherwise an error is raised (the default). Only supported if Key is used
filestring[s][c][t] File specifies the .tool-versions file to manipulate
filesarray[c][t] Files specifies a list of .tool-versions file to manipulate
keystring[s][c][t] Key specifies the query to retrieve an information from a .tool-versions file
valuestring[s][c][t] Value specifies the value for a specific key. Default to source output

Example

# updatecli.yaml
name: Basic .tool-versions Example

scms:
  default:
    kind: git
    spec:
      url: https://github.com/asdf-vm/asdf.git

sources:
  local:
    name: Get value from .tool-versions
    kind: toolversions
    scmid: default
    spec:
      file: .tool-versions
      key: bats
  http:
    name: Get value from .tool-versions
    kind: toolversions
      file: https://raw.githubusercontent.com/updatecli/updatecli/master/pkg/plugins/resources/toolversions/testdata/.tool-versions
      key: bats

conditions:
  local:
    name: Test value from .tool-versions
    kind: toolversions
    sourceid: local
    scmid: default
    spec:
      file: .tool-versions
      path: bats
  http:
    name: Test value from .tool-versions
    kind: toolversions
    disablesourceinput: true
    spec:
      file: https://raw.githubusercontent.com/updatecli/updatecli/master/pkg/plugins/resources/toolversions/testdata/.tool-versions
      path: bats
      value: "1.0.0"

targets:
  local:
    name: Ensure bats is set to "1.8.2" in the .tool-versions file
    kind: toolversions
    sourceid: local
    scmid: default
    spec:
      file: .tool-versions
      key: bats
      value: "1.8.2"

Top