Documentation ¶
Index ¶
- func Contains(slice []string, s string) bool
- func CreateTempFile(fs afero.Fs, content string) (afero.File, error)
- func FindHelmRepoCredentials(url string, credentials []models.RepoCredentials) (string, string)
- func GetEnv(key, fallback string) string
- func StripHelmLabels(file string) ([]byte, error)
- func WriteToFile(fs afero.Fs, file string, data []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Contains ¶
Contains checks if a string `s` is present in the given string slice `slice`. It iterates over each item in the slice and returns true if a match is found. If no match is found, it returns false.
func CreateTempFile ¶ added in v0.2.1
CreateTempFile creates a temporary file in the "/tmp" directory with a unique name that has the prefix "compare-" and suffix ".yaml". It then writes the provided content to this temporary file. The function returns a pointer to the created os.File if it succeeds. If the function fails at any step, it returns an error wrapped with context about what step of the process it failed at.
func FindHelmRepoCredentials ¶ added in v0.2.1
func FindHelmRepoCredentials(url string, credentials []models.RepoCredentials) (string, string)
FindHelmRepoCredentials scans the provided array of RepoCredentials for a match to the provided repository URL, and returns the associated username and password. If no matching credentials are found, it returns two empty strings.
func GetEnv ¶
GetEnv retrieves the value of an environment variable specified by the given key. If the environment variable is set, its value is returned. If the environment variable is not set, the provided fallback value is returned.
func StripHelmLabels ¶ added in v0.0.5
StripHelmLabels removes the specified Helm labels from the content of a file. The function takes a file path as input and returns the stripped file content as a byte slice. It removes the labels listed in the `labels` slice using regular expressions. The function returns an error if there is an issue reading the file.
func WriteToFile ¶ added in v0.2.1
WriteToFile writes the provided data to a file specified by the file path. It takes a file path and a byte slice of data as input. The function writes the data to the file with the specified file permissions (0644). It returns an error if there is an issue writing to the file.
Types ¶
This section is empty.