utils

package
v1.4.2-0...-1ddd4b1 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2015 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const RestrictedNameChars = `[a-zA-Z0-9][a-zA-Z0-9_.-]`

RestrictedNameChars collects the characters allowed to represent a name, normally used to validate container and volume names.

Variables

View Source
var RestrictedNamePattern = regexp.MustCompile(`^/?` + RestrictedNameChars + `+$`)

RestrictedNamePattern is a regular expression to validate names against the collection of restricted characters.

Functions

func DockerInitPath

func DockerInitPath(localCopy string) string

DockerInitPath figures out the path of our dockerinit (which may be SelfPath())

func ExperimentalBuild

func ExperimentalBuild() bool

ExperimentalBuild is a stub which always returns false for builds that do not include the "experimental" build tag

func GetCallerName

func GetCallerName(depth int) string

GetCallerName introspects the call stack and returns the name of the function `depth` levels down in the stack.

func GetErrorMessage

func GetErrorMessage(err error) string

GetErrorMessage returns the human readable message associated with the passed-in error. In some cases the default Error() func returns something that is less than useful so based on its types this func will go and get a better piece of text.

func GitClone

func GitClone(remoteURL string) (string, error)

GitClone clones a repository into a newly created directory which will be under "docker-build-git"

func IsTimeout

func IsTimeout(err error) bool

IsTimeout takes an error returned from (generally) the http package and determines if it is a timeout error.

func ReadDockerIgnore

func ReadDockerIgnore(reader io.ReadCloser) ([]string, error)

ReadDockerIgnore reads a .dockerignore file and returns the list of file patterns to ignore. Note this will trim whitespace from each line as well as use GO's "clean" func to get the shortest/cleanest path for each.

func ReplaceOrAppendEnvValues

func ReplaceOrAppendEnvValues(defaults, overrides []string) []string

ReplaceOrAppendEnvValues returns the defaults with the overrides either replaced by env key or appended to the list

func SelfPath

func SelfPath() string

SelfPath figures out the absolute path of our own binary (if it's still around).

func TestDirectory

func TestDirectory(templateDir string) (dir string, err error)

TestDirectory creates a new temporary directory and returns its path. The contents of directory at path `templateDir` is copied into the new directory.

func ValidateContextDirectory

func ValidateContextDirectory(srcPath string, excludes []string) error

ValidateContextDirectory checks if all the contents of the directory can be read and returns an error if some files can't be read symlinks which point to non-existing files don't trigger an error

Types

This section is empty.

Jump to

Keyboard shortcuts

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