flexpack

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2025 License: Apache-2.0 Imports: 18 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ChartYaml = "Chart.yaml"
	ChartLock = "Chart.lock"
)

Variables

This section is empty.

Functions

func ClearPoetryDependenciesCache

func ClearPoetryDependenciesCache(projectPath string) error

ClearPoetryDependenciesCache clears the Poetry dependencies cache

func GetPoetryDependenciesCacheInfo

func GetPoetryDependenciesCacheInfo(projectPath string) (map[string]interface{}, error)

GetPoetryDependenciesCacheInfo returns information about the current cache

func IsFlexPackEnabled added in v1.12.0

func IsFlexPackEnabled() bool

IsFlexPackEnabled checks if the FlexPack (native) implementation should be used Returns true if JFROG_RUN_NATIVE environment variable is set to "true"

func RunMavenInstallWithBuildInfo added in v1.12.0

func RunMavenInstallWithBuildInfo(workingDir string, buildName, buildNumber string, includeTestDeps bool, extraArgs []string) error

RunMavenInstallWithBuildInfo runs mvn install and collects build information Parameters:

  • workingDir: Maven project directory
  • buildName, buildNumber: Build info identifiers
  • includeTestDeps: Whether to include test dependencies in build info (does NOT affect test execution)
  • extraArgs: Additional Maven arguments (use "-DskipTests" here to skip test execution)

func RunPoetryInstallWithBuildInfo

func RunPoetryInstallWithBuildInfo(workingDir string, buildName, buildNumber string, includeDevDeps bool, extraArgs []string) error

RunPoetryInstallWithBuildInfo runs poetry install and collects build information

func RunPoetryInstallWithBuildInfoAndCaching

func RunPoetryInstallWithBuildInfoAndCaching(workingDir string, buildName, buildNumber string, includeDevDeps bool, extraArgs []string) error

RunPoetryInstallWithBuildInfoAndCaching runs poetry install with build info and caching support

func UpdatePoetryDependenciesCache

func UpdatePoetryDependenciesCache(dependenciesMap map[string]entities.Dependency, projectPath string) error

UpdatePoetryDependenciesCache writes the updated project's dependencies cache

Types

type BuildInfoCollector

type BuildInfoCollector interface {
	// CollectBuildInfo collects complete build information including dependencies
	CollectBuildInfo(buildName, buildNumber string) (*entities.BuildInfo, error)

	// GetProjectDependencies returns all project dependencies with full details
	GetProjectDependencies() ([]DependencyInfo, error)

	// GetDependencyGraph returns the complete dependency graph showing relationships
	GetDependencyGraph() (map[string][]string, error)
}

BuildInfoCollector defines methods for collecting build information

type DependencyInfo

type DependencyInfo struct {
	Type         string           `json:"type"`
	SHA1         string           `json:"sha1"`
	SHA256       string           `json:"sha256"`
	MD5          string           `json:"md5"`
	ID           string           `json:"id"`
	Scopes       []string         `json:"scopes"`
	RequestedBy  []string         `json:"requestedBy,omitempty"`
	Version      string           `json:"version"`
	Name         string           `json:"name"`
	Path         string           `json:"path,omitempty"`
	Repository   string           `json:"-"`
	Dependencies []DependencyInfo `json:"dependencies,omitempty"`
}

DependencyInfo represents detailed information about a dependency

type FlexPackManager

type FlexPackManager interface {
	// GetDependency returns dependency information along with name and version
	// Returns a formatted string containing dependency details
	GetDependency() string

	// ParseDependencyToList parses and returns a list of dependencies with their name and version
	// Returns a slice of strings, each containing dependency name and version information
	ParseDependencyToList() []string

	// CalculateChecksum calculates checksums for dependencies in the provided list
	// Returns a slice of maps containing checksum information (sha1, sha256, md5) for each dependency
	CalculateChecksum() []map[string]interface{}

	// CalculateScopes calculates and returns the scopes for dependencies if any
	// Scopes represent different contexts where dependencies are used (e.g., runtime, compile, test)
	CalculateScopes() []string

	// CalculateRequestedBy determines which dependencies requested a particular package
	// Returns information about the dependency relationship hierarchy
	CalculateRequestedBy() map[string][]string
}

