config

package
v0.0.0-...-703489d Latest Latest
Warning

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

Go to latest
Published: Apr 12, 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

func Cache() cache.Cache

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

func Configure

func Configure(c Configurable)

Configure with provided Configurable.

func WithContext

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

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

Types

type Artifact

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

func NewBinaries(bins ...string) Binaries

type BuildVariables

type BuildVariables map[string]Resolver

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

type Builder

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

Builder builds an artifact.

type Config

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

func Actual() Config

Actual returns actual config.

func FillInDefaultValues

func FillInDefaultValues(cfg Config) Config

FillInDefaultValues in provided config and returns a filled one.

type Configurable

type Configurable interface {
	Config() *Config
}

Configurable will allow changes of the Config structure.

type Configurator

type Configurator interface {
	Configure(cfg Configurable)
}

Configurator will configure project.

type Configured

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

func NewDependencies(deps ...string) Dependencies

type Metadata

type Metadata struct {
	Name string
	BuildVariables
}

Metadata holds additional contextual information.

func (Metadata) GetName

func (m Metadata) GetName() string

type Notifier

type Notifier interface {
	Notify(status string)
}

Notifier can notify of a pending status of long task.

type Publisher

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

Publisher publishes artifacts to a remote site.

type Resolver

type Resolver func() string

Resolver is a func that resolves to a string.

func StaticResolver

func StaticResolver(value string) Resolver

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

type Result

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

Result hold a result of an Artifact build or publish.

func (Result) Failed

func (r Result) Failed() bool

Failed returns true if the artifact processing failed.

type ResultKey

type ResultKey string

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

type Task

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

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