file_reader

package
v1.2.77 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const GiterminismConfigName = "werf-giterminism.yaml"

Variables

View Source
var DefaultWerfConfigNames = []string{"werf.yaml", "werf.yml"}
View Source
var DefaultWerfConfigTemplatesDirName = ".werf"

Functions

func IsFileNotFoundInProjectDirectoryError

func IsFileNotFoundInProjectDirectoryError(err error) bool

Types

type FileNotAcceptedError

type FileNotAcceptedError FileReaderError

type FileNotFoundInProjectDirectoryError

type FileNotFoundInProjectDirectoryError FileReaderError

type FileNotFoundInProjectRepositoryError

type FileNotFoundInProjectRepositoryError FileReaderError

type FileReader

type FileReader struct {
	// contains filtered or unexported fields
}

func NewFileReader

func NewFileReader(sharedOptions sharedOptions) FileReader

func (FileReader) CheckCommitFileExistenceAndLocalChanges

func (r FileReader) CheckCommitFileExistenceAndLocalChanges(ctx context.Context, relPath string) (err error)

CheckCommitFileExistenceAndLocalChanges returns nil if the file exists and does not have any uncommitted changes locally (each symlink target).

func (FileReader) CheckConfigurationFileExistenceAndAcceptance

func (r FileReader) CheckConfigurationFileExistenceAndAcceptance(ctx context.Context, relPath string, isFileAcceptedCheckFunc func(relPath string) bool) (err error)

CheckConfigurationFileExistenceAndAcceptance does CheckFileExistenceAndAcceptance or CheckCommitFileExistenceAndLocalChanges depending on the giterminism config.

func (FileReader) CheckFileExistenceAndAcceptance

func (r FileReader) CheckFileExistenceAndAcceptance(ctx context.Context, relPath string, isFileAcceptedCheckFunc func(relPath string) bool) (err error)

CheckFileExistenceAndAcceptance returns nil if the resolved file exists and is fully accepted by the giterminism config (each symlink target must be accepted if the file path accepted)

func (FileReader) ConfigGoTemplateFilesGet

func (r FileReader) ConfigGoTemplateFilesGet(ctx context.Context, relPath string) ([]byte, error)

func (FileReader) ConfigGoTemplateFilesGlob

func (r FileReader) ConfigGoTemplateFilesGlob(ctx context.Context, glob string) (map[string]interface{}, error)

func (FileReader) HandleValidateStatusResultError added in v1.2.10

func (r FileReader) HandleValidateStatusResultError(err error) error

func (FileReader) IsCommitFileExist

func (r FileReader) IsCommitFileExist(ctx context.Context, relPath string) (bool, error)

func (FileReader) IsCommitTreeEntryDirectory added in v1.2.7

func (r FileReader) IsCommitTreeEntryDirectory(ctx context.Context, relPath string) (bool, error)

func (FileReader) IsCommitTreeEntryExist

func (r FileReader) IsCommitTreeEntryExist(ctx context.Context, relPath string) (bool, error)

func (FileReader) IsConfigExistAnywhere

func (r FileReader) IsConfigExistAnywhere(ctx context.Context, customRelPath string) (exist bool, err error)

func (FileReader) IsConfigurationFileExist

func (r FileReader) IsConfigurationFileExist(ctx context.Context, relPath string, isFileAcceptedCheckFunc func(relPath string) bool) (exist bool, err error)

IsConfigurationFileExist checks the configuration file existence taking into account the giterminism config. The method does not check acceptance for each symlink target if the configuration file is symlink.

func (FileReader) IsConfigurationFileExistAnywhere

func (r FileReader) IsConfigurationFileExistAnywhere(ctx context.Context, relPath string) (exist bool, err error)

IsConfigurationFileExistAnywhere returns true if the configuration file exists in the project directory or in the project repository.

func (FileReader) IsDirectoryExist

func (r FileReader) IsDirectoryExist(ctx context.Context, relPath string) (exist bool, err error)

IsDirectoryExist resolves symlinks and returns true if the resolved file is a directory.

