Helm Chart

kind: helmChart

sourceconditiontarget

source

The Helm chart "source" retrieves the latest version of a Helm package.

condition

The Helm chart "condition" tests if a helm chart release exist.

target

The Helm chart "target" updates a helmchart and bump the chart metadata. It handle AppVersion, incremental version update and requirements.lock. It both works with helm chart located locally or on a git repository. If the helm chart is located locally, then chart name must be an absolute path to the chart.

Parameter

NameTypeDescriptionRequired
appversionboolean[target] Defines if AppVersion must be updated as well
filestring[target] Defines the Helm Chart file to update.
keystring[target] Defines the key within the file that need to be updated.
namestring[target] Defines the Chart name path like "stable/chart".
urlstring[source,condition] Defines the chart location URL.
valuestring[target] Defines the value to set for a key
versionstring[source,condition] Defines the Chart version, default value set based on sourceinput value
versionincrementstring[target] Defines if a Chart changes, triggers (or not) a Chart version update, accepted values is a comma separated list of "none,major,minor,patch"

Example

# updatecli.yaml
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
      versionfilter:
        kind: latest
        pattern: "11.16.5"
  chartVersion:
    name: "jenkinsci/jenkins Helm Chart used"
    kind: yaml
    scmid: default
    spec:
      file: "charts/jenkins/requirements.yaml"
      key: "dependencies[0].name"
      value: "jenkins"

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 from the Jenkins helm chart repository located on "https://charts.jenkins.io" ⇒ 2.7.1

Conditions

Then it tests two conditions.

  1. Test a helmchart condition, "Is the prometheus helm chart version "11.16.5" is available from https://prometheus-community.github.io/helm-charts? ⇒ Yes, proceed, No then abort

  2. - Test a yaml condition, "Do we have an yaml file named "charts/jenkins/requirements.yaml" with the key dependencies that contains an array where the first element is set to "jenkins" ?" ⇒ Yes, proceed, No then abort

Targets If all conditions are met, we bump the Jenkins upstream version into our local one. We remove the requirements.lock if it exists. We bump the chart version using the incremental version (patch,minor,major). Finally we commit our changes and then open a pull request on Github.

Top