Documentation
¶
Index ¶
Constants ¶
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 ¶
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
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 ¶
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 ¶
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) 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.
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
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.