config

package
v0.9.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 28, 2024 License: Apache-2.0 Imports: 10 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultBuilders is a list of default builders.
	DefaultBuilders = make([]Builder, 0)
	// DefaultPublishers is a list of default publishers.
	DefaultPublishers = make([]Publisher, 0)
)

Functions

func Cache added in v0.6.0

func Cache() cache.Cache

Cache return a cache.Cache implementation based on context.Context.

func Configure added in v0.5.0

func Configure(c Configurable)

Configure with provided Configurable.

func WithContext added in v0.5.0

func WithContext(mutator func(ctx context.Context) context.Context)

WithContext allows to use context.Context and to amend it.

Types

type Artifact added in v0.5.0

type Artifact interface {
	GetType() string
	GetName() string
}

Artifact represents a thing that can be built and published.

type Binaries

type Binaries interface {
	Configurator
	Install(ctx context.Context, t *tasks.Task, destination string) error
	Count() int
	// contains filtered or unexported methods
}

func NewBinaries added in v0.9.0

func NewBinaries(bins ...string) Binaries

type BuildVariables added in v0.5.1

type BuildVariables map[string]Resolver

BuildVariables will be passed to a Golang's ldflags for variable injection.

type Builder added in v0.5.0

type Builder interface {
	Accepts(artifact Artifact) bool
	Build(artifact Artifact, notifier Notifier) Result
}

Builder builds an artifact.

type Config added in v0.5.0

type Config struct {
	// ProjectDir holds a path to the project.
	ProjectDir string

	// BuildDirPath holds a build directory path.
	BuildDirPath []string

	// Version contains the version information.
	*Version

	// Dependencies will hold additional Golang and pre-compiled dependencies
	// that needs to be installed before running tasks.
	Dependencies struct {
		Golang Dependencies
		Binaries
	}

	// Artifacts holds a list of artifacts to be built.
	Artifacts []Artifact

	// Builders holds a list of Builder's to be used for building project
	// artifacts. If none is configured, default ones will be used.
	Builders []Builder

	// Publishers holds a list of Publisher's to be used for publishing project
	// artifacts. If none is configured, default ones will be used.
	Publishers []Publisher

	// Cleaning additional cleaning tasks.
	Cleaning []Task

	// Checks holds a list of checks to perform.
	Checks []Task

	// BuildVariables holds extra list of variables to be passed to Golang's
	// ldflags.
	BuildVariables

	// Overrides holds a list of overrides of this configuration.
	Overrides []Configurator

	// context.Context is standard Golang context.
	context.Context //nolint:containedctx
}

Config holds configuration information.

func Actual added in v0.5.0

func Actual() Config

Actual returns actual config.

func FillInDefaultValues added in v0.5.0

func FillInDefaultValues(cfg Config) Config

FillInDefaultValues in provided config and returns a filled one.

type Configurable added in v0.5.0

type Configurable interface {
	Config() *Config
}

Configurable will allow changes of the Config structure.

type Configurator added in v0.5.0

type Configurator interface {
	Configure(cfg Configurable)
}

Configurator will configure project.

type Configured added in v0.5.0

type Configured interface{}

Configured represents a configured project.

type Dependencies

type Dependencies interface {
	Configurator
	Install(ctx context.Context, t *tasks.Task, dest string) error
	Count() int
	// contains filtered or unexported methods
}

func NewDependencies added in v0.5.0

func NewDependencies(deps ...string) Dependencies

type Metadata added in v0.5.0

type Metadata struct {
	Name string
	BuildVariables
}

Metadata holds additional contextual information.

func (Metadata) GetName added in v0.5.0

func (m Metadata) GetName() string

type Notifier added in v0.5.0

type Notifier interface {
	Notify(status string)
}

Notifier can notify of a pending status of long task.

type Publisher added in v0.5.0

type Publisher interface {
	Accepts(artifact Artifact) bool
	Publish(artifact Artifact, notifier Notifier) Result
}

Publisher publishes artifacts to a remote site.

type Resolver added in v0.5.0

type Resolver func() string

Resolver is a func that resolves to a string.

func StaticResolver added in v0.5.0

func StaticResolver(value string) Resolver

StaticResolver can be used to create a Resolver from static data.

type Result added in v0.5.0

type Result struct {
	Error error
	Info  map[string]interface{}
}

Result hold a result of an Artifact build or publish.

func (Result) Failed added in v0.5.0

func (r Result) Failed() bool

Failed returns true if the artifact processing failed.

type ResultKey added in v0.5.0

type ResultKey string

ResultKey is used to store results of a build or publish.

type Task added in v0.5.0

type Task struct {
	Name      string
	Operation func(Notifier) error
	Overrides []Configurator
}

Task is a custom function that will be used in the build.

type Version added in v0.5.0

type Version struct {
	Path string
	version.Resolver
}

Version specifies the version information and how to set it into variable at compile time.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL