Documentation
¶
Overview ¶
Package cfg implements the baur configuration file parser.
Index ¶
- Constants
- Variables
- func ToFileOptCommented() toFileOpt
- func ToFileOptOverwrite() toFileOpt
- type App
- type Database
- type Discover
- type DockerImageOutput
- type DockerImageRegistryUpload
- type FileCopy
- type FileInputs
- type FileOutput
- type GolangSources
- type Include
- type IncludeDB
- type Input
- type InputInclude
- type InputIncludes
- type LogFn
- type Output
- type OutputDef
- type OutputInclude
- type OutputIncludes
- type Repository
- type Resolver
- type S3Upload
- type Task
- type TaskInclude
- type TaskIncludes
- type Tasks
Constants ¶
const ( // Version identifies the format of the configuration files that the // package is able to parse. Whenever an incompatible change is made, // the Version number is increased. Version int = 5 )
Variables ¶
var ErrIncludeIDNotFound = errors.New("id not found in include file")
ErrIncludeIDNotFound describes that an include with a specific does not exist in an include file.
Functions ¶
func ToFileOptCommented ¶
func ToFileOptCommented() toFileOpt
ToFileOptCommented comment every line in the config
func ToFileOptOverwrite ¶
func ToFileOptOverwrite() toFileOpt
ToFileOptOverwrite overwrite an existing file instead of returning an error
Types ¶
type App ¶
type App struct {
Name string `toml:"name" comment:"Application name"`
Includes []string `` /* 174-byte string literal not displayed */
Tasks Tasks `toml:"Task"`
// contains filtered or unexported fields
}
App stores an application configuration.
func AppFromFile ¶
AppFromFile unmarshals an application configuration from a file and returns it.
func ExampleApp ¶
ExampleApp returns an exemplary app cfg struct with the name set to the given value.
func (*App) Merge ¶
Merge merges the configuration with it's includes. The task includes listed in App.Includes are loaded via the includedb and then appeneded to the task list.
func (*App) Resolve ¶
Resolve runs the resolvers on string fields that can contain special strings. These special strings are replaced with concrete values by the resolvers.
type Database ¶
type Database struct {
PGSQLURL string `` /* 232-byte string literal not displayed */
}
Database contains database configuration
type Discover ¶
type Discover struct {
Dirs []string `toml:"application_dirs" comment:"Directories in which applications (.app.toml files) are discovered"`
SearchDepth int `toml:"search_depth" comment:"Descend at most search_depth levels to find application configs"`
}
Discover stores the Discover section of the repository configuration.
type DockerImageOutput ¶
type DockerImageOutput struct {
IDFile string `toml:"idfile" comment:"File containing the image ID of the produced image (docker build --iidfile)."`
RegistryUpload []DockerImageRegistryUpload
}
DockerImageOutput describes where a docker container is uploaded to.
type DockerImageRegistryUpload ¶
type DockerImageRegistryUpload struct {
Registry string `toml:"registry" comment:"Registry address in the format <HOST>:[<PORT>]. If it's empty the docker agent's default is used."`
Repository string `toml:"repository"`
Tag string `toml:"tag"`
}
DockerImageRegistryUpload stores information about a Docker image upload.
func (*DockerImageRegistryUpload) Resolve ¶
func (d *DockerImageRegistryUpload) Resolve(resolver Resolver) error
type FileCopy ¶
type FileCopy struct {
Path string `toml:"path" comment:"Destination directory"`
}
FileCopy describes a filesystem location where a task output is copied to.
type FileInputs ¶
type FileInputs struct {
Paths []string `` /* 228-byte string literal not displayed */
Optional bool `toml:"optional" comment:"When optional is true a path pattern that matches 0 files will not cause an error."`
GitTrackedOnly bool `toml:"git_tracked_only" comment:"Only resolve to files that are part of the Git repository."`
}
FileInputs stores glob paths to inputs of a task.
type FileOutput ¶
type FileOutput struct {
Path string `toml:"path" comment:"Path relative to the application directory."`
FileCopy []FileCopy `comment:"Copy the file to a local directory."`
S3Upload []S3Upload `comment:"Upload the file to S3."`
}
FileOutput describes where a file output is stored.
type GolangSources ¶
type GolangSources struct {
Queries []string `` /* 487-byte string literal not displayed */
Environment []string `toml:"environment" comment:"Environment when running the go query tool."`
BuildFlags []string `toml:"build_flags" comment:"List of command-line flags to be passed through to the Go query tool."`
Tests bool `toml:"tests" comment:"If true queries are resolved to test files, otherwise testfiles are ignored."`
}
GolangSources specifies inputs for Golang Applications
type Include ¶
type Include struct {
Input InputIncludes
Output OutputIncludes
Task TaskIncludes
// contains filtered or unexported fields
}
func ExampleInclude ¶
ExampleInclude returns an Include struct with exemplary values.
func IncludeFromFile ¶
IncludeFromFile unmarshals an Include struct from a file.
type IncludeDB ¶
type IncludeDB struct {
// contains filtered or unexported fields
}
IncludeDB loads and stores include config files. It's methods are not concurrency-safe.
func NewIncludeDB ¶
type Input ¶
type Input struct {
Files []FileInputs
GolangSources []GolangSources `comment:"Inputs specified by resolving dependencies of Golang source files or packages."`
}
Input contains information about task inputs
type InputInclude ¶
type InputInclude struct {
IncludeID string `toml:"include_id" comment:"identifier of the include"`
Files []FileInputs
GolangSources []GolangSources `comment:"Inputs specified by resolving dependencies of Golang source files or packages."`
// contains filtered or unexported fields
}
InputInclude is a reusable Input definition.
func (*InputInclude) IsEmpty ¶
func (in *InputInclude) IsEmpty() bool
type Output ¶
type Output struct {
DockerImage []DockerImageOutput
File []FileOutput
}
Output is the tasks output section
func (*Output) DockerImageOutputs ¶
func (out *Output) DockerImageOutputs() []DockerImageOutput
func (*Output) FileOutputs ¶
func (out *Output) FileOutputs() []FileOutput
type OutputDef ¶
type OutputDef interface {
DockerImageOutputs() []DockerImageOutput
FileOutputs() []FileOutput
}
type OutputInclude ¶
type OutputInclude struct {
IncludeID string `toml:"include_id" comment:"identifier of the include"`
DockerImage []DockerImageOutput `comment:"Docker images that are produced by the [Task.command]"`
File []FileOutput `comment:"Files that are produces by the [Task.command]"`
// contains filtered or unexported fields
}
OutputInclude is a reusable Output definition
func (*OutputInclude) DockerImageOutputs ¶
func (out *OutputInclude) DockerImageOutputs() []DockerImageOutput
func (*OutputInclude) FileOutputs ¶
func (out *OutputInclude) FileOutputs() []FileOutput
type OutputIncludes ¶
type OutputIncludes []*OutputInclude
OutputIncludes is a list of OutputInclude
type Repository ¶
type Repository struct {
ConfigVersion int `toml:"config_version" comment:"Internal field, version of baur configuration format"`
Database Database
Discover Discover
// contains filtered or unexported fields
}
Repository contains the repository configuration.
func ExampleRepository ¶
func ExampleRepository() *Repository
ExampleRepository returns an exemplary Repository config
func RepositoryFromFile ¶
func RepositoryFromFile(cfgPath string) (*Repository, error)
RepositoryFromFile reads the repository config from a file and returns it.
func (*Repository) FilePath ¶
func (r *Repository) FilePath() string
func (*Repository) ToFile ¶
func (r *Repository) ToFile(filepath string, opts ...toFileOpt) error
ToFile writes an Repository configuration file to filepath.
func (*Repository) Validate ¶
func (r *Repository) Validate() error
Validate validates a repository configuration
type Resolver ¶
Resolver is an interface for replacing substrings with a special meaning in strings.
type Task ¶
type Task struct {
Name string `toml:"name" comment:"Task name"`
Command []string `toml:"command" comment:"Command to execute.\n The first element is the command, the following its arguments."`
Includes []string `` /* 186-byte string literal not displayed */
Input Input `toml:"Input" comment:"Inputs are tracked, when they change the task is rerun."`
Output Output `toml:"Output" comment:"Artifacts produced by the Task.command and their upload destinations."`
// contains filtered or unexported fields
}
Task is a task section
type TaskInclude ¶
type TaskInclude struct {
IncludeID string `toml:"include_id" comment:"identifier of the include"`
Name string `toml:"name" comment:"Task name"`
Command []string `` /* 219-byte string literal not displayed */
Includes []string `` /* 181-byte string literal not displayed */
Input Input `toml:"Input" comment:"Specification of task inputs like source files, Makefiles, etc"`
Output Output `toml:"Output" comment:"Specification of task outputs produced by the Task.command"`
// contains filtered or unexported fields
}
TaskInclude is a reusable Tasks definition
type TaskIncludes ¶
type TaskIncludes []*TaskInclude
Source Files
¶
- app.go
- cfg.go
- dockerimageoutput.go
- dockerimageregistryupload.go
- fielderror.go
- filecopy.go
- fileinputs.go
- fileoutput.go
- golangsources.go
- include.go
- includedb.go
- input.go
- inputdef.go
- inputinclude.go
- inputincludes.go
- output.go
- outputdef.go
- outputinclude.go
- outputincludes.go
- repository.go
- resolver.go
- s3upload.go
- task.go
- taskdef.go
- taskinclude.go
- taskincludes.go
- tasks.go
- validation.go
Directories
¶
| Path | Synopsis |
|---|---|
|
Package resolver provides templating for baur configuration files.
|
Package resolver provides templating for baur configuration files. |
|
upgrade
|
|
|
v4
Package v4 provides helpers to convert baur configs in v4 format (baur 0.20) to v5 (baur 2.0)
|
Package v4 provides helpers to convert baur configs in v4 format (baur 0.20) to v5 (baur 2.0) |