builder

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2014 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DotDotSanitizeErrorMessage is the error message used in errors that occur
	// because a provided Bobfile path contains ".."
	DotDotSanitizeErrorMessage = "bobfile path must not contain .."

	// InvalidPathSanitizeErrorMessage is the error message used in errors that
	// occur because a provided Bobfile path is invalid
	InvalidPathSanitizeErrorMessage = "bobfile path is invalid"

	// SymlinkSanitizeErrorMessage is the error message used in errors that
	// occur because a provided Bobfile path contains symlinks
	SymlinkSanitizeErrorMessage = "bobfile path must not contain symlinks"
)

Variables

View Source
var (
	// SkipPush will, when set to true, override any behavior set by a Bobfile and
	// will cause builders *NOT* to run `docker push` commands.  SkipPush is also set
	// by the `--skip-push` option when used on the command line.
	SkipPush bool
)

Functions

This section is empty.

Types

type BuildConfig added in v0.7.1

type BuildConfig struct {
	// contains filtered or unexported fields
}

BuildConfig contains fields that are passed to the builder to define parameters of the build. File must be the Bobfile. Top, if not provided, will default to "."

func NewBuildConfig added in v0.7.1

func NewBuildConfig(file, top string) (*BuildConfig, error)

NewBuildConfig returns a *BuildConfig after doing a little bit of setup. If top is not provided (an empty string), it is defaulted to ".". The top is sanitized by evaluating all symlinks so that it can be properly sanitized by the builder when the time comes

func (*BuildConfig) File added in v0.7.1

func (b *BuildConfig) File() string

File returns the Bobfile associated with the build config

func (*BuildConfig) Top added in v0.7.1

func (b *BuildConfig) Top() string

Top returns the repo directory after the setup has been done in NewBuildConfig

type BuildRelatedError added in v0.7.1

type BuildRelatedError struct {
	Message string
	Code    int
}

BuildRelatedError is used for build-related errors produced by the builder package that are encountered during the build process

func (*BuildRelatedError) Error added in v0.7.1

func (err *BuildRelatedError) Error() string

Error returns the error message for a build-related error. It is expected to be set at the time that the struct instance is created

func (*BuildRelatedError) ExitCode added in v0.7.1

func (err *BuildRelatedError) ExitCode() int

ExitCode returns the exit code for errors related to the build process. It is expected to be set during the time that struct instance is created

type Builder

type Builder struct {
	*logrus.Logger

	Stderr      io.Writer
	Stdout      io.Writer
	Builderfile string
	// contains filtered or unexported fields
}

A Builder is the struct that actually does the work of moving files around and executing the commands that do the docker build.

func NewBuilder

func NewBuilder(logger *logrus.Logger, shouldBeRegular bool) (*Builder, error)

NewBuilder returns an instance of a Builder struct. The function exists in case we want to initialize our Builders with something.

func (*Builder) Build

func (bob *Builder) Build(config *BuildConfig) Error

Build does the building!

func (*Builder) CleanWorkdir

func (bob *Builder) CleanWorkdir() error

CleanWorkdir effectively does a rm -rf and mkdir -p on bob's workdir. Intended to be used before using the workdir (i.e. before new command groups).

func (*Builder) Repodir

func (bob *Builder) Repodir() string

Repodir is the dir from which we are using files for our docker builds.

func (*Builder) SetNextSubSequence

func (bob *Builder) SetNextSubSequence(subSeq *parser.SubSequence)

SetNextSubSequence sets the next subsequence within bob to be processed. This function is exported because it is used explicitly in tests, but in Build(), it is intended to be used as a helper function.

func (*Builder) Setup

func (bob *Builder) Setup() error

Setup moves all of the correct files into place in the temporary directory in order to perform the docker build.

func (*Builder) Workdir

func (bob *Builder) Workdir() string

Workdir returns bob's working directory.

type Error added in v0.7.1

type Error interface {
	// Error returns the error message to satisfy the error interface
	Error() string

	// ExitCode returns the code that should be used when exiting as a result
	// of this error
	ExitCode() int
}

Error is an interface for any error types returned by the builder package / during the building process

func SanitizeBuilderfilePath added in v0.7.1

func SanitizeBuilderfilePath(config *BuildConfig) (string, Error)

SanitizeBuilderfilePath checks for disallowed entries in the provided Bobfile path and returns either a sanitized version of the path or an error

type ParserRelatedError added in v0.7.1

type ParserRelatedError struct {
	Message string
	Code    int
}

ParserRelatedError is used for errors encounted during the building process that are related to parsing the Bobfile

func (*ParserRelatedError) Error added in v0.7.1

func (err *ParserRelatedError) Error() string

Error returns the error message for a ParserRelatedError. It is expected to be set at the time that the struct instance is created

func (*ParserRelatedError) ExitCode added in v0.7.1

func (err *ParserRelatedError) ExitCode() int

ExitCode returns the exit code for errors related to parsing the Bobfile path. It is expected to be set during the time that struct instance is created

type SanitizeError added in v0.7.1

type SanitizeError struct {
	Message string
}

SanitizeError is used for errors related to sanitizing a given Bobfile path

func (*SanitizeError) Error added in v0.7.1

func (err *SanitizeError) Error() string

Error returns the error message for a SanitizeError. It is expected to be set at the time that the struct instance is created

func (*SanitizeError) ExitCode added in v0.7.1

func (err *SanitizeError) ExitCode() int

ExitCode returns the exit code for errors related to sanitizing the Bobfile path. It is the same value for all sanitize errors.

Jump to

Keyboard shortcuts

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