FlexPackManager defines the interface for flexible package manager support This interface allows different package managers (like Poetry) to implement standardized methods for dependency resolution and build info collection

type HelmChartDependency added in v1.13.0

type HelmChartDependency struct {
	Name         string        `yaml:"name"`
	Version      string        `yaml:"version"`
	Repository   string        `yaml:"repository"`
	Condition    string        `yaml:"condition,omitempty"`
	Tags         []string      `yaml:"tags,omitempty"`
	Enabled      bool          `yaml:"enabled,omitempty"`
	ImportValues []interface{} `yaml:"import-values,omitempty"`
	Alias        string        `yaml:"alias,omitempty"`
}

HelmChartDependency represents a dependency in Chart.yaml

type HelmChartLock added in v1.13.0

type HelmChartLock struct {
	Generated    string               `yaml:"generated"`
	Digest       string               `yaml:"digest"`
	Dependencies []HelmLockDependency `yaml:"dependencies"`
}

HelmChartLock represents Chart.lock structure

type HelmChartYAML added in v1.13.0

type HelmChartYAML struct {
	APIVersion   string                `yaml:"apiVersion"`
	Name         string                `yaml:"name"`
	Version      string                `yaml:"version"`
	Description  string                `yaml:"description,omitempty"`
	Type         string                `yaml:"type,omitempty"`
	Keywords     []string              `yaml:"keywords,omitempty"`
	Home         string                `yaml:"home,omitempty"`
	Sources      []string              `yaml:"sources,omitempty"`
	Dependencies []HelmChartDependency `yaml:"dependencies,omitempty"`
	Maintainers  []map[string]string   `yaml:"maintainers,omitempty"`
	Icon         string                `yaml:"icon,omitempty"`
	AppVersion   string                `yaml:"appVersion,omitempty"`
	Deprecated   bool                  `yaml:"deprecated,omitempty"`
	Annotations  map[string]string     `yaml:"annotations,omitempty"`
	KubeVersion  string                `yaml:"kubeVersion,omitempty"`
}

HelmChartYAML represents Chart.yaml structure

type HelmConfig added in v1.13.0

type HelmConfig struct {
	WorkingDirectory string
	HelmExecutable   string
}

HelmConfig represents configuration for Helm FlexPack

type HelmFlexPack added in v1.13.0

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

HelmFlexPack implements the FlexPackManager interface for Helm package manager

func NewHelmFlexPack added in v1.13.0

func NewHelmFlexPack(config HelmConfig) (*HelmFlexPack, error)

NewHelmFlexPack creates a new Helm FlexPack instance

func (*HelmFlexPack) CollectBuildInfo added in v1.13.0

func (hf *HelmFlexPack) CollectBuildInfo(buildName, buildNumber string) (*entities.BuildInfo, error)

CollectBuildInfo collects complete build information for Helm chart

type HelmLockDependency added in v1.13.0

type HelmLockDependency struct {
	Name       string   `yaml:"name"`
	Version    string   `yaml:"version"`
	Repository string   `yaml:"repository"`
	Digest     string   `yaml:"digest"`
	Condition  string   `yaml:"condition,omitempty"`
	Tags       []string `yaml:"tags,omitempty"`
}

HelmLockDependency represents a dependency in Chart.lock

type MavenConfig added in v1.12.0

type MavenConfig struct {
	WorkingDirectory        string
	IncludeTestDependencies bool
	MavenExecutable         string
	SkipTests               bool
}

MavenConfig represents configuration for Maven FlexPack

type MavenDependency added in v1.12.0

type MavenDependency struct {
	GroupId    string `xml:"groupId"`
	ArtifactId string `xml:"artifactId"`
	Version    string `xml:"version"`
	Scope      string `xml:"scope"`
	Type       string `xml:"type"`
	Optional   bool   `xml:"optional"`
}

MavenDependency represents a dependency in pom.xml

type MavenDependencyJSON added in v1.12.0

type MavenDependencyJSON struct {
	GroupID    string                `json:"groupId"`
	ArtifactID string                `json:"artifactId"`
	Version    string                `json:"version"`
	Type       string                `json:"type"`
	Scope      string                `json:"scope"`
	Classifier string                `json:"classifier"`
	Optional   string                `json:"optional"`
	Children   []MavenDependencyJSON `json:"children,omitempty"`
}

MavenDependencyJSON represents a dependency in Maven's JSON dependency tree

