Documentation
¶
Overview ¶
Package registry reads the aqua-registry (v1) registry.yaml. aqua-registry commits a merged registry.yaml at the repository root, so the whole package list can be fetched with a single request instead of walking pkgs/.
Index ¶
- Constants
- func APIPath(ref string) string
- func FetchAqua(ctx context.Context, client Client, ref string) (map[string]*aquaregistry.PackageInfo, error)
- func FetchScaffold(ctx context.Context, client Client, ref, pkgName string) (*genrgst.RawConfig, error)
- func ScaffoldPath(ref, pkgName string) string
- type Client
- type Package
- type Registry
Constants ¶
const ( Owner = "aquaproj" Name = "aqua-registry" // Path is the path of the merged registry.yaml in that repository. Path = "registry.yaml" )
Owner and Name identify the repository the package list is read from.
Variables ¶
This section is empty.
Functions ¶
func APIPath ¶
APIPath returns the Contents API path of the merged registry.yaml at ref, relative to the API base URL.
The Contents API is used rather than raw.githubusercontent.com because it takes the access token: the request then counts against the documented 5,000/hour bucket and reports errors as the rest of the API does, instead of against raw's undocumented limits for unauthenticated traffic. It also supports conditional requests, and a 304 costs no rate limit at all.
func FetchAqua ¶
func FetchAqua(ctx context.Context, client Client, ref string) (map[string]*aquaregistry.PackageInfo, error)
FetchAqua downloads aqua-registry's merged registry.yaml at ref and parses it with aqua's own types.
Fetch reads only the fields ar2 needs to build its work list; this returns the full definitions, which registry.json generation merges on top of what it infers from a release.
func FetchScaffold ¶
func FetchScaffold(ctx context.Context, client Client, ref, pkgName string) (*genrgst.RawConfig, error)
FetchScaffold returns a package's aqua gr configuration, or nil when it has none.
Most packages have none: the file exists only where the release needs something the inference can't work out, such as which of its assets is the command. A package without one is the normal case rather than a failure, so a missing file reads as nothing to apply.
func ScaffoldPath ¶
ScaffoldPath returns the Contents API path of a package's scaffold.yaml at ref.
Types ¶
type Client ¶
type Client interface {
NewRequest(ctx context.Context, method, urlStr string, body any, opts ...github.RequestOption) (*http.Request, error)
Do(req *http.Request, v any) (*github.Response, error)
}
Client is the subset of go-github's client that Fetch uses. go-github has no method returning a file over 1 MB, so the request is built by hand; going through the client still gives its base URL, authentication, and error types such as *github.RateLimitError.
type Package ¶
type Package struct {
Name string `yaml:"name"`
Type string `yaml:"type"`
RepoOwner string `yaml:"repo_owner"`
RepoName string `yaml:"repo_name"`
}
Package is the subset of a package definition that ar2 needs. Only the fields identifying the upstream GitHub repository are read; everything else is resolved from the release itself when registry.json is generated.
func (*Package) HasRepo ¶
HasRepo reports whether the package refers to a GitHub repository. Packages without one (crates.io, http, ...) can't have a star count.
func (*Package) PackageName ¶
PackageName returns the package name. aqua-registry omits `name` when it is the same as "<repo_owner>/<repo_name>".