remotecontext

package
v1.3.3-0...-252e610 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2017 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Detect

func Detect(config backend.BuildConfig) (remote builder.Source, dockerfile *parser.Result, err error)

Detect returns a context and dockerfile from remote location or local archive. progressReader is only used if remoteURL is actually a URL (not empty, and not a Git endpoint).

func FullPath

func FullPath(remote builder.Source, path string) (string, error)

FullPath is a helper for getting a full path for a path from a source

func GetWithStatusError

func GetWithStatusError(url string) (resp *http.Response, err error)

GetWithStatusError does an http.Get() and returns an error if the status code is 4xx or 5xx.

func MakeGitContext

func MakeGitContext(gitURL string) (builder.Source, error)

MakeGitContext returns a Context from gitURL that is cloned in a temporary directory.

func MakeRemoteContext

func MakeRemoteContext(remoteURL string, contentTypeHandlers map[string]func(io.ReadCloser) (io.ReadCloser, error)) (builder.Source, error)

MakeRemoteContext downloads a context from remoteURL and returns it.

If contentTypeHandlers is non-nil, then the Content-Type header is read along with a maximum of maxPreambleLength bytes from the body to help detecting the MIME type. Look at acceptableRemoteMIME for more details.

If a match is found, then the body is sent to the contentType handler and a (potentially compressed) tar stream is expected to be returned. If no match is found, it is assumed the body is a tar stream (compressed or not). In either case, an (assumed) tar stream is passed to MakeTarSumContext whose result is returned.

func MakeTarSumContext

func MakeTarSumContext(tarStream io.Reader) (builder.Source, error)

MakeTarSumContext returns a build Context from a tar stream.

It extracts the tar stream to a temporary folder that is deleted as soon as the Context is closed. As the extraction happens, a tarsum is calculated for every file, and the set of all those sums then becomes the source of truth for all operations on this Context.

Closing tarStream has to be done by the caller.

func NewFileHash

func NewFileHash(path, name string, fi os.FileInfo) (hash.Hash, error)

NewFileHash returns new hash that is used for the builder cache keys

func NewLazyContext

func NewLazyContext(root string) (builder.Source, error)

NewLazyContext creates a new LazyContext. LazyContext defines a hashed build context based on a root directory. Individual files are hashed first time they are asked. It is not safe to call methods of LazyContext concurrently.

func Rel

func Rel(basepath, targpath string) (string, error)

Rel makes a path relative to base path. Same as `filepath.Rel` but can also handle UUID paths in windows.

func StatAt

func StatAt(remote builder.Source, path string) (os.FileInfo, error)

StatAt is a helper for calling Stat on a path from a source

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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