type MavenDependencyTreeEntry added in v1.12.0

type MavenDependencyTreeEntry struct {
	GroupId    string
	ArtifactId string
	Version    string
	Scope      string
	Type       string
	Level      int
	Parent     string
}

MavenDependencyTreeEntry represents an entry from mvn dependency:tree output

type MavenFlexPack added in v1.12.0

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

MavenFlexPack implements the FlexPackManager interface for Maven package manager

func NewMavenFlexPack added in v1.12.0

func NewMavenFlexPack(config MavenConfig) (*MavenFlexPack, error)

NewMavenFlexPack creates a new Maven FlexPack instance

func (*MavenFlexPack) CalculateChecksum added in v1.12.0

func (mf *MavenFlexPack) CalculateChecksum() []map[string]interface{}

CalculateChecksum calculates checksums for dependencies

func (*MavenFlexPack) CalculateRequestedBy added in v1.12.0

func (mf *MavenFlexPack) CalculateRequestedBy() map[string][]string

CalculateRequestedBy determines which dependencies requested a particular package

func (*MavenFlexPack) CalculateScopes added in v1.12.0

func (mf *MavenFlexPack) CalculateScopes() []string

CalculateScopes calculates and returns the scopes for dependencies For Maven, this returns the official Maven dependency scopes in consistent order: compile, runtime, test, provided, system, import

func (*MavenFlexPack) CollectBuildInfo added in v1.12.0

func (mf *MavenFlexPack) CollectBuildInfo(buildName, buildNumber string) (*entities.BuildInfo, error)

CollectBuildInfo collects complete build information for Maven project

func (*MavenFlexPack) GetDependency added in v1.12.0

func (mf *MavenFlexPack) GetDependency() string

GetDependency fetches and parses dependencies, then returns dependency information

func (*MavenFlexPack) GetDependencyGraph added in v1.12.0

func (mf *MavenFlexPack) GetDependencyGraph() (map[string][]string, error)

GetDependencyGraph returns the complete dependency graph

func (*MavenFlexPack) GetProjectDependencies added in v1.12.0

func (mf *MavenFlexPack) GetProjectDependencies() ([]DependencyInfo, error)

GetProjectDependencies returns all project dependencies with full details

func (*MavenFlexPack) ParseDependencyToList added in v1.12.0

func (mf *MavenFlexPack) ParseDependencyToList() []string

ParseDependencyToList converts parsed dependencies to a list format

type MavenPOM added in v1.12.0

type MavenPOM struct {
	XMLName      xml.Name `xml:"project"`
	GroupId      string   `xml:"groupId"`
	ArtifactId   string   `xml:"artifactId"`
	Version      string   `xml:"version"`
	Packaging    string   `xml:"packaging"`
	Name         string   `xml:"name"`
	Description  string   `xml:"description"`
	URL          string   `xml:"url"`
	Dependencies struct {
		Dependency []MavenDependency `xml:"dependency"`
	} `xml:"dependencies"`
}

MavenPOM represents the structure of pom.xml file

type PoetryConfig

type PoetryConfig struct {
	// WorkingDirectory is the directory where Poetry should operate
	WorkingDirectory string

	// IncludeDevDependencies indicates whether to include development dependencies
	IncludeDevDependencies bool
}

PoetryConfig holds configuration specific to Poetry operations

type PoetryDependenciesCache

type PoetryDependenciesCache struct {
	Version     int                            `json:"version,omitempty"`
	DepsMap     map[string]entities.Dependency `json:"dependencies,omitempty"`
	LastUpdated time.Time                      `json:"lastUpdated,omitempty"`
	ProjectPath string                         `json:"projectPath,omitempty"`
}

PoetryDependenciesCache represents cached dependency information for Poetry projects

func GetPoetryDependenciesCache

func GetPoetryDependenciesCache(projectPath string) (cache *PoetryDependenciesCache, err error)

GetPoetryDependenciesCache reads the JSON cache file of recent used project's dependencies Returns cached dependencies map or nil if cache doesn't exist

func (*PoetryDependenciesCache) GetDependency

func (cache *PoetryDependenciesCache) GetDependency(dependencyName string) (dependency entities.Dependency, found bool)

GetDependency returns required dependency from cache

func (*PoetryDependenciesCache) HasDependency

