sourceconditiontarget

Description

The helmchart resource works at two levels, and which one applies depends on the stage:

source and condition

Talk to a chart repository. The source returns the latest version of a published chart; the condition checks that version exists there.

target

Works on a chart in your repository. It updates a value in the chart’s values.yaml, then maintains the chart’s own metadata (bumping version, optionally appVersion, and refreshing requirements.lock).

That asymmetry is the thing to keep in mind: url addresses the remote repository and is read-only, while name and key address the local chart the target rewrites.

Parameters

NameTypeDescriptionRequired
appversionboolean

AppVersion defines if a Chart changes, triggers, or not, a Chart AppVersion update. The value is retrieved from the source input.

compatible: * target

default false

filestring

file defines the Helm Chart file to update. the path must be relative to chart root directory the chart name is defined by the parameter “name”

compatible: * source * condition * target

default: default set to “values.yaml”

keystring

key defines the yamlpath query used for retrieving value from a YAML document

compatible: * target

example: * key: $.image.tag * key: $.images[0].tag

remark: * key is a simpler version of yamlpath accepts keys.

namestring

name defines the Chart name path like ‘stable/chart’.

compatible: * source * condition * target

example: * name: stable/chart

remark: * when used with a scm, the name must be the relative path from the scm repository root directory with such as “stable/chart”

passwordstring

password specifies the container registry password to use for authentication. Not compatible with token

compatible: * source * condition * target

default: by default credentials are fetch from the local environment such as ~/.docker/config.json.

remark: Not compatible with token

skippackagingboolean

skippackaging defines if a Chart should be packaged or not.

compatible: * target

default: false

tokenstring

token specifies the container registry token to use for authentication.

compatible: * source * condition * target

default: by default credentials are fetch from the local environment such as ~/.docker/config.json.

remark: Not compatible with username/password

urlstring

url defines the Chart location URL.

compatible: * source * condition

example: * index.yaml * file://./index.yaml * https://github.com/updatecli/charts.git * oci://ghcr.io/olblak/charts/

usernamestring

username specifies the container registry username to use for authentication.

compatible: * source * condition * target

default: by default credentials are fetch from the local environment such as ~/.docker/config.json.

remark: Not compatible with token

valuestring

value is the value associated with a yamlpath query.

compatible: * condition * target

versionstring

version defines the Chart version. It is used by condition to check if a version exists on the registry.

compatible: * condition

versionfilterobject

versionfilter provides parameters to specify version pattern and its type like ‘regex’, ‘semver’, or just ’latest’.

compatible: * source

default: semver

remark: * Helm chart uses semver by default.

    kindstringspecifies the version kind such as semver, regex, or latest
    patternstringspecifies the version pattern according the version kind for semver, it is a semver constraint for regex, it is a regex pattern for time, it is a date format
    regexstringspecifies the regex pattern, used for regex/semver and regex/time. Output of the first capture group will be used.
    replaceallobjectreplaceAll applies a regex replacement to version strings before filtering. This is useful for transforming versions (e.g., curl-8_15_0 to curl-8.15.0) before regex extraction.
    strictbooleanstrict enforce strict versioning rule. Only used for semantic versioning at this time
versionincrementstring

versionIncrement defines if a Chart changes, triggers, or not, a Chart version update, accepted values is a comma separated list of “none,major,minor,patch,auto”.

compatible: * target

default: default set to “minor”

remark: when multiple pipelines update the same chart, the versionIncrement will be applied multiple times. more information on https://github.com/updatecli/updatecli/issues/693

name

The chart, as stable/chart. With an scm, it is the path to the chart relative to the repository root.

file

Defaults to values.yaml, resolved relative to the chart root (not to the repository root).

key

Target only. The yamlpath of the value to update, e.g. $.image.tag.

url

Source and condition only. Accepts a repository index, a git URL, or an OCI registry:

index.yaml
file://./index.yaml
https://github.com/updatecli/charts.git
oci://ghcr.io/olblak/charts/
version

Condition only.

Credentials for an OCI registry are given inline on the spec, next to the other fields, rather than under a nested key.

Version bumping

versionincrement controls what happens to the chart’s own version when a target changes something. It defaults to minor, and accepts a comma-separated list of none, major, minor, patch and auto.

Warning

The increment is applied per target. When several targets in the same pipeline update the same chart, the chart version is bumped once for each of them - three targets with the default minor move a chart from 1.0.0 to 1.3.0. Use versionincrement: none on all but one of them, and see updatecli#693.

appversion: true also writes the source value into the chart’s appVersion field (the usual choice when the chart ships one application whose image tag you are bumping).

skippackaging: true updates the files without packaging the chart afterwards.

Version filtering

Unlike most resources, versionfilter defaults to semver here rather than to the generic filter, since charts are required to carry semantic versions. See the "Version Filtering" page.

Example

# updatecli.yaml
name: Example of Helm Chart resources

scms:
  default:
    kind: github
    spec:
      user: "john"
      email: "john@example.com"
      owner: "olblak"
      repository: "charts"
      token: "{{ requiredEnv .github.token }}"
      username: "john"
      branch: "master"

sources:
  lastRelease:
    kind: helmchart
    spec:
      url: https://charts.jenkins.io
      name: jenkins

conditions:
  isPrometheuseHelmChartVersionAvailable:
    name: "Test if the prometheus helm chart is available"
    kind: helmchart
    spec:
      url: https://prometheus-community.github.io/helm-charts
      name: prometheus
      version: "11.16.5"

targets:
  chartjenkins:
    name: Bump Jenkins Upstream Chart Version
    kind: helmchart
    spec:
      name: "charts/jenkins"
      file: "requirements.yaml"
      key: "dependencies[0].version"
      versionincrement: minor

What it says:

Source

Retrieve the version of the Jenkins chart from https://charts.jenkins.io (2.7.1).

Condition

Check that version 11.16.5 of the prometheus chart is available from https://prometheus-community.github.io/helm-charts. If not, the pipeline stops.

Target

Bump the upstream version into the local chart, drop requirements.lock if present, increment the chart version, then commit and open a pull request on GitHub.