Documentation ¶
Index ¶
- Variables
- func AbsFile(workspace string, filename string) (string, error)
- func AbsolutePaths(workspace string, paths []string) []string
- func BoolPtr(b bool) *bool
- func CloneThroughJSON(old interface{}, new interface{}) error
- func CreateMappedTar(w io.Writer, root string, pathMap map[string]string) error
- func CreateTar(w io.Writer, root string, paths []string) error
- func CreateTarGz(w io.Writer, root string, paths []string) error
- func Download(url string) ([]byte, error)
- func ExecuteEnvTemplate(envTemplate *template.Template, customMap map[string]string) (string, error)
- func Expand(text, key, value string) string
- func ExpandPathsGlob(workingDir string, paths []string) ([]string, error)
- func GetAvailablePort(port int, forwardedPorts *sync.Map) int
- func HasMeta(path string) bool
- func IsHiddenDir(filename string) bool
- func IsHiddenFile(filename string) bool
- func IsSupportedKubernetesFormat(n string) bool
- func IsURL(s string) bool
- func NonEmptyLines(input []byte) []string
- func ParseEnvTemplate(t string) (*template.Template, error)
- func RandomFourCharacterID() string
- func RandomID() string
- func ReadConfiguration(filename string) ([]byte, error)
- func RemoveFromSlice(s []string, target string) []string
- func RunCmd(cmd *exec.Cmd) error
- func RunCmdOut(cmd *exec.Cmd) ([]byte, error)
- func SHA256(r io.Reader) (string, error)
- func StrSliceContains(sl []string, s string) bool
- func StringPtr(s string) *string
- func SubstituteDefaultRepoIntoImage(defaultRepo string, originalImage string) string
- func VerifyOrCreateFile(path string) error
- type Command
- type CommandWrapper
- type Commander
Constants ¶
This section is empty.
Variables ¶
var OSEnviron = os.Environ
var SkipWrapperCheck = false
Functions ¶
func AbsFile ¶ added in v0.16.0
AbsFile resolves the absolute path of the file named filename in directory workspace, erroring if it is not a file
func AbsolutePaths ¶ added in v0.24.0
AbsolutePaths prepends each path in paths with workspace if the path isn't absolute
func CloneThroughJSON ¶ added in v0.23.0
func CloneThroughJSON(old interface{}, new interface{}) error
CloneThroughJSON marshals the old interface into the new one
func CreateMappedTar ¶ added in v0.23.0
func ExecuteEnvTemplate ¶ added in v0.7.0
func ExecuteEnvTemplate(envTemplate *template.Template, customMap map[string]string) (string, error)
ExecuteEnvTemplate executes an envTemplate based on OS environment variables and a custom map
func Expand ¶ added in v0.15.0
Expand replaces placeholders for a given key with a given value. It supports the ${key} and the $key syntax.
func ExpandPathsGlob ¶
ExpandPathsGlob expands paths according to filepath.Glob patterns Returns a list of unique files that match the glob patterns passed in.
func GetAvailablePort ¶ added in v0.25.0
See https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.txt,
func HasMeta ¶ added in v0.16.0
HasMeta reports whether path contains any of the magic characters recognized by filepath.Match. This is a copy of filepath/match.go's hasMeta
func IsHiddenDir ¶ added in v0.25.0
IsHiddenDir returns if a directory is hidden.
func IsHiddenFile ¶ added in v0.25.0
IsHiddenFile returns if a file is hidden. File is hidden if it starts with prefix "."
func IsSupportedKubernetesFormat ¶
IsSupportedKubernetesFormat is for determining if a file under a glob pattern is deployable file format. It makes no attempt to check whether or not the file is actually deployable or has the correct contents.
func NonEmptyLines ¶ added in v0.17.0
NonEmptyLines scans the provided input and returns the non-empty strings found as an array
func ParseEnvTemplate ¶ added in v0.7.0
ParseEnvTemplate is a simple wrapper to parse an env template
func RandomFourCharacterID ¶ added in v0.23.0
func RandomFourCharacterID() string
func ReadConfiguration ¶ added in v0.4.0
func RemoveFromSlice ¶ added in v0.14.0
RemoveFromSlice removes a string from a slice of strings
func StrSliceContains ¶
func SubstituteDefaultRepoIntoImage ¶ added in v0.17.0
func VerifyOrCreateFile ¶ added in v0.13.0
VerifyOrCreateFile checks if a file exists at the given path, and if not, creates all parent directories and creates the file.
Types ¶
type Command ¶
Command is an interface used to run commands. All packages should use this interface instead of calling exec.Cmd directly.
type CommandWrapper ¶ added in v0.16.0
type CommandWrapper struct { // Executable is the base name of the command, like `gradle` Executable string // Wrapper is the optional base name of a command wrapper, like `gradlew` Wrapper string }
CommandWrapper defines an association between an executable command (like `gradle`) and possible command wrappers (like `gradlew`). `CreateCommand` uses this definition to create a `Cmd` object. Maven and Gradle projects often provide a wrapper script to ensure a particular version of their builder is used.
func (CommandWrapper) CreateCommand ¶ added in v0.16.0
func (cw CommandWrapper) CreateCommand(ctx context.Context, workingDir string, args []string) *exec.Cmd
CreateCommand creates an `exec.Cmd` that is configured to call the executable (possibly using a wrapper in `workingDir`, when found) with the given arguments, with working directory set to `workingDir`.