Configuration

Updatecli must be feeded !

Updatecli requires a configuration file which defines the update strategy. A strategy can be seen as the definition of a full pipeline where we define the "what", the "when", and the "where" of our update strategy.

What

The "what" is named "source" and define what information we need, like an application release name, a docker image tag, etc.

When

The "when" is named "conditions", conditions are list things which must pass in order to proceed

Where

The "where" is named "target" and defines where we want to update an information like a a value from Dockerfile or a YAML.

Files

Updatecli reads one update strategy, aka pipeline, per file. The pipeline is split in three stages "source", "conditions", "targets", every stage use a resource that shape the pipeline and not every resource can be used in every situation.

! Please verify your need according resource documentation

A configuration accepts different type of file.

YAML

Accepted extensions: [".yaml",".yml"]

A YAML configuration can be specified using --config <yaml_file>, it accepts either a single file or a directory, if a directory is specified, then it runs recursively on every file inside the directory.

! Remark it’s a very bad practice to put credentials in a YAML file.

strategy.yaml
source:
  name: Get release version from
  kind: <resourceKind>
  spec:
    <resourceSpec>>
conditions:
  conditionID:
    name: Test if version exist
    kind: <resourceType>
    spec:
      <resourceTypeSpec>
targets:
  targetID:
    name: Update version in target1
    kind: <resourceType>
    spec:
      <resourceTypeSpec>

Go Templates

Accepted extensions: [".tpl",".tmpl"]

A go template configuration can be specified using --config <go_template_file> and --values <yaml_file>, it accepts either a single file or a directory, if a directory is specified, then it runs recursively on every go templates (or yaml file) inside the directory.

Using go templates allow us to specify generic values in a different YAML file, using --values, then reference those values from each go templates. Updatecli also provides a custom function called requireEnv to inject any environment variable in the template example, {{ requiredEnv "PATH" }}.

More information on Go templates can be found here

example.values.yaml
token: XXX
example.strategy.yaml
source:
  name: Get release version from
  kind: githubRelease
  spec:
    owner: "updatecli"
    repository: "updatecli"
    token: "{{ .github.token }}"
    username: "olblak"
    version: "latest"

conditions:
  conditionID:
    name: Test if version exist
    kind: <resourceType>
    spec:
      <resourceTypeSpec>
targets:
  targetID:
    name: Update version in target1
    kind: <resourceType>
    spec:
      <resourceTypeSpec>

Edit this page on GitHub