Documentation ¶
Index ¶
- Constants
- Variables
- func AddVolumePathToWhitelist(path string)
- func CacheHasher() func(string) (string, error)
- func CheckWhitelist(path string) bool
- func ContainsWildcards(paths []string) bool
- func CopyDir(src, dest, buildcontext string, uid, gid int64) ([]string, error)
- func CopyFile(src, dest, buildcontext string, uid, gid int64) (bool, error)
- func CopyFileOrSymlink(src string, destDir string, root string) error
- func CopySymlink(src, dest, buildcontext string) (bool, error)
- func CreateFile(path string, reader io.Reader, perm os.FileMode, uid uint32, gid uint32) error
- func CreateTargetTarfile(tarpath string) (*os.File, error)
- func DeleteFilesystem() error
- func DestinationFilepath(src, dest, cwd string) (string, error)
- func DetectFilesystemWhitelist(path string) error
- func DetermineTargetFileOwnership(fi os.FileInfo, uid, gid int64) (int64, int64)
- func DownloadFileToDest(rawurl, dest string, uid, gid int64) error
- func EvalSymLink(path string) (string, error)
- func ExcludeFile(path, buildcontext string) bool
- func ExtractFile(dest string, hdr *tar.Header, tr io.Reader) error
- func FilepathExists(path string) bool
- func GetBucketAndItem(context string) (string, string)
- func GetExcludedFiles(dockerfilepath string, buildcontext string) error
- func GetFSFromImage(root string, img v1.Image, extract ExtractFunction) ([]string, error)
- func GetFSFromLayers(root string, layers []v1.Layer, opts ...FSOpt) ([]string, error)
- func GetInputFrom(r io.Reader) ([]byte, error)
- func GetSymLink(path string) (string, error)
- func GetUIDAndGIDFromString(userGroupString string, fallbackToUID bool) (uint32, uint32, error)
- func GetUserFromUsername(userStr string, groupStr string, fallbackToUID bool) (string, string, error)
- func GetUserGroup(chownStr string, env []string) (int64, int64, error)
- func HasFilepathPrefix(path, prefix string, prefixMatchOnly bool) bool
- func Hasher() func(string) (string, error)
- func IsDestDir(path string) bool
- func IsFileLocalTarArchive(src string) bool
- func IsInProvidedWhitelist(path string, wl []WhitelistEntry) bool
- func IsInWhitelist(path string) bool
- func IsSrcRemoteFileURL(rawurl string) bool
- func IsSrcsValid(srcsAndDest instructions.SourcesAndDest, resolvedSources []string, root string) error
- func IsSymlink(fi os.FileInfo) bool
- func Lookup(userStr string) (*user.User, error)
- func MtimeHasher() func(string) (string, error)
- func ParentDirectories(path string) []string
- func ParentDirectoriesWithoutLeadingSlash(path string) []string
- func RelativeFiles(fp string, root string) ([]string, error)
- func ResolveEnvAndWildcards(sd instructions.SourcesAndDest, buildcontext string, envs []string) ([]string, string, error)
- func ResolveEnvironmentReplacement(value string, envs []string, isFilepath bool) (string, error)
- func ResolveEnvironmentReplacementList(values, envs []string, isFilepath bool) ([]string, error)
- func ResolveSources(srcs []string, root string) ([]string, error)
- func RetrieveSourceImage(stage config.KanikoStage, opts *config.KanikoOptions) (v1.Image, error)
- func SHA256(r io.Reader) (string, error)
- func SyscallCredentials(userStr string) (*syscall.Credential, error)
- func URLDestinationFilepath(rawurl, dest, cwd string, envs []string) (string, error)
- func UnpackCompressedTar(path, dir string) error
- func UnpackLocalTarArchive(path, dest string) ([]string, error)
- func UpdateConfigEnv(envVars []instructions.KeyValuePair, config *v1.Config, ...) error
- func UpdateWhitelist(whitelistVarRun bool)
- func ValidAzureBlobStorageHost(context string) bool
- func Volumes() []string
- type ExtractFunction
- type FSConfig
- type FSOpt
- type Tar
- type WhitelistEntry
Constants ¶
const DoNotChangeGID = -1
const DoNotChangeUID = -1
Variables ¶
var ErrNotSymLink = fmt.Errorf("not a symlink")
var (
// RetrieveRemoteImage downloads an image from a remote location
RetrieveRemoteImage = remoteImage
)
Functions ¶
func AddVolumePathToWhitelist ¶ added in v0.4.0
func AddVolumePathToWhitelist(path string)
AddVolumePath adds the given path to the volume whitelist.
func CacheHasher ¶ added in v0.4.0
CacheHasher takes into account everything the regular hasher does except for mtime
func CheckWhitelist ¶ added in v0.3.0
func ContainsWildcards ¶
ContainsWildcards returns true if any entry in paths contains wildcards
func CopyDir ¶
CopyDir copies the file or directory at src to dest It returns a list of files it copied over
func CopyFileOrSymlink ¶ added in v0.17.0
For cross stage dependencies kaniko must persist the referenced path so that it can be used in the dependent stage. For symlinks we copy the target path because copying the symlink would result in a dead link
func CopySymlink ¶
CopySymlink copies the symlink at src to dest.
func CreateFile ¶
CreateFile creates a file at path and copies over contents from the reader
func CreateTargetTarfile ¶ added in v0.14.0
CreateTargetTarfile creates target tar file for downloading the context file. Make directory if directory does not exist
func DeleteFilesystem ¶
func DeleteFilesystem() error
DeleteFilesystem deletes the extracted image file system
func DestinationFilepath ¶
DestinationFilepath returns the destination filepath from the build context to the image filesystem If source is a file:
If dest is a dir, copy it to /dest/relpath If dest is a file, copy directly to dest
If source is a dir:
Assume dest is also a dir, and copy to dest/
If dest is not an absolute filepath, add /cwd to the beginning
func DetectFilesystemWhitelist ¶ added in v0.7.0
Get whitelist from roots of mounted files Each line of /proc/self/mountinfo is in the form: 36 35 98:0 /mnt1 /mnt2 rw,noatime master:1 - ext3 /dev/root rw,errors=continue (1)(2)(3) (4) (5) (6) (7) (8) (9) (10) (11) Where (5) is the mount point relative to the process's root From: https://www.kernel.org/doc/Documentation/filesystems/proc.txt
func DetermineTargetFileOwnership ¶ added in v0.18.0
DetermineTargetFileOwnership returns the user provided uid/gid combination. If they are set to -1, the uid/gid from the original file is used.
func DownloadFileToDest ¶
DownloadFileToDest downloads the file at rawurl to the given dest for the ADD command From add command docs:
- If <src> is a remote file URL: - destination will have permissions of 0600 - If remote file has HTTP Last-Modified header, we set the mtime of the file to that timestamp
func EvalSymLink ¶ added in v0.17.0
func ExcludeFile ¶ added in v0.17.0
ExcludeFile returns true if the .dockerignore specified this file should be ignored
func ExtractFile ¶ added in v0.15.0
func FilepathExists ¶
FilepathExists returns true if the path exists
func GetBucketAndItem ¶ added in v0.2.0
func GetExcludedFiles ¶ added in v0.8.0
GetExcludedFiles gets a list of files to exclude from the .dockerignore
func GetFSFromImage ¶
GetFSFromImage extracts the layers of img to root It returns a list of all files extracted
func GetFSFromLayers ¶ added in v0.17.0
func GetInputFrom ¶ added in v0.20.0
GetInputFrom returns Reader content
func GetSymLink ¶ added in v0.17.0
func GetUIDAndGIDFromString ¶ added in v0.18.0
Extract user and group id from a string formatted 'user:group'. If fallbackToUID is set, the gid is equal to uid if the group is not specified otherwise gid is set to zero.
func GetUserFromUsername ¶ added in v0.2.0
func GetUserGroup ¶ added in v0.19.0
func HasFilepathPrefix ¶
HasFilepathPrefix checks if the given file path begins with prefix
func Hasher ¶
Hasher returns a hash function, used in snapshotting to determine if a file has changed
func IsFileLocalTarArchive ¶
IsFileLocalTarArchive returns true if the file is a local tar archive
func IsInProvidedWhitelist ¶ added in v0.18.0
func IsInProvidedWhitelist(path string, wl []WhitelistEntry) bool
func IsInWhitelist ¶ added in v0.7.0
func IsSrcRemoteFileURL ¶
func IsSrcsValid ¶
func IsSrcsValid(srcsAndDest instructions.SourcesAndDest, resolvedSources []string, root string) error
func MtimeHasher ¶
MtimeHasher returns a hash function, which only looks at mtime to determine if a file has changed. Note that the mtime can lag, so it's possible that a file will have changed but the mtime may look the same.
func ParentDirectories ¶
ParentDirectories returns a list of paths to all parent directories Ex. /some/temp/dir -> [/, /some, /some/temp, /some/temp/dir]
func ParentDirectoriesWithoutLeadingSlash ¶ added in v0.12.0
ParentDirectoriesWithoutLeadingSlash returns a list of paths to all parent directories all subdirectories do not contain a leading / Ex. /some/temp/dir -> [/, some, some/temp, some/temp/dir]
func RelativeFiles ¶
RelativeFiles returns a list of all files at the filepath relative to root
func ResolveEnvAndWildcards ¶ added in v0.10.0
func ResolveEnvAndWildcards(sd instructions.SourcesAndDest, buildcontext string, envs []string) ([]string, string, error)
func ResolveEnvironmentReplacement ¶
ResolveEnvironmentReplacement resolves replacing env variables in some text from envs It takes in a string representation of the command, the value to be resolved, and a list of envs (config.Env) Ex: value = $foo/newdir, envs = [foo=/foodir], then this should return /foodir/newdir The dockerfile/shell package handles processing env values It handles escape characters and supports expansion from the config.Env array Shlex handles some of the following use cases (these and more are tested in integration tests) ""a'b'c"" -> "a'b'c" "Rex\ The\ Dog \" -> "Rex The Dog" "a\"b" -> "a"b"
func ResolveEnvironmentReplacementList ¶
ResolveEnvironmentReplacementList resolves a list of values by calling resolveEnvironmentReplacement
func ResolveSources ¶
ResolveSources resolves the given sources if the sources contains wildcards It returns a list of resolved sources
func RetrieveSourceImage ¶ added in v0.3.0
func RetrieveSourceImage(stage config.KanikoStage, opts *config.KanikoOptions) (v1.Image, error)
RetrieveSourceImage returns the base image of the stage at index
func SyscallCredentials ¶ added in v0.20.0
func SyscallCredentials(userStr string) (*syscall.Credential, error)
func URLDestinationFilepath ¶
URLDestinationFilepath gives the destination a file from a remote URL should be saved to
func UnpackCompressedTar ¶
UnpackCompressedTar unpacks the compressed tar at path to dir
func UnpackLocalTarArchive ¶
UnpackLocalTarArchive unpacks the tar archive at path to the directory dest Returns the files extracted from the tar archive
func UpdateConfigEnv ¶
func UpdateConfigEnv(envVars []instructions.KeyValuePair, config *v1.Config, replacementEnvs []string) error
func UpdateWhitelist ¶ added in v0.17.0
func UpdateWhitelist(whitelistVarRun bool)
UpdateInitialWhitelist will add /var/run to whitelisted paths if
func ValidAzureBlobStorageHost ¶ added in v0.14.0
Validate if the host url provided is with correct suffix for AzureCloud, AzureChinaCloud, AzureGermanCloud and AzureUSGovernment RegEX for supported suffix defined in constants.AzureBlobStorageHostRegEx
Types ¶
type ExtractFunction ¶ added in v0.15.0
type FSOpt ¶ added in v0.17.0
type FSOpt func(*FSConfig)
func ExtractFunc ¶ added in v0.17.0
func ExtractFunc(extractFunc ExtractFunction) FSOpt
func IncludeWhiteout ¶ added in v0.17.0
func IncludeWhiteout() FSOpt
type Tar ¶ added in v0.4.0
type Tar struct {
// contains filtered or unexported fields
}
Tar knows how to write files to a tar file.
func NewTar ¶ added in v0.4.0
NewTar will create an instance of Tar that can write files to the writer at f.
func (*Tar) AddFileToTar ¶ added in v0.4.0
AddFileToTar adds the file at path p to the tar
type WhitelistEntry ¶ added in v0.4.0
func Whitelist ¶ added in v0.18.0
func Whitelist() []WhitelistEntry