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 EnvVarsInputs
- type FileCopy
- type FileExcludeList
- 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 TaskInfo
- type Tasks
Constants ¶
const ( // Version identifies the format of the configuration files that the // package can parse. Whenever an incompatible change is made, the // Version number is increased. Version int = 7 )
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 EnvVarsInputs ¶
type EnvVarsInputs struct { Names []string `` /* 207-byte string literal not displayed */ Optional bool `toml:"optional" comment:"When optional is true, a variable pattern matching 0 defined variables will not cause an error."` }
func (*EnvVarsInputs) Validate ¶
func (ei *EnvVarsInputs) Validate() error
Validate always returns nil.
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 FileExcludeList ¶
type FileExcludeList struct {
Paths []string `` /* 306-byte string literal not displayed */
}
FileExcludeList specifies paths to files that are excluded as inputs.
func (*FileExcludeList) Validate ¶
func (f *FileExcludeList) Validate() error
type FileInputs ¶
type FileInputs struct { // if attributes are added/removed or modified, the input resolver // cache *must* be adapted to ensure that the caching logic respects // the attribute change. 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 { // if attributes are added/removed or modified, the input resolver // cache *must* be adapted to ensure that the caching logic respects // the attribute change. 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 ¶
func ExampleInclude() *Include
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 { EnvironmentVariables []EnvVarsInputs Files []FileInputs GolangSources []GolangSources `comment:"Inputs specified by resolving dependencies of Golang source files or packages."` TaskInfos []TaskInfo `comment:"Information about another baur task."` ExcludedFiles FileExcludeList }
Input contains information about task inputs
type InputInclude ¶
type InputInclude struct { IncludeID string `toml:"include_id" comment:"identifier of the include"` EnvironmentVariables []EnvVarsInputs Files []FileInputs GolangSources []GolangSources `comment:"Inputs specified by resolving dependencies of Golang source files or packages."` ExcludedFiles FileExcludeList TaskInfos []TaskInfo `comment:"Information about task of the same App"` // 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 }
cfg 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
- envinputs.go
- fielderror.go
- filecopy.go
- fileignorelist.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
- taskinfo.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
|
|
v5
Package v5 provides helpers to convert baur configs in v5 format (baur 2.x) to v7 (baur 4.x)
|
Package v5 provides helpers to convert baur configs in v5 format (baur 2.x) to v7 (baur 4.x) |