Configuration
Updatecli requires a configuration file, or "manifest", which describes the update pipeline. A manifest describes the "what", the "when", and the "where" of the update pipeline.
What
The "what" is the "source" and defines what piece of information we’re looking for, such as the latest application release version, a docker image tag, etc.
When
The "when" is a "condition", if the condition is satisfied then the target is updated.
Where
The "where" is the "target" and defines where we want to update a piece of information like a value from a Dockerfile or YAML file.
Manifest
Root keys
A manifest accepts the following root keys. All of them are optional except name.
| Key | Type | Description |
|---|---|---|
| string | A short sentence describing the pipeline. It is reused as a default value elsewhere, such as the pull request title, so it should not embed dynamic information like a source output. |
| string | Identifies a full pipeline run, and groups manifests into the same Git branch and pull request. See Pipeline ID. |
| string | Declares a manifest identifier other manifests can depend on. See manifest order. |
| list of string | Lists the manifest |
| map of string | Arbitrary key/value pairs used to filter pipelines at runtime and in reports. See labels. |
| string | The minimum Updatecli version required by the manifest. Updatecli skips the manifest, with an error, when its own version is lower. |
| object | Settings changing how Updatecli behaves for this manifest, as opposed to describing the pipeline itself. See Options. |
| map | See source. |
| map | See condition. |
| map | See target. |
| map | Git repository configurations shared by the resources of the manifest. See scm. |
| map | What to do once a target changed, typically opening a pull request. See action. |
| object | Generates pipelines automatically instead of writing them. See autodiscovery. |
Note | title and pullrequests are deprecated in favor of name and actions. Updatecli still accepts them but logs a warning, and pullrequests and actions are mutually exclusive. |
Pipeline ID
By default, Updatecli treats each manifest file as an independent update pipeline. For reproducibility, it automatically generates a deterministic pipeline ID based on the manifest’s content. This ensures that the same manifest always gets the same pipeline ID across multiple runs.
Updatecli uses this ID in several places, such as the name of the temporary branch it creates when preparing pull requests.
If multiple manifest files share the same pipeline ID (either because they have identical content or because you explicitly set the same pipelineid), they will share the same temporary branch.
updatecli.d/docker.yaml
name: Update Golang Version in Dockerfile pipelineid: go/version ...
updatecli.d/gomod.yaml
name: Update Golang Version in Go Mod pipelineid: go/version ...
Important |
|
Manifest Order
When running multiple manifests, Updatecli can order them explicitly with the root keys id and dependson.
Use id to declare a manifest identifier, and dependson to list which manifest IDs must run first.
This affects manifest execution order only and does not replace pipelineid.
To learn more, see manifest order.
Options
The options root key groups the settings that change how Updatecli behaves for a manifest, as opposed to the keys describing what the pipeline is made of.
| Key | Default | Description |
|---|---|---|
|
| What the relative paths of the manifest resolve against. See Relative paths. |
Relative paths
By default, a relative path written in a manifest resolves against the directory Updatecli was started from, not against the manifest that declares it.
A manifest stored in updatecli.d/nodejs.yaml and asking for file: package.json therefore reads the package.json of whichever directory you happened to run the command in.
Setting relativepaths to manifest makes those paths resolve against the directory holding the manifest instead, which is what allows a manifest, or a whole directory of them, to be moved, vendored into another repository, or distributed as a policy without rewriting every path.
| Value | Behaviour |
|---|---|
| Relative paths resolve against the directory Updatecli was started from. This is the default, and the historical behaviour. |
| Relative paths resolve against the directory holding the manifest that declares them. |
updatecli.yaml
name: Keep the chart image tag in sync
options:
# "Chart.yaml" and "values.yaml" below are looked up next to this manifest,
# whatever directory updatecli was started from.
relativepaths: manifest
sources:
version:
name: Read the chart version
kind: yaml
spec:
file: Chart.yaml
key: $.version
targets:
tag:
name: Report it as the image tag
kind: yaml
spec:
file: values.yaml
key: $.image.tag
The setting applies to the manifest that declares it, so a directory of manifests can be migrated one file at a time.
It can also be set for a whole run, with the --relative-paths flag or the UPDATECLI_RELATIVE_PATHS environment variable, which is the practical way to try it on an existing repository:
updatecli diff --relative-paths manifest --config updatecli.dA manifest declaring options.relativepaths wins over the flag and the environment variable.
Important |
A source, condition, or target with an |
Within a manifest that sets relativepaths: manifest, the manifest directory becomes the base for:
the file paths of every resource without an
scmid, such asspec.fileandspec.filesthe working directory of the shell resource,
spec.workdira relative
directoryin anscmsentry, and the repository thelocalscm auto-detectsthe directory the autodiscovery crawlers scan
Absolute paths are never rewritten, and http:// or https:// locations are always fetched over the network rather than read from disk.
Note | The values, secrets, and manifest files passed on the command line with --values, --secrets, and --config are resolved against the directory Updatecli was started from, whatever relativepaths says. They are arguments to the command, not content of a manifest. |
Tip | The default stays |
File
Each Updatecli pipeline is defined in its own manifest file. The manifest is split into different stages, "sources", "conditions", "targets", where every stage relies on a plugin to adapt the behavior.
Every manifest is parsed as a Go template first, then as YAML. The following file extensions are accepted:
| Extension | Remark |
|---|---|
| The most common choice. |
| Same content as a YAML manifest, the extension only signals the templating intent. |
| JSON is a subset of YAML, so JSON manifests are accepted too. |
| CUE manifests, experimental: requires the |
Any other extension is silently ignored, which allows keeping unrelated files next to your manifests in the same directory.
Passing manifests to Updatecli
Manifests are given to the updatecli command using the flag --config (-c).
It accepts either a single file or a directory.
If a directory is specified, then Updatecli runs recursively on all supported files in that directory.
When --config is not specified, Updatecli looks, in the current directory, for:
a file named
updatecli.yaml(plusupdatecli.cuein experimental mode)a directory named
updatecli.d
Both are used if both exist. If neither is found, Updatecli falls back to the default autodiscovery crawlers.
Templating values are provided with the following flags:
| Flag | Description |
|---|---|
| A YAML or JSON file containing key/values, repeatable. |
| An inline YAML or JSON string containing key/values, repeatable. |
| A SOPS encrypted YAML or JSON file, repeatable. |
When the same key is defined more than once, the last one wins: values files are merged in order, then secrets files override them, then inline values override everything. The merge is recursive, so two values files can contribute different keys to the same nested object.
Multiple pipelines in a single file
A manifest file may contain several YAML documents separated by ---.
Updatecli loads each document as an independent pipeline.
name: Update Golang version in the Dockerfile
sources:
# ...
---
name: Update Golang version in go.mod
sources:
# ...Important | Manifest files starting with an underscore _ are considered as partial files and are not executed. More information on the partial section below. |
Partial
Partials are named, reusable fragments of an Updatecli manifest, typically used to define repeatable logic for:
Scms (e.g., Git repository details)
Sources (e.g., version checks)
Conditions
Targets
These fragments are automatically available to pipelines within the same directory, helping keep your main manifests DRY (Don’t Repeat Yourself) and maintainable.
A partial file must:
have a filename that starts with an underscore (
_)use the
.yamlor.ymlextensionlive in the same directory as the manifest that uses it. Partials from other directories are ignored, even when Updatecli walks a directory tree.
Updatecli never loads a partial as a standalone manifest.
Important |
|
updatecli.yaml
autodiscovery:
groupby: {{ .groupby }}
#{{ if or (.scm.enabled) }}
scmid: default
actionid: default
# {{ end }}
crawlers:
golang/gomod:
_scm.yaml
# {{ if and (.scm.enabled) ( eq .scm.kind "gitea")) }}
actions:
default:
title: 'deps: bump HUGO to {{ source "hugo" }}'
kind: "gitea/pullrequest"
scmid: "default"
scms:
default:
kind: "gitea"
spec:
user: '{{ .scm.user }}'
# {{ if .scm.email }}
email: '{{ .scm.email }}'
# {{ end }}
owner: '{{ .scm.owner }}'
repository: '{{ .scm.repository }}'
token: '{{ .scm.token }}'
username: '{{ .scm.username }}'
branch: '{{ .scm.branch }}'
# {{ if .scm.url }}
url: '{{ .scm.url }}'
# {{ end }}
# {{ end }}
Content
Using go templates allows us to specify generic values in a different YAML file, using --values.
We then reference those values from each go template.
More information on Go templates is here.
Template functions
On top of the standard Go template functions, a manifest can use:
all functions from the Sprig template library
the Helm-flavored
toYaml,fromYaml, andfromYamlArrayfunctionsthe Updatecli specific functions described below
| Function | Description |
|---|---|
| Injects an environment variable, and fails the run when the variable is empty or undefined, for example |
| Injects the output of another source of the same pipeline, for example |
| Injects any value from the running pipeline configuration, using a dot separated path, for example |
Important |
As a side effect, Sprig’s |
An example values file can contain:
values.yaml
github: token: yourGithubToken
That can used in a pipeline manifest as:
updatecli.yaml
sources:
sourceid:
name: Get release version from
kind: githubRelease
spec:
owner: "updatecli"
repository: "updatecli"
token: "{{ .github.token }}"
username: "olblak"
versionfilter:
kind: "latest"
conditions:
conditionID:
name: Test if version exist
kind: <resourceType>
spec:
<resourceTypeSpec>
targets:
targetID:
name: Update version in target1
kind: <resourceType>
spec:
<resourceTypeSpec>