Documentation ¶
Overview ¶
Forked from https://github.com/sigstore/cosign/blob/v1.7.1/pkg/sget/sget.go
Index ¶
- Constants
- Variables
- func ByteFormat(inputNum float64, precision int) string
- func ColorPrintYAML(text string)
- func CreateDirectory(path string, mode os.FileMode) error
- func CreateFilePath(destination string) error
- func CreatePathAndCopy(source string, destination string)
- func DockerLogin(serverAddress string, user string, password string) error
- func DownloadToFile(url string, target string, cosignKeyPath string)
- func ExecCommandWithContext(ctx context.Context, showLogs bool, commandName string, args ...string) (string, string, error)
- func Fetch(url string) io.ReadCloser
- func GetHtpasswdString(username string, password string) (string, error)
- func GetSha256Sum(path string) (string, error)
- func InvalidPath(path string) bool
- func IsRHEL() bool
- func IsUrl(source string) bool
- func IsValidHostName() bool
- func ListDirectories(directory string) ([]string, error)
- func MakeTempDir() (string, error)
- func RandomString(length int) string
- func ReadYaml(path string, destConfig any) error
- func RecursiveFileList(root string, pattern *regexp.Regexp) []string
- func ReplaceText(path string, old string, new string)
- func RoundUp(input float64, places int) (newVal float64)
- func RunPreflightChecks()
- func Sget(image, key string, out io.Writer, ctx context.Context) error
- func SwapHost(src string, targetHost string) string
- func ValidHostname(hostname string) bool
- func ValidateSha256Sum(expectedChecksum string, path string)
- func VerifyBinary(binary string) bool
- func WriteFile(path string, data []byte) error
- func WriteYaml(path string, srcConfig any, perm fs.FileMode) error
- type WriteCounter
Constants ¶
const SGETProtocol = "sget://"
Variables ¶
var TempPathPrefix = "zarf-"
Functions ¶
func ByteFormat ¶
func ColorPrintYAML ¶
func ColorPrintYAML(text string)
func CreateDirectory ¶
CreateDirectory creates a directory for the given path and file mode
func CreateFilePath ¶
func CreatePathAndCopy ¶
func DockerLogin ¶
DockerLogin adds the given creds to the user's Docker config, usually located at $HOME/.docker/config.yaml. It does not try to connect to the given registry, it just simply adds another entry to the config file. This function was mostly adapted from https://github.com/google/go-containerregistry/blob/5c9c442d5d68cd96787559ebf6e984c7eb084913/cmd/crane/cmd/auth.go
func DownloadToFile ¶
func ExecCommandWithContext ¶ added in v0.18.0
func ExecCommandWithContext(ctx context.Context, showLogs bool, commandName string, args ...string) (string, string, error)
nolint
func Fetch ¶
func Fetch(url string) io.ReadCloser
func GetHtpasswdString ¶
GetHtpasswdString converts a username and password to a properly formatted and hashed format for `htpasswd`
func GetSha256Sum ¶
GetSha256Sum returns the computed SHA256 Sum of a given file
func IsValidHostName ¶
func IsValidHostName() bool
func ListDirectories ¶
func MakeTempDir ¶
func RandomString ¶
func RecursiveFileList ¶
RecursiveFileList walks a path with an optional regex pattern and returns a slice of file paths
func ReplaceText ¶
func RunPreflightChecks ¶
func RunPreflightChecks()
func Sget ¶ added in v0.18.0
Sget performs a cosign signature verification on a given image using the specified public key.
func ValidHostname ¶
func ValidateSha256Sum ¶
func VerifyBinary ¶
VerifyBinary returns true if binary is available
Types ¶
type WriteCounter ¶
type WriteCounter struct { Total int // contains filtered or unexported fields }
func NewWriteCounter ¶
func NewWriteCounter(url string, total int) *WriteCounter