Variables File

To not repeat yourself (DRY,) we can define some variables in a var file and use the vars in the config file.

You can specify the path/to/your/variablesFile.yaml in the main config. See the config section for more details.

Default Variables File

No default variables file will be loaded. You must specify which var file to use explicitly in the main config.

Using a Variables File

To use these variables in a config file, use the following syntax:

  1. [[ varNameHere ]]

Example Config File with the Use of Variables

variables.yaml:

  1. gitlabUser: ironcore864
  2. defaultBranch: main
  3. gitlabCIGolangTemplate: https://gitlab.com/ironcore864/go-hello-world/-/raw/main/go.tpl

Example tool file with the variables defined in the above variables.yaml:

tools.yaml:

  1. tools:
  2. - name: gitlabci-generic
  3. instanceID: default
  4. options:
  5. pathWithNamespace: [[ gitlabUser ]]/go-hello-world
  6. branch: [[ defaultBranch ]]
  7. templateURL: [[ gitlabCIGolangTemplate ]]
  8. templateVariables:
  9. App: hello

DevStream will render the config with the provided var file. After rendering, the config above is equivalent to the following content:

  1. tools:
  2. - name: gitlabci-generic
  3. instanceID: default
  4. options:
  5. pathWithNamespace: ironcore864/go-hello-world
  6. branch: main
  7. templateURL: https://gitlab.com/ironcore864/go-hello-world/-/raw/main/go.tpl
  8. templateVariables:
  9. App: hello