Documentation
¶
Index ¶
- func ArchiveDir(ctx context.Context, fs billy.Filesystem, srcPath, destTgzPath string) error
- func CompareDirs(ctx context.Context, fs billy.Filesystem, leftDirpath, rightDirpath string, ...) error
- func CompareTgzs(ctx context.Context, fs billy.Filesystem, leftTgzPath string, ...) (bool, error)
- func CopyDir(ctx context.Context, fs billy.Filesystem, srcDir string, dstDir string) error
- func CopyFile(ctx context.Context, fs billy.Filesystem, srcPath string, dstPath string) error
- func CreateAndOpenYamlFile(ctx context.Context, filePath string, truncate bool) (*os.File, error)
- func CreateFileAndDirs(fs billy.Filesystem, path string) (billy.File, error)
- func DecodeTgzValuesYamlMap(ctx context.Context, assetsTgzs []string) (map[string][]map[string]interface{}, error)
- func DecodeValueYamlInTgz(ctx context.Context, tgzPath string, fileNames []string) ([]map[string]interface{}, error)
- func GetAbsPath(fs billy.Filesystem, path string) string
- func GetChartArchive(fs billy.Filesystem, url string, path string) error
- func GetFilesystem(path string) billy.Filesystem
- func GetRelativePath(fs billy.Filesystem, abspath string) (string, error)
- func GetRootPath(ctx context.Context, path string) (string, error)
- func IsEmptyDir(ctx context.Context, fs billy.Filesystem, path string) (bool, error)
- func LoadYamlFile[YamlFields any](ctx context.Context, filepath string, ignoreFormat bool) (*YamlFields, error)
- func MakeSubdirectoryRoot(ctx context.Context, fs billy.Filesystem, path, subdirectory string) error
- func MovePath(ctx context.Context, path string, fromDir string, toDir string) (string, error)
- func PathExists(ctx context.Context, fs billy.Filesystem, path string) (bool, error)
- func PruneEmptyDirsInPath(ctx context.Context, fs billy.Filesystem, path string) error
- func RemoveAll(fs billy.Filesystem, path string) error
- func UnarchiveTgz(ctx context.Context, fs billy.Filesystem, ...) error
- func UpdatePermissions(fs billy.Filesystem, path string, mode int64) error
- func UpdateYamlFile(file *os.File, imageTagMap map[string][]string) error
- func WalkAssetsFolderTgzFiles(ctx context.Context) ([]string, error)
- func WalkDir(ctx context.Context, fs billy.Filesystem, dirPath string, ...) error
- func WalkFilteredAssetsFolder(ctx context.Context, imageTagMap, filter map[string][]string, ...) error
- type RelativePathFunc
- type RelativePathPairFunc
- type StreamReader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ArchiveDir ¶ added in v0.2.3
ArchiveDir archives a directory or a file into a tgz file and put it at destTgzPath which should end with .tgz
func CompareDirs ¶
func CompareDirs(ctx context.Context, fs billy.Filesystem, leftDirpath, rightDirpath string, leftOnlyFunc, rightOnlyFunc RelativePathFunc, bothFunc RelativePathPairFunc) error
CompareDirs compares the contents of the directory at fromDirpath against that of the directory at toDirpath within a given filesystem It execute leftOnlyFunc on paths that only exist on the leftDirpath and rightOnlyFunc on paths that only exist on rightDirpath It executes bothFunc on paths that exist on both the left and the right. Order will be preserved in the function arguments
func CompareTgzs ¶ added in v0.3.0
func CompareTgzs(ctx context.Context, fs billy.Filesystem, leftTgzPath string, rightTgzPath string) (bool, error)
CompareTgzs checks to see if the file contents of the archive found at leftTgzPath matches that of the archive found at rightTgzPath It does this by comparing the sha256sum of the file contents, ignoring any other information (e.g. file modes, timestamps, etc.)
func CopyFile ¶
CopyFile copies a file from srcPath to dstPath within a filesystem. It creates any relevant directories along the way
func CreateAndOpenYamlFile ¶ added in v1.6.5
CreateAndOpenYamlFile creates a new yaml file or opens an existing one. The behavior is controlled by the truncate flag.
Parameters:
- ctx: The context for logging.
- filePath: The full path to the yaml file.
- truncate: If true, the file is created or truncated. If false, it's opened for read/write, or created if it doesn't exist.
func CreateFileAndDirs ¶
CreateFileAndDirs creates a file on the filesystem and all relevant directories along the way if they do not exist. The file that is created must be closed by the caller
func DecodeTgzValuesYamlMap ¶ added in v1.6.5
func DecodeTgzValuesYamlMap(ctx context.Context, assetsTgzs []string) (map[string][]map[string]interface{}, error)
DecodeTgzValuesYamlMap will untar into memory the given .tgz file paths.
func DecodeValueYamlInTgz ¶ added in v1.6.5
func DecodeValueYamlInTgz(ctx context.Context, tgzPath string, fileNames []string) ([]map[string]interface{}, error)
DecodeValueYamlInTgz will untar into-memory a given .tgz file and map it, normalizing the fields as strings enabling O(1) operations when searching for a target key which corresponds to a yaml field.
func GetAbsPath ¶
GetAbsPath returns the absolute path given the relative path within a filesystem
func GetChartArchive ¶
GetChartArchive gets a chart tgz file from a url and drops it into the path specified on the filesystem
func GetFilesystem ¶
func GetFilesystem(path string) billy.Filesystem
GetFilesystem returns a filesystem rooted at the provided path
func GetRelativePath ¶
GetRelativePath returns the relative path given the absolute path within a filesystem
func GetRootPath ¶
GetRootPath returns the first directory in a given path
func IsEmptyDir ¶
IsEmptyDir returns whether the path provided is an empty directory or an error
func LoadYamlFile ¶ added in v1.6.5
func LoadYamlFile[YamlFields any](ctx context.Context, filepath string, ignoreFormat bool) (*YamlFields, error)
LoadYamlFile is a generic function that loads a YAML file and decodes it efficiently (especially for large files) using a streaming approach into a struct of type YamlFields, specified by the caller. YamlFields is expected to be a struct suitable for YAML unmarshalling.
- filepath: entire file path to the .yaml file
- ignoreFormat: ignore legacy yaml format errors
func MakeSubdirectoryRoot ¶
func MakeSubdirectoryRoot(ctx context.Context, fs billy.Filesystem, path, subdirectory string) error
MakeSubdirectoryRoot makes a particular subdirectory of a path its main directory
func MovePath ¶
MovePath takes a path that is contained within fromDir and returns the same path contained within toDir
func PathExists ¶
PathExists checks if a path exists on the filesystem or returns an error
func PruneEmptyDirsInPath ¶
PruneEmptyDirsInPath removes all empty directories located within the path
func UnarchiveTgz ¶
func UnarchiveTgz(ctx context.Context, fs billy.Filesystem, tgzPath, tgzSubdirectory, destPath string, overwrite bool) error
UnarchiveTgz attempts to unarchive the tgz file found at tgzPath in the filesystem
func UpdatePermissions ¶
UpdatePermissions updates the permissions for a given path to the mode provided
func UpdateYamlFile ¶ added in v1.6.5
UpdateYamlFile receives a map and updates a yaml file
func WalkAssetsFolderTgzFiles ¶ added in v1.6.5
WalkAssetsFolderTgzFiles will walk and retrieve all .tgz files on the assets folder.
func WalkDir ¶
func WalkDir(ctx context.Context, fs billy.Filesystem, dirPath string, doFunc RelativePathFunc) error
WalkDir walks through a directory given by dirPath rooted in the filesystem and performs doFunc at the path The path on each call will be relative to the filesystem provided.
func WalkFilteredAssetsFolder ¶ added in v1.6.5
func WalkFilteredAssetsFolder(ctx context.Context, imageTagMap, filter map[string][]string, chartsToIgnoreTags map[string]string) error
WalkAssetsFolder walks over the assets folder, untars files if their name matches one of the filter values, stores the values.yaml content into a map and then iterates over the map to collect the image repo and tag values into another map.
Types ¶
type RelativePathFunc ¶
RelativePathFunc is a function that is applied on a relative path within the given filesystem
type RelativePathPairFunc ¶
type RelativePathPairFunc func(ctx context.Context, fs billy.Filesystem, leftPath, rightPath string, isDir bool) error
RelativePathPairFunc is a function that is applied on a pair of relative paths in a filesystem
type StreamReader ¶ added in v1.6.5
type StreamReader func() (io.ReadCloser, error)
StreamReader func() type is callback function for custom filesystem file loading behavior