func (FileReader) IsDockerignoreExistAnywhere

func (r FileReader) IsDockerignoreExistAnywhere(ctx context.Context, relPath string) (exist bool, err error)

func (FileReader) IsFileModifiedLocally added in v1.2.7

func (r FileReader) IsFileModifiedLocally(ctx context.Context, relPath string) (modified bool, err error)

IsFileModifiedLocally checks for the file changes in worktree or index.

func (FileReader) IsGiterminismConfigExistAnywhere

func (r FileReader) IsGiterminismConfigExistAnywhere(ctx context.Context) (exist bool, err error)

func (FileReader) IsRegularFileExist

func (r FileReader) IsRegularFileExist(ctx context.Context, relPath string) (exist bool, err error)

IsRegularFileExist resolves symlinks and returns true if the resolved file is a regular file.

func (FileReader) ListCommitFilesWithGlob

func (r FileReader) ListCommitFilesWithGlob(ctx context.Context, dir string, pattern string) (files []string, err error)

func (FileReader) ListFilesWithGlob

func (r FileReader) ListFilesWithGlob(ctx context.Context, relDir, glob string, skipFileFunc func(ctx context.Context, r FileReader, existingRelPath string) (bool, error)) (files []string, err error)

ListFilesWithGlob returns the list of files by the glob, follows symlinks. The result paths are relative to the passed directory, the method does reverse resolving for symlinks.

func (FileReader) LoadChartDir

func (r FileReader) LoadChartDir(ctx context.Context, chartDir string) ([]*chart.ChartExtenderBufferedFile, error)

func (FileReader) LocateChart

func (r FileReader) LocateChart(ctx context.Context, chartDir string, settings *cli.EnvSettings) (string, error)

func (FileReader) NewFileNotFoundInProjectDirectoryError

func (r FileReader) NewFileNotFoundInProjectDirectoryError(relPath string) error

func (FileReader) NewFileNotFoundInProjectRepositoryError

func (r FileReader) NewFileNotFoundInProjectRepositoryError(relPath string) error

func (FileReader) NewSubmoduleAddedAndNotCommittedError added in v1.2.8

func (r FileReader) NewSubmoduleAddedAndNotCommittedError(submodulePath string) error

func (FileReader) NewSubmoduleCommitChangedError added in v1.2.8

func (r FileReader) NewSubmoduleCommitChangedError(submodulePath string) error

func (FileReader) NewSubmoduleDeletedError added in v1.2.8

func (r FileReader) NewSubmoduleDeletedError(submodulePath string) error

func (FileReader) NewSubmoduleHasUncommittedChangesError added in v1.2.8

func (r FileReader) NewSubmoduleHasUncommittedChangesError(submodulePath string) error

func (FileReader) NewSubmoduleHasUntrackedChangesError added in v1.2.8

func (r FileReader) NewSubmoduleHasUntrackedChangesError(submodulePath string) error

func (FileReader) NewUncommittedFilesError

func (r FileReader) NewUncommittedFilesError(relPaths ...string) error

func (FileReader) NewUntrackedFilesError added in v1.2.10

func (r FileReader) NewUntrackedFilesError(relPaths ...string) error

func (FileReader) PrepareConfigNotFoundError

func (r FileReader) PrepareConfigNotFoundError(ctx context.Context, configPathsToCheck []string) (err error)

func (FileReader) ReadAndCheckConfigurationFile

func (r FileReader) ReadAndCheckConfigurationFile(ctx context.Context, relPath string, isFileAcceptedCheckFunc func(relPath string) bool) (data []byte, err error)

ReadAndCheckConfigurationFile does CheckConfigurationFileExistenceAndAcceptance and ReadConfigurationFile.

func (FileReader) ReadChartFile

func (r FileReader) ReadChartFile(ctx context.Context, path string) ([]byte, error)

func (FileReader) ReadCommitFile

func (r FileReader) ReadCommitFile(ctx context.Context, relPath string) ([]byte, error)

func (FileReader) ReadCommitTreeEntryContent

