Documentation ¶
Index ¶
- func AdjustConfigWithImageLabels(cfg *api.Config) (string, string)
- func CreateInjectionResultFile(injectErr error) (string, error)
- func CreateTruncateFilesScript(files []string, scriptName string) (string, error)
- func FirstNonEmpty(args ...string) string
- func FixInjectionsWithRelativePath(workdir string, injections api.VolumeList) api.VolumeList
- func GenerateLabelsFromConfig(labels map[string]string, config *api.Config, namespace string) map[string]string
- func GenerateLabelsFromSourceInfo(labels map[string]string, info *git.SourceInfo, namespace string) map[string]string
- func GenerateOutputImageLabels(info *git.SourceInfo, config *api.Config) map[string]string
- func HandleInjectionError(p api.VolumeSpec, err error) error
- func Includes(arr []string, str string) bool
- func IsTimeoutError(e error) bool
- func ListFiles(fs fs.FileSystem, spec api.VolumeSpec) ([]string, error)
- func ListFilesToTruncate(fs fs.FileSystem, injections api.VolumeList) ([]string, error)
- func ReadEnvironmentFile(path string) (map[string]string, error)
- func SafeForLoggingContainerConfig(config *container.Config) *container.Config
- func SafeForLoggingEnv(env []string) []string
- func SafeForLoggingURL(input string) (string, error)
- func TimeoutAfter(t time.Duration, errorMsg string, f func(*time.Timer) error) error
- type CallbackInvoker
- type TimeoutError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AdjustConfigWithImageLabels ¶
AdjustConfigWithImageLabels examines previously retrieved builder image labels and returns any specified update to the scripts URL and destination settings. Note, we do not set those fields in the Config object itself, so as to not confuse the s2i build case in which the script install code expects those values to set via the explicit command line argument overrides. Otherwise, we can inadvertently override scripts from the source repo.
func CreateInjectionResultFile ¶
CreateInjectionResultFile creates a result file with the message from the provided injection error. The path to the result file is returned. If the provided error is nil, an empty file is created.
func CreateTruncateFilesScript ¶
CreateTruncateFilesScript creates a shell script that contains truncation of all files we injected into the container. The path to the script is returned. When the scriptName is provided, it is also truncated together with all secrets.
func FirstNonEmpty ¶
FirstNonEmpty returns the first non-empty string in the provided list of strings.
func FixInjectionsWithRelativePath ¶
func FixInjectionsWithRelativePath(workdir string, injections api.VolumeList) api.VolumeList
FixInjectionsWithRelativePath fixes the injections that does not specify the destination directory or the directory is relative to use the provided working directory.
func GenerateLabelsFromConfig ¶
func GenerateLabelsFromConfig(labels map[string]string, config *api.Config, namespace string) map[string]string
GenerateLabelsFromConfig generate the labels based on build s2i Config
func GenerateLabelsFromSourceInfo ¶
func GenerateLabelsFromSourceInfo(labels map[string]string, info *git.SourceInfo, namespace string) map[string]string
GenerateLabelsFromSourceInfo generate the labels based on the source repository informations.
func GenerateOutputImageLabels ¶
GenerateOutputImageLabels generate the labels based on the s2i Config and source repository informations.
func HandleInjectionError ¶
func HandleInjectionError(p api.VolumeSpec, err error) error
HandleInjectionError handles the error caused by injection and provide reasonable suggestion to users.
func IsTimeoutError ¶
IsTimeoutError checks if the provided error is a TimeoutError.
func ListFiles ¶
func ListFiles(fs fs.FileSystem, spec api.VolumeSpec) ([]string, error)
ListFiles returns a flat list of all files injected into a container for the given `VolumeSpec`.
func ListFilesToTruncate ¶
func ListFilesToTruncate(fs fs.FileSystem, injections api.VolumeList) ([]string, error)
ListFilesToTruncate returns a flat list of all files that are injected into a container which need to be truncated. All files from nested directories are returned in the list.
func ReadEnvironmentFile ¶
ReadEnvironmentFile reads the content for a file that contains a list of environment variables and values. The key-pairs are separated by a new line character. The file can also have comments (both '#' and '//' are supported).
func SafeForLoggingContainerConfig ¶
SafeForLoggingContainerConfig returns a copy of the container.Config object with sensitive information (proxy environment variables containing credentials) redacted.
func SafeForLoggingEnv ¶
SafeForLoggingEnv attempts to strip sensitive information from proxy environment variable strings in key=value form.
func SafeForLoggingURL ¶
SafeForLoggingURL removes the user:password section of a url if present. If not present or the value is unparseable, the value is returned unchanged.
func TimeoutAfter ¶
TimeoutAfter executes the provided function and returns TimeoutError in the case that the execution time of the function exceeded the provided duration. The provided function is passed the timer in case it wishes to reset it. If so, the following pattern must be used:
if !timer.Stop() { return &TimeoutError{} }
timer.Reset(timeout)
Types ¶
type CallbackInvoker ¶
type CallbackInvoker interface {
ExecuteCallback(callbackURL string, success bool, labels map[string]string, messages []string) []string
}
CallbackInvoker posts results to a callback URL when a STI build is done.
func NewCallbackInvoker ¶
func NewCallbackInvoker() CallbackInvoker
NewCallbackInvoker creates an instance of the default CallbackInvoker implementation
type TimeoutError ¶
type TimeoutError struct {
// contains filtered or unexported fields
}
TimeoutError is error returned after timeout occurred.
func (*TimeoutError) Error ¶
func (t *TimeoutError) Error() string
Error implements the Go error interface.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package status provides functionality to update the status of a build with information about failures that occurred.
|
Package status provides functionality to update the status of a build with information about failures that occurred. |