Documentation
¶
Index ¶
- func BinDir() string
- func EnsureCommand(ctx context.Context, command, version string) (string, error)
- func FallbackHosts() []string
- func PackageDir(owner, repo, version string) string
- func PrependBinDirToEnv(env []string) []string
- func RegistryDir() string
- func ResolveHosts(ctx context.Context, command, version string) ([]string, error)
- func ToolsDir() string
- type Override
- type Package
- type PackageFile
- type Registry
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BinDir ¶
func BinDir() string
BinDir returns the directory where tool binaries/symlinks are placed. This is ToolsDir()/bin/
func EnsureCommand ¶
EnsureCommand makes sure a command binary is available. It checks PATH first, then the docker agent tools directory, then attempts to install from the aqua registry if auto-install is enabled.
Returns the resolved command (may be the same string if found in PATH, or a full path to the installed binary) and any error encountered. When auto-install is disabled (globally or per-toolset), the original command is returned with no error.
func FallbackHosts ¶ added in v1.63.0
func FallbackHosts() []string
FallbackHosts returns the union of every host any auto-install path might reach. Callers use it when they decide to allow a tool to install but cannot resolve the specific package on the host (e.g. the registry is unreachable and there's no disk cache yet). It preserves install behaviour at the cost of giving up the per-package narrowing — security-conscious callers should prefer reporting the resolution error and refusing the run instead.
func PackageDir ¶
PackageDir returns the directory for a specific package version. This is ToolsDir()/packages/<owner>/<repo>/<version>/
func PrependBinDirToEnv ¶
PrependBinDirToEnv takes an env slice and ensures the tools bin directory is prepended to the PATH entry. This allows installed tools to find other installed tools (e.g., npx finding node).
func RegistryDir ¶
func RegistryDir() string
RegistryDir returns the directory for cached registry data.
func ResolveHosts ¶ added in v1.63.0
ResolveHosts returns the set of hostnames the auto-installer needs to reach inside a sandbox in order to install command at version.
version follows the EnsureCommand convention:
- "" → resolve by command name; latest version.
- "owner/repo" → look up by aqua name; latest version.
- "owner/repo@version" → look up by aqua name; explicit version.
The returned list is sorted and deduplicated. Errors propagate the underlying registry failure verbatim so the caller can log it and decide whether to fail the run or fall back to FallbackHosts.
Types ¶
type Override ¶
type Override struct {
GOOS string `yaml:"goos"`
GOArch string `yaml:"goarch"`
Asset string `yaml:"asset"`
Format string `yaml:"format"`
Files []PackageFile `yaml:"files"`
Replacements map[string]string `yaml:"replacements"`
}
Override represents a platform-specific override for a package.
type Package ¶
type Package struct {
Type string `yaml:"type"`
RepoOwner string `yaml:"repo_owner"`
RepoName string `yaml:"repo_name"`
Description string `yaml:"description"`
Asset string `yaml:"asset"`
Format string `yaml:"format"`
Files []PackageFile `yaml:"files"`
Overrides []Override `yaml:"overrides"`
Replacements map[string]string `yaml:"replacements"`
SupportedEnvs []string `yaml:"supported_envs"`
VersionFilter string `yaml:"version_filter"`
VersionPrefix string `yaml:"version_prefix"`
Name string `yaml:"name"`
// GoInstallPath is the Go module path for go_install/go_build packages.
// Example: "golang.org/x/tools/gopls"
GoInstallPath string `yaml:"path"`
}
Package represents a parsed aqua registry package definition.
func (*Package) BinaryName ¶
BinaryName returns the primary binary name this package provides.
func (*Package) InstallHosts ¶ added in v1.63.0
InstallHosts returns the hostnames the auto-installer will reach for when installing this package. Always includes the registry-side lookup hosts because the in-sandbox installer re-runs the same LookupByName/LookupByCommand path the host uses here.
func (*Package) IsGoPackage ¶
IsGoPackage returns true if this package is installed via "go install".
type PackageFile ¶
PackageFile describes a file within a downloaded archive.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry provides lookup of aqua packages.
func NewRegistry ¶
func NewRegistry() *Registry
NewRegistry creates a new Registry with default settings.
func SharedRegistry ¶
func SharedRegistry() *Registry
SharedRegistry returns a package-level Registry instance that is reused across all tool resolutions within a docker agent session, avoiding repeated YAML parsing and HTTP fetches.
func (*Registry) Install ¶
Install downloads and installs a package at the specified version. Returns the path to the installed binary.
func (*Registry) LookupByCommand ¶
LookupByCommand searches for a package providing a binary matching the command name. First checks repo names, then files[].name across all packages.
func (*Registry) LookupByName ¶
LookupByName searches the registry for a package by "owner/repo" identifier. Searches the full registry index first, then falls back to fetching the per-package YAML from pkgs/<owner>/<repo>/registry.yaml.