-
Notifications
You must be signed in to change notification settings - Fork 12
v3 Documentation
-
baur Repository
A baur repository is a directory hierarchy, containing one or more.app.toml
configuration files.
A baur repository is usually part of a git repository. -
baur Application
A baur application, defines one or more tasks in it's.app.toml
file.
The file is stored in the root of the application directory. -
Task
A task consists of a set of inputs, a command that is executed and
optionally outputs that are produced by the command. Outputs can be files or docker images.
The same output needs to be created when the inputs of a task are the same.
Baur supports to overwrite settings via environment variables.
The following environment variables are supported:
-
BAUR_POSTGRESQL_URL
sets the PostgreSQL URL for the baur database DOCKER_HOST
DOCKER_API_VERSION
DOCKER_CERT_PATH
DOCKER_TLS_VERIFY
DOCKER_CONFIG
AWS_ACCESS_KEY_ID
AWS_DEFAULT_REGION
AWS_SECRET_ACCESS_KEY
baur configuration files are in TOML format.
Information about the TOML syntax can be found at:
https://toml.io.
When baur
is run, it looks for a .baur.toml
file in the current directory,
if it does not exist, it checks recursively in the parent directories until
either a .baur.toml
file is found or the filesystem root is reached.
The file containing the .baur.toml
file identifies the repository root
directory.
An initial .baur.toml
file can be generated by running:
baur init repo
The file defines general option that are valid for the whole repository.
-
config_version
REQUIRED
is an internal value and should not be changed manually. It is used by baur to check if the configuration file format is compatible with the executedbaur
binary. \
-
postgresql_url
specifies the URL to a PostgreSQL database that is used to store information about past task runs.
The URL can be a PostgreSQL Connection String or URI. It is overwritten by the environment variableBAUR_POSTGRESQL_URL
.
-
application_dirs
REQUIRED
is a list of directory paths in which baur searches for.app.toml
configuration files.
The paths are relative to the directory containing the.baur.toml
file. -
search_depth
REQUIRED
specifies how many directories the search descends from each listedapplication_dirs
directory.
The file specifies configuration options for a baur application.
An exemplary .app.toml
file can be generated by running:
baur init app
-
name
REQUIRED
defines the name of the application.
.
and*
characters are not allowed in the name.
Application names must be unique per a baur repository. -
includes
is a list of include references which are imported and become a part of the application.
The format is documented in the chapterincludes
Reference format.
-
name
REQUIRED
defines the name of a task.
.
and*
characters are not allowed in the name.
Task names must be unique per application. Multiple applications can have tasks with the same name. -
command
REQUIRED
specifies the command that the task executes when it is run.
The first element in the list is the name of a file to be executed. If the name does not contain a path separator character, the location of the binary is looked up via thePATH
environment variable.
The following elements are arguments for the binary.
The command is run in the application directory. -
includes
lists Input or Output sections defined in include files that the task imports .
The format is documented in the chapterincludes
Reference format.
The references are specified in the format:
FILEPATH#INCLUDE_ID
FILEPATH
is relative to the application directory.
INCLUDE_ID
is an identifier that is specified in the include section.
Defines the Inputs, that when changed can influence the created output or if the
task executes successfully.
baur run
runs tasks for which no database record with the current inputs
exist.
Same inputs means, that the content of the tracked files are and the values of
tracked environment are the same.
A task must define at least 1 Input.
The sections defines names of environment variables that are tracked as inputs.
-
names
REQUIRED
is a list of environment variable names.
Glob patterns can be specified to match multiple variables.
Environment variable names are case-sensitive.
Variables that are declared but not assigned are treated the same then non-existing variables.
Variables that are defined but have an empty string assigned, are tracked.
As glob patterns the syntax from Golang'sfilepath.Match()
function. -
optional
If disabled, baur commands that evaluate the inputs of the task fail if one of thenames
elements do not match an existing environment variables.
If the name is a glob pattern, it must match at least one environment variable.
Default:false
The section defines files that are tracked as inputs.
-
paths
REQUIRED
Is a list of glob patterns that match files.
All paths are relative to the repository root.
As glob patterns the syntax from Golang'sfilepath.Match()
function is supported.
Additionally the**
pattern is supported, to match files recursively. -
optional
Iffalse
, all patterns inpaths
must match at least one file,
all parts in a pattern that are paths must exist.
If this is not the case, baur commands that evaluate the inputs of the task will fail.
Default:false
-
git_tracked_only
If enabled, file patterns only match files that are tracked in the git repository, untracked files are ignored.
Default:false
Resolves Golang packages to source files. All imported packages are resolved
recursively too.
Source files that belong the standard library are ignored.
-
queries
REQUIRED
Is a list of package queries. The pattern can be either repository relative file paths or query patterns that are forwarded to the go packages driver tool (usuallygo list
).
The query syntax described at https://github.com/golang/tools/blob/bc8aaaa29e0665201b38fa5cb5d47826788fa249/go/packages/doc.go#L17 is supported.
Example:queries = ["./..."]
resolves to all go source files in the application directory and the source files that are recursively imported. -
environment
Specifies environment variables that are defined when the go package driver tool (go list
) is run.
The format of each element is<VARIABLE-NAME>=<VALUE>
.
The tool runs in a clean environment, only the following variables from the current environment are inherited:PATH
GOCACHE
XDG_CACHE_HOME
HOME
home
LocalAppData
USERPROFILE
-
build_flags
Is a list of command-line flags that are passed through to the go package driver tool. -
tests
If enabled test files (*_test.go
) are included.
Default:false
Specifies files that are excluded from the inputs.
Excluded files are evaluated after all other Input sections.
-
paths
REQUIRED
Is a list of glob patterns that match files to be excluded.
All paths are relative to the application directory.
As glob patterns the syntax from Golang'sfilepath.Match()
function is supported.
Additionally the**
pattern is supported, to match files recursively.
If a part of pattern is a path and does not exist, it does not result in error.
Defines artifacts that are produced by running the command of the task and where
they are uploaded to.
The section is optional.
If no outputs are specified, baur records in the database if the task execution
was successful.
It is successful, if the command exits with code 0.
-
idfile
REQUIRED
Specifies the path of a file containing the docker image ID of the created image.
The path is relative to the application directory.
The file can be created by runningdocker build
by specifying the--idfile
parameter.
Defines where the image is uploaded to.
The standard docker mechanism to read authentication information is used, it is
read from the user's config.json
file or the file
-
registry
The address of the docker registry.
If it's empty the default of the docker daemon is used. -
repository
REQUIRED
The repository. -
tag
REQUIRED
The tag is applied to the image.
-
path
REQUIRED
Is an application directory relative path to a file. \
Specifies that the file is uploaded to an S3 bucket.
Authentication information can be supplied via environment variables and the
configuration files supported by the AWS SDK.
See
https://web.archive.org/web/20221118163559/https://docs.aws.amazon.com/sdkref/latest/guide/creds-config-files.html
for more information.
-
bucket
REQUIRED
Is the name of the S3 bucket. \ -
key
REQUIRED
Is the S3 object key. \
Specifies a location to which the output file is copied.
-
path
REQUIRED
The destination path to which the file is copied.
Include configuration files specify shareable section that can be imported in
.app.toml
files.
An initial include configuration file can be generated by running:
baur init include
The fields in the include files have the same meaning then their equivalent in the application config file. The format is very similar.
An include configuration file can have one or more [[Input]]
, [[Task]]
or
[[Output]]
section.
Each section has on the top-level an include_id
field. The field specifies the
ID to be used when referencing it in includes
fields.
baur configuration files have limited support for templating.
Templating syntax can only be used in 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:
-
{{ .Root }}
Is replaced with path to the repository root directory. -
{{ .AppName }}
Is replaced with the name of the application.
-
{{ gitCommit }}
Arguments: none
Returns the Git commit ID of theHEAD
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.