Documentation ¶
Index ¶
- func ApplyTemplate(dir string, data interface{}, deleteSources bool, strict bool) error
- func CloneRepo(ctx context.Context, url string, ref string, path string) error
- func CompareJSONObjs(t *testing.T, exp kruntime.Object, actual kruntime.Object)
- func Confirm(ctx context.Context, prompt string, skip bool) (bool, error)
- func DirExists(path string) (bool, error)
- func FileExists(path string) (bool, error)
- func GetContents(t *testing.T, root string) map[string][]string
- func GetFileContents(t *testing.T, path string) string
- func RecursiveCopy(srcDir string, destDir string) error
- func RemoveDirs(rootDir string, indicatorName string) error
- func RunCmdWithPrinters(ctx context.Context, command string, args []string, extraEnv []string, ...) error
- func WriteFiles(t *testing.T, baseDir string, files map[string]string)
- type Printer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyTemplate ¶
ApplyTemplate runs golang templating on all files in the provided path, replacing them in-place with their templated versions.
func CloneRepo ¶
CloneRepo makes a shallow clone of the argument repo at a single ref.
See https://stackoverflow.com/questions/3489173/how-to-clone-git-repository-with-specific-revision-changeset for a discussion of the commands run.
func CompareJSONObjs ¶
CompareJSONObjs compares two objects via their JSON representations. This is much easier to debug that comparing the objects directly.
func Confirm ¶
Confirm gets a yes/no confirmation from the user on the command-line before continuing.
func FileExists ¶
FileExists returns whether the given path exists and is a file.
func GetContents ¶
GetContents returns the contents of a directory as a map from file name to string content lines.
func GetFileContents ¶
GetFileContents gets the string contents of a single file.
func RecursiveCopy ¶
RecursiveCopy does a recursive copy from the source directory to the destination one.
func RemoveDirs ¶
RemoveDirs removes all directories that contain a file with the specified indicatorName (e.g., ".noexpand"). This is used to prune directories that are used for templating/generation but are not valid kube configs.
func RunCmdWithPrinters ¶
func RunCmdWithPrinters( ctx context.Context, command string, args []string, extraEnv []string, blockedEnv map[string]struct{}, stdoutPrinter Printer, stderrPrinter Printer, ) error
RunCmdWithPrinters runs a command with output streamed via custom printer functions. Adapted from example in https://github.com/golang/go/issues/19685#issuecomment-288949629.
Types ¶
type Printer ¶
type Printer func(input string)
Printer is a function that prints out a string, e.g. to stdout.
func LogrusDebugPrinter ¶
LogrusDebugPrinter returns a printer that prints via logrus at the debug level.
func LogrusInfoPrinter ¶
LogrusInfoPrinter returns a printer that prints via logrus at the info level.
func LogrusWarnPrinter ¶
LogrusWarnPrinter returns a printer that prints via logrus at the warn level.