func (cache *PoetryDependenciesCache) HasDependency(dependencyName string) bool

HasDependency checks if a dependency exists in cache

func (*PoetryDependenciesCache) IsValid

func (cache *PoetryDependenciesCache) IsValid(maxAge time.Duration) bool

IsValid checks if the cache is valid and not expired

type PoetryFlexPack

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

PoetryFlexPack implements the FlexPackManager interface for Poetry package manager

func NewPoetryFlexPack

func NewPoetryFlexPack(config PoetryConfig) (*PoetryFlexPack, error)

NewPoetryFlexPack creates a new Poetry FlexPack instance

func (*PoetryFlexPack) CalculateChecksum

func (pf *PoetryFlexPack) CalculateChecksum() []map[string]interface{}

CalculateChecksum calculates checksums for dependencies in the provided list

func (*PoetryFlexPack) CalculateRequestedBy

func (pf *PoetryFlexPack) CalculateRequestedBy() map[string][]string

CalculateRequestedBy determines which dependencies requested a particular package

func (*PoetryFlexPack) CalculateScopes

func (pf *PoetryFlexPack) CalculateScopes() []string

CalculateScopes calculates and returns the scopes for dependencies

func (*PoetryFlexPack) CollectBuildInfo

func (pf *PoetryFlexPack) CollectBuildInfo(buildName, buildNumber string) (*entities.BuildInfo, error)

CollectBuildInfo collects complete build information including dependencies

func (*PoetryFlexPack) GetDependency

func (pf *PoetryFlexPack) GetDependency() string

GetDependency returns dependency information along with name and version

func (*PoetryFlexPack) GetDependencyGraph

func (pf *PoetryFlexPack) GetDependencyGraph() (map[string][]string, error)

GetDependencyGraph returns the complete dependency graph

func (*PoetryFlexPack) GetProjectDependencies

func (pf *PoetryFlexPack) GetProjectDependencies() ([]DependencyInfo, error)

GetProjectDependencies returns all project dependencies with full details

func (*PoetryFlexPack) ParseDependencyToList

func (pf *PoetryFlexPack) ParseDependencyToList() []string

ParseDependencyToList parses and returns a list of dependencies with their name and version

func (*PoetryFlexPack) UpdateDependenciesWithCache

func (pf *PoetryFlexPack) UpdateDependenciesWithCache() error

UpdateDependenciesWithCache enhances dependencies with cached information

type PoetryLockFile

type PoetryLockFile struct {
	Package []PoetryPackage `toml:"package"`
}

PoetryLockFile represents the structure of poetry.lock file

type PoetryPackage

type PoetryPackage struct {
	Name         string                 `toml:"name"`
	Version      string                 `toml:"version"`
	Description  string                 `toml:"description"`
	Category     string                 `toml:"category"`
	Optional     bool                   `toml:"optional"`
	Dependencies map[string]interface{} `toml:"dependencies"`
	Source       *PoetrySource          `toml:"source"`
}

PoetryPackage represents a package in poetry.lock

type PoetryPyProjectToml

type PoetryPyProjectToml struct {
	// Poetry 2.x format (PEP 621)
	Project struct {
		Name         string   `toml:"name"`
		Version      string   `toml:"version"`
		Dependencies []string `toml:"dependencies"`
	} `toml:"project"`
	// Poetry 1.x format
	Tool struct {
		Poetry struct {
			Name            string                 `toml:"name"`
			Version         string                 `toml:"version"`
			Dependencies    map[string]interface{} `toml:"dependencies"`
			DevDependencies map[string]interface{} `toml:"dev-dependencies"`
		} `toml:"poetry"`
	} `toml:"tool"`
}

PoetryPyProjectToml represents the structure of pyproject.toml file for Poetry Supports both Poetry 1.x format ([tool.poetry]) and Poetry 2.x format ([project])

type PoetryShowOutput

type PoetryShowOutput struct {
	Name         string   `json:"name"`
	Version      string   `json:"version"`
	Description  string   `json:"description"`
	Dependencies []string `json:"dependencies"`
}

PoetryShowOutput represents the output of 'poetry show' command

type PoetrySource

type PoetrySource struct {
	Type string `toml:"type"`
	URL  string `toml:"url"`
	Name string `toml:"name"`
}

PoetrySource represents package source information

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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