Add support for extractPath
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
This commit is contained in:
@@ -38,59 +38,118 @@ const (
|
||||
|
||||
// PluginManifest represents a single plugin's manifest from the catalog.
|
||||
type PluginManifest struct {
|
||||
APIVersion string `json:"apiVersion"`
|
||||
Kind string `json:"kind"`
|
||||
Name string `json:"name"`
|
||||
Description string `json:"description"`
|
||||
Homepage string `json:"homepage,omitempty"`
|
||||
Source string `json:"source,omitempty"`
|
||||
Bin string `json:"bin"`
|
||||
Versions []PluginVersion `json:"versions"`
|
||||
// APIVersion is the manifest schema version (e.g. "cli.fluxcd.io/v1beta1").
|
||||
APIVersion string `json:"apiVersion"`
|
||||
|
||||
// Kind is the manifest type, must be "Plugin".
|
||||
Kind string `json:"kind"`
|
||||
|
||||
// Name is the plugin name used in "flux <name>" invocations.
|
||||
Name string `json:"name"`
|
||||
|
||||
// Description is a short human-readable summary of the plugin.
|
||||
Description string `json:"description"`
|
||||
|
||||
// Homepage is the URL to the plugin's documentation site.
|
||||
Homepage string `json:"homepage,omitempty"`
|
||||
|
||||
// Source is the URL to the plugin's source repository.
|
||||
Source string `json:"source,omitempty"`
|
||||
|
||||
// Bin is the binary name inside archives and the installed filename
|
||||
// (e.g. "flux-operator"). On Windows ".exe" is appended automatically.
|
||||
Bin string `json:"bin"`
|
||||
|
||||
// Versions lists available versions, newest first.
|
||||
Versions []PluginVersion `json:"versions"`
|
||||
}
|
||||
|
||||
// PluginVersion represents a version entry in a plugin manifest.
|
||||
type PluginVersion struct {
|
||||
Version string `json:"version"`
|
||||
// Version is the semantic version string (e.g. "0.45.0").
|
||||
Version string `json:"version"`
|
||||
|
||||
// Platforms lists the platform-specific binaries for this version.
|
||||
Platforms []PluginPlatform `json:"platforms"`
|
||||
}
|
||||
|
||||
// PluginPlatform represents a platform-specific binary entry.
|
||||
type PluginPlatform struct {
|
||||
OS string `json:"os"`
|
||||
Arch string `json:"arch"`
|
||||
URL string `json:"url"`
|
||||
// OS is the target operating system (e.g. "darwin", "linux", "windows").
|
||||
OS string `json:"os"`
|
||||
|
||||
// Arch is the target architecture (e.g. "amd64", "arm64").
|
||||
Arch string `json:"arch"`
|
||||
|
||||
// URL is the download URL for the archive or binary.
|
||||
URL string `json:"url"`
|
||||
|
||||
// Checksum is the expected digest in "<algorithm>:<hex>" format
|
||||
// (e.g. "sha256:cd85d5d84d264...").
|
||||
Checksum string `json:"checksum"`
|
||||
|
||||
// ExtractPath overrides the default binary lookup name inside archives.
|
||||
// When set, it is matched as an exact path within the archive (e.g.
|
||||
// "bin/flux-operator"). When empty, the archive is searched by the
|
||||
// base name derived from the manifest's Bin field.
|
||||
ExtractPath string `json:"extractPath,omitempty"`
|
||||
}
|
||||
|
||||
// PluginCatalog represents the generated catalog.yaml file.
|
||||
type PluginCatalog struct {
|
||||
APIVersion string `json:"apiVersion"`
|
||||
Kind string `json:"kind"`
|
||||
Plugins []CatalogEntry `json:"plugins"`
|
||||
// APIVersion is the catalog schema version (e.g. "cli.fluxcd.io/v1beta1").
|
||||
APIVersion string `json:"apiVersion"`
|
||||
|
||||
// Kind is the catalog type, must be "PluginCatalog".
|
||||
Kind string `json:"kind"`
|
||||
|
||||
// Plugins lists all available plugins in the catalog.
|
||||
Plugins []CatalogEntry `json:"plugins"`
|
||||
}
|
||||
|
||||
// CatalogEntry is a single entry in the plugin catalog.
|
||||
type CatalogEntry struct {
|
||||
Name string `json:"name"`
|
||||
// Name is the plugin name.
|
||||
Name string `json:"name"`
|
||||
|
||||
// Description is a short human-readable summary of the plugin.
|
||||
Description string `json:"description"`
|
||||
Homepage string `json:"homepage,omitempty"`
|
||||
Source string `json:"source,omitempty"`
|
||||
License string `json:"license,omitempty"`
|
||||
|
||||
// Homepage is the URL to the plugin's documentation site.
|
||||
Homepage string `json:"homepage,omitempty"`
|
||||
|
||||
// Source is the URL to the plugin's source repository.
|
||||
Source string `json:"source,omitempty"`
|
||||
|
||||
// License is the SPDX license identifier (e.g. "Apache-2.0").
|
||||
License string `json:"license,omitempty"`
|
||||
}
|
||||
|
||||
// Receipt records what was installed for a plugin.
|
||||
type Receipt struct {
|
||||
Name string `json:"name"`
|
||||
Version string `json:"version"`
|
||||
InstalledAt string `json:"installedAt"`
|
||||
Platform PluginPlatform `json:"platform"`
|
||||
// Name is the plugin name (e.g. "operator").
|
||||
Name string `json:"name"`
|
||||
|
||||
// Version is the installed semantic version.
|
||||
Version string `json:"version"`
|
||||
|
||||
// InstalledAt is the RFC 3339 timestamp of the installation.
|
||||
InstalledAt string `json:"installedAt"`
|
||||
|
||||
// Platform records the platform-specific details used for installation.
|
||||
Platform PluginPlatform `json:"platform"`
|
||||
}
|
||||
|
||||
// CatalogClient fetches plugin manifests and catalogs from a remote URL.
|
||||
type CatalogClient struct {
|
||||
BaseURL string
|
||||
// BaseURL is the catalog base URL for fetching manifests.
|
||||
BaseURL string
|
||||
|
||||
// HTTPClient is the HTTP client used for catalog requests.
|
||||
HTTPClient *http.Client
|
||||
GetEnv func(key string) string
|
||||
|
||||
// GetEnv returns the value of an environment variable.
|
||||
GetEnv func(key string) string
|
||||
}
|
||||
|
||||
// NewCatalogClient returns a CatalogClient with production defaults.
|
||||
|
||||
Reference in New Issue
Block a user