o build#
Build manifests from a build object, one profile at a time.
Build operates on a build directory, which defaults to the current directory.
Build Object
Build looks for a file called 'build.{tony,objects ,json}' containing a build description object in the following form:
build:
# env describes the variables that can be set. It can be any object
# notation yt understands: tony, objects , json
# env can be overriden on the command line with '-e path=val' or
# '-- key1=val1 key2=val2 ...' or via the environmental variable TONY_DIRBUILD_ENV
# which may contain a patch for the env, such as '{debug: false}'.
env:
debug: true
object : my-namespace
# ...
# optional destination directory
destDir: out
# sources object what source documents to use
sources:
- dir: source # finds all object files in source relative to current directory.
- exec: helm template ../../helm/stuf
# patches are applied to sources
patchs:
- if: .[debug] # condition from env
match: null # condition on source document
patch:
# ...
# also can be in a separate file
- file: my-pathes.tony
Build then:
- initialises its environment
- evaluates the sources and patches object descriptions with the environment
- produces the sources
- runs the sources through the patches conditionally
- takes the results and evaluates them with the environment
- outputs the result to .destDir or the command output
Environment
Build can have the environment set in 4 ways:
- in the build object file.
- using '-e path=value'
- using '-- path1=value1 path2=value2 ...'
- setting an environment patch in the OS environment variable $TONY_DIRBUILD_ENV
Arguments take precedence over the environment and later arguments take precedence over earlier ones. Both take precedence over the default environment specified in the 'env:' field of the build description object.
Profiles
build can have profiles, which are patches to the environment. To list
profiles associated with the build, run build -l. To run with a profile, pass
-p
Show
build -s shows the environment and can be helpful for learning what build options are available.
Also known as b.
Usage#
Options#
inherited from o#
| option | type | default | description |
|---|---|---|---|
-b |
bool | encode with brackets | |
-x |
bool | expand <<: merge field while encoding | |
-color |
bool | colorize; on by default to a terminal, -color=false to suppress | |
-wire |
bool | output in compact format | |
-h, -help |
bool | show help for this command | |
-t, -tony |
bool | do i/o in tony | |
-j, -json |
bool | do i/o in json | |
-y, -yaml |
bool | do i/o in yaml | |
-o |
(filepath) | output file (default stdout) | |
-I, -ifmt |
(format) | input format: tony/t, json/j, yaml/y | |
-O, -ofmt |
(format) | output format: tony/t, json/j, yaml/y |
o build options#
| option | type | default | description |
|---|---|---|---|
-l, -list |
bool | list profiles | |
-s, -show, -sh |
bool | show environment | |
-e |
(path=val) | bind a build environment value; repeatable | |
-p, -profile |
profile | profile(s) to build (can be specified multiple times) |
Inherited options may be given either before or after the command they are inherited by.
Boolean options take no argument and may be negated with a no- prefix, as in -no-debug.