Skip to content

v2 Configuration

Fabian Holler edited this page Apr 6, 2021 · 1 revision

Version 2.x Configuration

Table of Content

Format

baur configuration files are in TOML format. General information about the syntax can be found at: https://toml.io.

Include References

Include references are used in include fields. The format is: FILEPATH#INCLUDE_ID.
FILEPATH must be relative to the repository root.
INCLUDE_ID is an identifier that is specified in the include section

.baur.toml Repository Configuration File

Generation

A .baur.toml file can be generated by running:

baur init repo

All values in the commented config are examples and not the default values.

Top Level

  • config_version
    An internal field, describes the format of the baur configuration files. It is increased on non-backwards compatible changes.

[Database]

  • postgresql_url
    URL to a PostgreSQL database in that information about past task runs are stored.
    It is overwritten by the environment variable BAUR_POSTGRESQL_URL.

[Discover]

  • application_dirs
    Directories in which .app.toml application configuration files are discovered. These must be sub-directories of the directory that contains the .baur.toml file.

  • search_depth
    Descend search_depth levels of directories below an application_dirs path.

.app.toml Application Configuration File

Generation

A .app.toml file can be generated by running:

baur init app

All values in the commented config are examples and not the default values.

Top Level

  • name
    Name of the Application
    Required

  • includes
    A list of task include references. The Task defined in the include are added added to the application definition. \

[[Task]]

  • name
    Name of the Task
    Required

  • command
    The command that is executed when the task runs. The first element in the list is the binary to execute. The following ones are arguments. If the first element contains no path separators, it's path is looked up via the $PATH environment variable.
    The command is run in the application directory.
    Required
    Default: []

  • includes
    A list of include references for Input or Output include sections.
    Default: []

[[Task.Input]]

Defines the Inputs that are tracked for the task.
Tasks are run if no recorded run exist with the same Inputs. A task must define at least 1 Input.

[[Task.Input.File]]
  • paths
    List of glob file path patterns to match files that are tracked.
    All paths are relative to the repository root.
    Pattern are in Golang's Glob syntax https://golang.org/pkg/path/filepath/#Match. Additionally the pattern ** is supported. It matches files recursively.
    Default: []

  • optional
    Don't fail if a pattern resolves to 0 files.
    Default: false

  • git_tracked_only
    Only match files that are part of the Git repository.
    Default: false

[[Task.Input.GolangSources]]

Resolves Golang packages to source files. Imported packages are recursively resolved to files.
Go source files from the standard library are ignored.

  • queries
    List of queries. The pattern can be either repository relative file paths or query patterns that are forwarded to the go packages driver tool (go list in most cases). The query syntax described at https://github.com/golang/tools/blob/bc8aaaa29e0665201b38fa5cb5d47826788fa249/go/packages/doc.go#L17 is supported.
    Default: []

  • environment
    Environment variables that are set when running the go package driver tool.
    The tool runs in a clean environment, only the following variables are inherited from the current environment: \

    • PATH
    • GOCACHE
    • XDG_CACHE_HOME
    • HOME
    • home
    • LocalAppData
    • USERPROFILE
      Default: []
  • build_flags
    List of command-line flags passed through to the go package driver tool.
    Default: []

  • tests
    Include go test files in the results.
    Default: false

[[Task.Output]]

Defines artifacts that are produced by the task and where they should be uploaded to. Output definitions are optional.

[[Task.Output.DockerImage]]
  • idfile
    Path of a file, relative to the application directory, containing the docker image ID of the image that is created
    (docker build --iidfile).
    Required
[[Task.Output.RegistryUpload]]

Defines where the image is uploaded to.

  • registry
    Docker registry address. If it's empty the docker agent's default registry address is used. \

  • repository
    Image Repository
    Required

  • tag
    Tat that is applied to the image.
    Required

[[Task.Output.File]]
  • path
    Application directory relative path.
    Required
[[Task.File.S3Upload]]
  • bucket
    S3 bucket name
    Required

  • key
    Object key
    Required

[[Task.File.FileCopy]]
  • path
    Absolute path the file is copied to.
    Required

Include Configuration File

The fields in the include files have the same meaning then their equivalent in the application config file.

Generation

A .baur.toml file can be generated by running:

baur init include

All values in the commented config are examples and not the default values.

[[Input]]

Input section that can be included in a Task.

  • include_id Identifier of the include

[[Output]]

Output section that can be included in a Task.

  • include_id Identifier of the include

[[Task]]

Task section that can be included in an application config file.

  • include_id Identifier of the include

Templating in Configuration Files

baur configuration files have limited support for templating.
Templating syntax can be used only in the values of configuration fields.
The Templating engine is based on Go Templates, everything that is supported by it can be used.

Additionally the following is supported:

Parameters

  • {{ .Root }}
    Is replaced with path to the repository root directory.

  • {{ .AppName }}
    Is replaced with the name of the application.

Functions

  • {{ gitCommit }}
    Arguments: none
    Returns the Git commit ID of the HEAD reference in the bau repository.

  • {{ env }}
    Arguments: string, environment variable name
    Returns the value of an environment variable. If the variable is not defined baur will fail.
    Example: Get the value of the environment variable $TERM: {{ env "TERM" }}

  • {{ uuid }}
    Arguments: none
    Generates and returns a UUID.