utils

package
v0.8.8 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComputeExecutionHash

func ComputeExecutionHash(
	spec *contractv1.BuildSpec,
	trigger domain.TriggerContext,
) (string, error)

ComputeExecutionHash hashes a build's semantic intent so equivalent builds hash identically regardless of Kubernetes storage format or metadata.

func CreateOrPatch

func CreateOrPatch(ctx context.Context, c client.Client, obj client.Object) error

CreateOrPatch creates obj if it doesn't exist, or leaves it unchanged if it does — a thin wrapper around controllerutil.CreateOrUpdate with a no-op mutate func.

func ParseImage

func ParseImage(image string) (string, string)

ParseImage splits an image reference on its last colon into repository and tag, defaulting to tag "latest" when no colon is present.

func PointerBool

func PointerBool(b bool) *bool

PointerBool returns a pointer to b.

func PrintRepoTree

func PrintRepoTree(basePath string) error

PrintRepoTree prints an indented directory tree of basePath to stdout, for debugging what a cloned repository actually contains.

func RunGit

func RunGit(dir string, args ...string) (string, error)

RunGit runs a git command in dir (or the current directory if dir is empty) and returns its combined stdout/stderr output, trimmed.

func RunGitWithEnv

func RunGitWithEnv(dir string, env []string, args ...string) (string, error)

RunGitWithEnv runs a git command with additional environment variables.

func ShortHash

func ShortHash(hash string) string

ShortHash truncates hash to its first 12 characters, or returns it unchanged if it's already shorter.

Types

This section is empty.

Jump to

Keyboard shortcuts

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