util

package
v1.0.4-pre.2 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComposePkgObjName

func ComposePkgObjName(repoName, path, packageName string) string

ComposePkgObjName builds a Package object name, repo.path.package, with '/' in path replaced by '.'. It returns "" when repoName or packageName is empty.

func ComposePkgRevObjName

func ComposePkgRevObjName(repoName, path, packageName, workspace string) string

ComposePkgRevObjName builds a PackageRevision object name, repo.path.package.workspace. It returns "" when repoName, packageName, or workspace is empty. The revision number is not included.

func GetPRWorkspaceName

func GetPRWorkspaceName(k8sName string) string

GetPRWorkspaceName returns the workspace suffix of a PackageRevision object name. A trailing semver (".v1.2.3") is kept intact, including its dots; otherwise the suffix is the segment after the last dot. It returns "" when k8sName has no '.'.

func Revision2Int

func Revision2Int(revisionStr string) int

Revision2Int parses a revision such as "3" or "v3". It returns -1 when the value is not an integer; -1 is the main revision.

func Revision2Str

func Revision2Str(revision int) string

Revision2Str formats a revision number without a "v" prefix.

func SplitIn3OnDelimiter

func SplitIn3OnDelimiter(splitee, delimiter string) []string

SplitIn3OnDelimiter splits splitee into exactly three parts: head, middle, and tail. One segment yields [s, "", ""]; two yield [first, "", last]. Further segments are rejoined into middle, so a dotted package path stays in the middle.

func ValidPkgObjName

func ValidPkgObjName(repoName, path, packageName string) error

ValidPkgObjName checks that the composed Package object name is a DNS-1123 subdomain.

func ValidPkgRevObjName

func ValidPkgRevObjName(repoName, path, packageName, workspace string) error

ValidPkgRevObjName checks that workspace is a DNS-1123 label and that the composed PackageRevision object name is a DNS-1123 subdomain.

func ValidateDirectoryName

func ValidateDirectoryName(directory string, mandatory bool) error

ValidateDirectoryName checks that directory is an RFC 1123 DNS label with '/' allowed as a separator. When mandatory is false, an empty directory (including "/") is valid.

func ValidateK8SName

func ValidateK8SName(k8sName string) error

ValidateK8SName checks that k8sName is an RFC 1123 DNS label.

func ValidateRepository

func ValidateRepository(repoName, directory string) error

ValidateRepository checks that repoName is an RFC 1123 DNS label and that directory is a valid repository directory. An empty directory is allowed.

Types

This section is empty.

Jump to

Keyboard shortcuts

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