util

package
v1.3.29 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConanPlaceholder  = "_"
	ConanManifestFile = "conanmanifest.txt"
	ConanFilePy       = "conanfile.py"
	ConanInfoTxt      = "conaninfo.txt"

	// Tarball prefixes; each may appear at most once per revision, in any one of
	// the allowed compression variants.
	ConanTarballExport  = "conan_export"
	ConanTarballSources = "conan_sources"
	ConanTarballPackage = "conan_package"
)

Conan v2 JFrog storage layout (repo-relative Uri):

.../{name}/{version}/{user}/{channel}/{rrev}/export/{file}                 -> recipe layer
.../{name}/{version}/{user}/{channel}/{rrev}/package/{pkgid}/{prev}/{file} -> package layer

The reference coordinates are located relative to the "export"/"package" layer marker rather than a fixed offset, so any leading prefix some layouts use (e.g. a "_" root segment) is ignored. "_" is the placeholder JFrog uses for an absent user/channel.

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 GetConanPackages added in v1.3.29

func GetConanPackages(files []*types.File, registry string) []types.Package

GetConanPackages returns one package per distinct Conan reference found in the file list. Each package's Path is the reference subtree so the package job's tree node scopes to just that reference's files.

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 IsConanPackageFile added in v1.3.29

func IsConanPackageFile(name string) bool

IsConanPackageFile reports whether name is a canonical package-layer file, mirroring the destination server's package filename rule.

func IsConanRecipeFile added in v1.3.29

func IsConanRecipeFile(name string) bool

IsConanRecipeFile reports whether name is a canonical recipe-layer file, mirroring the destination server's recipe filename rule.

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

type ConanFileEntry added in v1.3.29

type ConanFileEntry struct {
	Reference ConanRef
	Layer     ConanLayer
	RRev      string
	PkgID     string
	PRev      string
	FileName  string
	Uri       string
	SHA1      string
	Size      int
}

ConanFileEntry is a single migratable Conan file with the coordinates needed to re-upload it to the destination (recipe or package layer).

func ParseConanEntries added in v1.3.29

func ParseConanEntries(files []*types.File) []ConanFileEntry

ParseConanEntries converts a reference's files into upload-ready entries, ordered so every conanmanifest.txt is uploaded last within its layer/revision group (the finalization marker the server expects last).

func ParseConanFileURI added in v1.3.29

func ParseConanFileURI(uri string) (ConanFileEntry, bool)

ParseConanFileURI parses a repo-relative JFrog Conan v2 Uri into a ConanFileEntry. ok is false for paths that are not canonical Conan recipe or package files (e.g. JFrog-internal index/metadata files), so callers can skip anything the destination would reject.

type ConanLayer added in v1.3.29

type ConanLayer string

ConanLayer identifies whether a file belongs to the recipe (RREV) or package (PKGID/PREV) layer of a Conan reference.

const (
	ConanLayerRecipe  ConanLayer = "recipe"
	ConanLayerPackage ConanLayer = "package"
)

type ConanRef added in v1.3.29

type ConanRef struct {
	Name    string
	Version string
	User    string
	Channel string
}

ConanRef holds the coordinates of a Conan reference (name/version[@user/channel]). User/Channel are "_" when absent, matching the on-disk placeholder.

func (ConanRef) BasePath added in v1.3.29

func (r ConanRef) BasePath() string

BasePath is the repo-relative subtree path of the reference: /name/version/user/channel.

func (ConanRef) Display added in v1.3.29

func (r ConanRef) Display() string

Display renders the reference as name/version[@user/channel], omitting a placeholder user/channel.

Jump to

Keyboard shortcuts

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