Documentation ¶
Index ¶
- func AppendError(errs []error, err error) []error
- func AppendField(fields []string, flag, prefix string) []string
- func EnsureExecutable(p string) error
- func ExecError(err error) string
- func ExtractField(fields []string, target string) ([]string, string, bool)
- func FlushMem()
- func Home(parts ...string) string
- func InsertPath(path string) error
- func JSONForDebug(o interface{}) string
- func JoinURL(urlPath, path string) (string, error)
- func K8s(topdir string, parts ...string) string
- func MigrateOptions(m []MigratedOption) error
- func PushEnv(env, value string) (func() error, error)
- func Pushd(dir string) (func() error, error)
- func SetFieldDefault(fields []string, flag, val string) []string
- type MigratedOption
- type TestCase
- type TestSuite
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendError ¶
AppendError does append(errs, err) if err != nil
func AppendField ¶
AppendField will append prefix to the flag value.
For example, AppendField(fields, "--foo", "bar") if fields is empty or does not contain a "--foo" it will simply append a "--foo=bar" value. Otherwise if fields contains "--foo=current" it will replace this value with "--foo=current-bar
func EnsureExecutable ¶
EnsureExecutable sets the executable file mode bits, for all users, to ensure that we can execute a file
func ExecError ¶
ExecError returns a string format of err including stderr if the err is an ExitError, useful for errors from e.g. exec.Cmd.Output().
func ExtractField ¶
ExtractField input ("--a=this --b=that --c=other", "--b") returns [--a=this, --c=other"], "that", true
In other words, it will remove "--b" from fields and return the previous value of "--b" if it was set.
func FlushMem ¶
func FlushMem()
FlushMem will try to reduce the memory usage of the container it is running in run this after a build
func JSONForDebug ¶
func JSONForDebug(o interface{}) string
JSONForDebug returns a json representation of the value, or a string representation of an error It is useful for an easy implementation of fmt.Stringer
func MigrateOptions ¶
func MigrateOptions(m []MigratedOption) error
MigrateOptions reads value from ENV if --flag unset, optionally pushing to ENV
func SetFieldDefault ¶
SetFieldDefault sets the value of flag to val if flag is not present in fields.
For example, SetFieldDefault(fields, "--foo", "bar") will append "--foo=bar" if fields is empty or does not include a "--foo" flag. It returns fields unchanged if "--foo" is present.
Types ¶
type MigratedOption ¶
type MigratedOption struct { Env string // env associated with --flag Option *string // Value of --flag Name string // --flag name SkipPush bool // Push option to env if false }
MigratedOption is an option that was an ENV that is now a --flag
type TestCase ¶
type TestCase struct { XMLName xml.Name `xml:"testcase"` ClassName string `xml:"classname,attr"` Name string `xml:"name,attr"` Time float64 `xml:"time,attr"` Failure string `xml:"failure,omitempty"` Skipped string `xml:"skipped,omitempty"` }
TestCase holds the result of a test/step/command.
This will become a row in testgrid.
type TestSuite ¶
type TestSuite struct { XMLName xml.Name `xml:"testsuite"` Failures int `xml:"failures,attr"` Tests int `xml:"tests,attr"` Time float64 `xml:"time,attr"` Cases []TestCase }
TestSuite holds a slice of TestCase and other summary metadata.
A build (column in testgrid) is composed of one or more TestSuites.