utils

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2025 License: AGPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoesTagExist

func DoesTagExist(tag string) (bool, error)

func EvaluateYqToString

func EvaluateYqToString(expr string, files ...string) (string, error)

func FetchSboms added in v0.1.2

func FetchSboms(repoOwner, packageUrl, tag string, outputDir string, logger *slog.Logger) ([]string, error)

FetchSboms fetches the sboms from the given Zarf image reference it expects the image to have a single manifest of type `application/vnd.oci.image.index.v1+json` that contains a single manifest of type `application/vnd.oci.image.manifest.v1+json` in this manifest, it searches for sboms.tar. Contents of this file are extracted to the outputDir, and their names are returned

func GetBundleConfig added in v0.1.1

func GetBundleConfig(config types.ReleaseConfig, bundleName string) (types.Bundle, error)

func GetFlavorConfig

func GetFlavorConfig(flavor string, config types.ReleaseConfig, packageName string) (string, types.Flavor, error)

func GetFormattedVersion added in v0.0.13

func GetFormattedVersion(packageName string, version string, flavor string) string

func GetGithubToken added in v0.1.2

func GetGithubToken() string

func GetPackageName

func GetPackageName() (string, error)

func GetRepoInfo

func GetRepoInfo() (remoteURL string, defaultBranch string, err error)

func JoinNonEmpty added in v0.0.14

func JoinNonEmpty(sep string, elems ...string) string

JoinNonEmpty works like strings.Join but drops any empty elements.

func LoadReleaseConfig

func LoadReleaseConfig(dir string) (types.ReleaseConfig, error)

func LoadYaml

func LoadYaml(path string, destVar any) error

func OpenRepo

func OpenRepo() (*git.Repository, error)

func UpdateYaml

func UpdateYaml(path string, srcVar any) error

Types

type CommandRunner added in v0.1.2

type CommandRunner interface {
	Run() error
	SetStdout(stdout io.Writer)
	SetStderr(stderr io.Writer)
	CombinedOutput() ([]byte, error)
}

type ImageIndex added in v0.1.2

type ImageIndex struct {
	Manifests []IndexEntry `json:"manifests"`
}

type ImageManifest added in v0.1.2

type ImageManifest struct {
	Layers []Layer `json:"layers"`
}

type IndexEntry added in v0.1.2

type IndexEntry struct {
	Digest string `json:"digest"`
}

type Layer added in v0.1.2

type Layer struct {
	Digest      string            `json:"digest"`
	Annotations map[string]string `json:"annotations"`
}

type RealCommand added in v0.1.2

type RealCommand struct {
	// contains filtered or unexported fields
}

func (*RealCommand) CombinedOutput added in v0.1.2

func (r *RealCommand) CombinedOutput() ([]byte, error)

func (*RealCommand) Run added in v0.1.2

func (r *RealCommand) Run() error

func (*RealCommand) SetStderr added in v0.1.2

func (r *RealCommand) SetStderr(stderr io.Writer)

func (*RealCommand) SetStdout added in v0.1.2

func (r *RealCommand) SetStdout(stdout io.Writer)

type RunProcess added in v0.1.2

type RunProcess func(name string, arg ...string) CommandRunner
var OsRunProcess RunProcess = func(name string, arg ...string) CommandRunner {
	return &RealCommand{cmd: exec.Command(name, arg...)}
}

Update ExecCommand to use CommandRunner

type ShortHandler added in v0.1.2

type ShortHandler struct {
	// contains filtered or unexported fields
}

func PrettyLogHandler added in v0.1.2

func PrettyLogHandler(w io.Writer, level slog.Level) *ShortHandler

func (*ShortHandler) Enabled added in v0.1.2

func (h *ShortHandler) Enabled(_ context.Context, level slog.Level) bool

func (*ShortHandler) Handle added in v0.1.2

func (h *ShortHandler) Handle(_ context.Context, r slog.Record) error

func (*ShortHandler) WithAttrs added in v0.1.2

func (h *ShortHandler) WithAttrs(attrs []slog.Attr) slog.Handler

func (*ShortHandler) WithGroup added in v0.1.2

func (h *ShortHandler) WithGroup(name string) slog.Handler

Jump to

Keyboard shortcuts

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