func (r FileReader) ReadCommitTreeEntryContent(ctx context.Context, relPath string) ([]byte, error)

func (FileReader) ReadConfig

func (r FileReader) ReadConfig(ctx context.Context, customRelPath string) (path string, data []byte, err error)

func (FileReader) ReadConfigTemplateFiles

func (r FileReader) ReadConfigTemplateFiles(ctx context.Context, customDirRelPath string, tmplFunc func(templatePathInsideDir string, data []byte, err error) error) (err error)

func (FileReader) ReadConfigurationFile

func (r FileReader) ReadConfigurationFile(ctx context.Context, relPath string, isFileAcceptedCheckFunc func(relPath string) bool) (data []byte, err error)

ReadConfigurationFile does ReadFile or ReadCommitFile depending on the giterminism config.

func (FileReader) ReadDockerfile

func (r FileReader) ReadDockerfile(ctx context.Context, relPath string) (data []byte, err error)

func (FileReader) ReadDockerignore

func (r FileReader) ReadDockerignore(ctx context.Context, relPath string) (data []byte, err error)

func (FileReader) ReadFile

func (r FileReader) ReadFile(ctx context.Context, relPath string) (data []byte, err error)

ReadFile returns the project file data.

func (FileReader) ReadGiterminismConfig

func (r FileReader) ReadGiterminismConfig(ctx context.Context) (data []byte, err error)

func (FileReader) ResolveAndCheckCommitFilePath

func (r FileReader) ResolveAndCheckCommitFilePath(ctx context.Context, relPath string, checkSymlinkTargetFunc func(resolvedRelPath string) error) (string, error)

func (FileReader) ResolveAndCheckFilePath

func (r FileReader) ResolveAndCheckFilePath(ctx context.Context, relPath string, checkFunc func(resolvedPath string) error) (resolvedPath string, err error)

ResolveAndCheckFilePath resolves the path and run checkFunc for every file path resolve.

func (FileReader) ResolveFilePath

func (r FileReader) ResolveFilePath(ctx context.Context, relPath string) (resolvedPath string, err error)

func (*FileReader) SetGiterminismConfig

func (r *FileReader) SetGiterminismConfig(giterminismConfig giterminismConfig)

func (FileReader) ShouldFileBeRead

func (r FileReader) ShouldFileBeRead(ctx context.Context, relPath string, isFileAcceptedCheckFunc func(relPath string) bool) (should bool, err error)

ShouldFileBeRead return true if not resolved path accepted by giterminism config.

func (FileReader) SkipFileFunc added in v1.2.7

func (r FileReader) SkipFileFunc(acceptedFilePathMatcher path_matcher.PathMatcher) func(ctx context.Context, r FileReader, existingRelPath string) (bool, error)

func (FileReader) StatusPathList added in v1.2.8

func (r FileReader) StatusPathList(ctx context.Context, pathMatcher path_matcher.PathMatcher) (list []string, err error)

func (FileReader) ValidateFileByStatusResult added in v1.2.10

func (r FileReader) ValidateFileByStatusResult(ctx context.Context, relPath string) error

func (FileReader) ValidateStatusResult added in v1.2.10

func (r FileReader) ValidateStatusResult(ctx context.Context, pathMatcher path_matcher.PathMatcher) (err error)

func (FileReader) WalkConfigurationFilesWithGlob

func (r FileReader) WalkConfigurationFilesWithGlob(ctx context.Context, dir, glob string, acceptedFilePathMatcher path_matcher.PathMatcher, handleFileFunc func(relativeToDirNotResolvedPath string, data []byte, err error) error) (err error)

WalkConfigurationFilesWithGlob reads the configuration files taking into account the giterminism config. The result paths are relative to the passed directory, the method does reverse resolving for symlinks.

type FileReaderError added in v1.2.10

type FileReaderError struct {
	// contains filtered or unexported fields
}

type UncommittedFilesError

type UncommittedFilesError FileReaderError

type UntrackedFilesError added in v1.2.10

type UntrackedFilesError FileReaderError

Jump to

Keyboard shortcuts

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