util

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 29, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BashWrap

func BashWrap(cmd string) string

func ChmodX

func ChmodX(filePath string) (string, error)

ChmodX executes chmod +x on given filepath

func DoOrDie

func DoOrDie(err error)

func DoOrDieWithMsg

func DoOrDieWithMsg(err error, msg string)

func FinishRunning

func FinishRunning(stepName string, cmd *exec.Cmd) (bool, string, string)

func GenerateRandomString

func GenerateRandomString(length int) string

TODO: explore https://github.com/oklog/ulid

func GetExecCommandFromString

func GetExecCommandFromString(fullCmd string) *exec.Cmd

func GetFilesAndDirectories

func GetFilesAndDirectories(path string) (string, []string, []string, error)

func GetHomeDir

func GetHomeDir() string

func ParseImageName

func ParseImageName(image string) string

ParseImageName takes a docker image string and returns the name image := "docker.io/blackducksoftware/synopsys-operator:latest" subMatch = [blackducksoftware/synopsys-operator:latest docker.io/blackducksoftware/ synopsys-operator :latest]

func ParseImageRepo

func ParseImageRepo(image string) string

ParseImageRepo takes a docker image string and returns the repo image := "docker.io/blackducksoftware/synopsys-operator:latest" subMatch = [blackducksoftware/synopsys-operator:latest docker.io/blackducksoftware/ synopsys-operator :latest]

func ParseImageTag

func ParseImageTag(image string) string

ParseImageTag takes a docker image string and returns the tag image := "docker.io/blackducksoftware/synopsys-operator:latest" subMatch = [blackducksoftware/synopsys-operator:latest latest]

func RunBash

func RunBash(stepName, bashFragment string) bool

func RunBashWithOutputs

func RunBashWithOutputs(stepName, bashFragment string) (bool, string, string)

func RunCommand

func RunCommand(cmd *exec.Cmd) (string, error)

func RunCommandAndCaptureProgress

func RunCommandAndCaptureProgress(cmd *exec.Cmd) error

RunCommandAndCaptureProgress runs a long running command and continuously streams its output

func RunCommandBasedOnLoggingLevel

func RunCommandBasedOnLoggingLevel(cmd *exec.Cmd) error

func RunRawBash

func RunRawBash(stepName, bashFragment string) bool

func RunRawBashWithOutputs

func RunRawBashWithOutputs(stepName, bash string) (bool, string, string)

Runs the provided bash without wrapping it in any kubernetes-specific gunk.

func SanitizeString

func SanitizeString(name string) string

func SetUpLogger

func SetUpLogger(logLevelStr string) error

func ValidateFullImageString

func ValidateFullImageString(image string) bool

ValidateFullImageString takes a docker image string and verifies a repo, name, and tag were all provided image := "docker.io/blackducksoftware/synopsys-operator:latest" subMatch = [blackducksoftware/synopsys-operator:latest blackducksoftware synopsys-operator latest]

func ValidateImageVersion

func ValidateImageVersion(version string) bool

ValidateImageVersion takes a docker image version string and verifies that it follows the format x.x.x version := "2019.4.2" subMatch = [2019.4.2 2019 4 2]

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL