util

package
v1.3.28-beta.4 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateMapOfFilteredFile added in v1.3.27

func CreateMapOfFilteredFile(searchedFiles []types.SearchedFile, mapping *types.RegistryMapping) map[string]struct{}

func FilterFilesByDate added in v1.3.26

func FilterFilesByDate(files []types.File, filteredURIs map[string]struct{}) []types.File

func FilterFilesByPatterns added in v1.3.3

func FilterFilesByPatterns(files []types.File, includePatterns, excludePatterns []string) []types.File

func FilterFilesByPatternsPackageName added in v1.3.3

func FilterFilesByPatternsPackageName(packages []types.Package, includePatterns, excludePatterns []string) []types.Package

This is to filter based on package name

func GenOCIImagePath

func GenOCIImagePath(host string, pathParams ...string) string

func GetChartFileName added in v1.3.23

func GetChartFileName(name, version string) string

GetChartFileName returns the canonical chart archive file name for a given chart name and version: "<name>-<version>.tgz".

name may carry a nested directory prefix (e.g. "ChartA/ChartB/abc") produced by the JFrog adapter's getNestedName; the prefix is preserved verbatim so the upload path mirrors the source layout. The "<leaf>-<version>.tgz" form is what the server re-parses (it strips the prefix and validates the leaf against Chart.yaml).

func GetChartProvFileName added in v1.3.23

func GetChartProvFileName(name, version string) string

GetChartProvFileName returns the provenance sidecar file name for a chart: "<name>-<version>.tgz.prov".

func GetPyPIVersion

func GetPyPIVersion(filename string) string

func GetRegistryRef

func GetRegistryRef(account string, ref string, registry string) string

func GetSkipPrinter

func GetSkipPrinter() *pterm.PrefixPrinter

func IsFileLevelFilterableArtifact added in v1.3.3

func IsFileLevelFilterableArtifact(artifactType types.ArtifactType) bool

func IsHelmChartArchive added in v1.3.23

func IsHelmChartArchive(name string) bool

IsHelmChartArchive reports whether a file name is a Helm chart archive (".tgz") and not a provenance sidecar (".tgz.prov"). Used by the tree-sweep enumeration to select chart files while excluding their .prov siblings, checksum files, and the index.yaml itself.

func IsPackageLevelFilterableArtifact added in v1.3.3

func IsPackageLevelFilterableArtifact(artifactType types.ArtifactType) bool

func IsTimeBasedFilterPresent added in v1.3.26

func IsTimeBasedFilterPresent(mapping *types.RegistryMapping) bool

func IsWildCardExpression added in v1.3.18

func IsWildCardExpression(pattern string) (bool, error)

func MatchesPattern added in v1.3.3

func MatchesPattern(filePath string, patterns []string) bool

func MatchesWildCardPattern added in v1.3.18

func MatchesWildCardPattern(packageName string, pattern string) bool

support * and ?

func ParseChartFileName added in v1.3.23

func ParseChartFileName(filename string) (name, version string, ok bool)

ParseChartFileName splits a Helm chart file name like "{name}-{version}.tgz" (or "{name}-{version}.tgz.prov") into its name and version components.

This is a client-side port of HAR's server-side parser (artifact-registry: registry/pkg/helmhttp/helper.go ParseChartFileName) and MUST stay behaviourally identical, since the server re-parses the uploaded file name and rejects mismatches. The boundary between name and version is found by trying each hyphen left-to-right and accepting the first split whose right-hand side is a valid SemVer 2 string. This correctly handles both hyphenated chart names (e.g. "prometheus-mysql-exporter") and hyphenated prerelease versions (e.g. "1.21.0-alpha.1"), which a naive last-hyphen split would mis-parse.

Only the leaf segment is parsed: any directory prefix (e.g. "ChartA/ChartB/abc-1.0.1.tgz") is stripped first via path.Base, mirroring the server which derives the chart name from path.Base(filePath). ok is false when the name does not conform to the "<name>-<semver>" convention.

func ParseNugetFileNameWithPath added in v1.3.15

func ParseNugetFileNameWithPath(filePath string) (string, string, bool)

This will parse Nuget file with filePath like /package.version.nupkg or file name package.version.nupkg and return package , version and success , traversing from right side fo file name

func ParseNugetFileNameWithPath_old added in v1.3.15

func ParseNugetFileNameWithPath_old(filePath string) (string, string, bool)

This will parse Nuget file with filePath like /package.version.nupkg or file name package.version.nupkg and return package , version and success . this isplit logic using dot

func ParsePuppetFileNameWithPath added in v1.3.20

func ParsePuppetFileNameWithPath(filePath string) (string, string, bool)

ParsePuppetFileNameWithPath parses a Puppet module tarball filename of the form "<author>-<module>-<version>.tar.gz" and returns the module name ("<author>-<module>") plus version. Module names contain a single hyphen and versions are valid SemVer 2.0.0 strings, so the version is found by scanning hyphen positions left-to-right and accepting the first split where both sides match their respective patterns.

func ValidateDateFilter added in v1.3.27

func ValidateDateFilter(df *types.DateFilter) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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