Documentation ¶
Index ¶
- func CreateInjectedFilesRemovalScript(files []string, scriptName string) (string, error)
- func ExpandInjectedFiles(injections api.InjectionList) ([]string, error)
- func FixInjectionsWithRelativePath(workdir string, injections *api.InjectionList)
- func GenerateLabelsFromConfig(labels map[string]string, config *api.Config, namespace string) map[string]string
- func GenerateLabelsFromSourceInfo(labels map[string]string, info *api.SourceInfo, namespace string) map[string]string
- func GenerateOutputImageLabels(info *api.SourceInfo, config *api.Config) map[string]string
- func HandleInjectionError(p api.InjectPath, err error) error
- func IsTimeoutError(e error) bool
- func ReadEnvironmentFile(path string) (map[string]string, error)
- func TimeoutAfter(t time.Duration, errorMsg string, fn func() error) error
- type CallbackInvoker
- type CommandOpts
- type CommandRunner
- type FileSystem
- type InterruptHandler
- type TimeoutError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateInjectedFilesRemovalScript ¶ added in v1.0.5
CreateInjectedFilesRemovalScript 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 ExpandInjectedFiles ¶ added in v1.0.5
func ExpandInjectedFiles(injections api.InjectionList) ([]string, error)
ExpandInjectedFiles returns a flat list of all files that are injected into a container. All files from nested directories are returned in the list.
func FixInjectionsWithRelativePath ¶ added in v1.0.5
func FixInjectionsWithRelativePath(workdir string, injections *api.InjectionList)
FixInjectionsWithRelativePath fixes the injections that does not specify the destination directory or the directory is relative to use the provided working directory.
func GenerateLabelsFromConfig ¶ added in v1.0.2
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 ¶ added in v1.0.2
func GenerateLabelsFromSourceInfo(labels map[string]string, info *api.SourceInfo, namespace string) map[string]string
GenerateLabelsFromSourceInfo generate the labels based on the source repository informations.
func GenerateOutputImageLabels ¶ added in v1.0.1
GenerateOutputImageLabels generate the labels based on the s2i Config and source repository informations.
func HandleInjectionError ¶ added in v1.0.5
func HandleInjectionError(p api.InjectPath, err error) error
HandleInjectionError handles the error caused by injection and provide reasonable suggestion to users.
func IsTimeoutError ¶ added in v1.0.6
IsTimeoutError checks if the provided error is timeout.
func ReadEnvironmentFile ¶ added in v1.0.1
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).
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 CommandOpts ¶
CommandOpts contains options to attach Stdout/err to a command to run or set its initial directory
type CommandRunner ¶
type CommandRunner interface { RunWithOptions(opts CommandOpts, name string, arg ...string) error Run(name string, arg ...string) error }
CommandRunner executes OS commands with the given parameters and options
func NewCommandRunner ¶
func NewCommandRunner() CommandRunner
NewCommandRunner creates a new instance of the default implementation of CommandRunner
type FileSystem ¶
type FileSystem interface { Chmod(file string, mode os.FileMode) error Rename(from, to string) error MkdirAll(dirname string) error Mkdir(dirname string) error Exists(file string) bool Copy(sourcePath, targetPath string) error CopyContents(sourcePath, targetPath string) error RemoveDirectory(dir string) error CreateWorkingDirectory() (string, error) Open(file string) (io.ReadCloser, error) WriteFile(file string, data []byte) error ReadDir(string) ([]os.FileInfo, error) Stat(string) (os.FileInfo, error) }
FileSystem allows STI to work with the file system and perform tasks such as creating and deleting directories
func NewFileSystem ¶
func NewFileSystem() FileSystem
NewFileSystem creates a new instance of the default FileSystem implementation
type InterruptHandler ¶ added in v1.0.6
type InterruptHandler struct {
// contains filtered or unexported fields
}
func NewInterruptHandler ¶ added in v1.0.6
func NewInterruptHandler(final func(os.Signal), notify ...func()) *InterruptHandler
New creates a new Handler. The first argument will be called only if a terminating signal is received, it will be the last function called. It is this function's responsibility to call os.Exit() if exiting is desired. If the first argument is nil, this Handler will call os.Exit when the signal is received. The second+ arguments are functions that will be called when the signal is received, or after the argument to Run() completes.
func (*InterruptHandler) Close ¶ added in v1.0.6
func (h *InterruptHandler) Close()
Close invokes the notify functions of the Handler when no signal was received and Run() completed.
func (*InterruptHandler) Run ¶ added in v1.0.6
func (h *InterruptHandler) Run(fn func() error) error
Run takes a single function argument which will be immediately invoked. If a signal arrives while the function is running, it will be handled, interrupting the function execution and executing any final and notify functions immediately. The original function may or may not complete depending on whether the final argument invoking os.Exit.
func (*InterruptHandler) Signal ¶ added in v1.0.6
func (h *InterruptHandler) Signal(s os.Signal)
Signal invokes the notify functions of the Handler when a signal is received. It also invokes final, if any, otherwise it invokes os.Exit.
type TimeoutError ¶ added in v1.0.6
type TimeoutError struct {
// contains filtered or unexported fields
}
TimeoutError is error returned after timeout occured.
func (*TimeoutError) Error ¶ added in v1.0.6
func (t *TimeoutError) Error() string
Error implements the Go error interface.